[ARVADOS-DEV] updated: 6f19089ca96e485f457932dce44256e46f1e3711

git at public.curoverse.com git at public.curoverse.com
Fri Feb 12 15:14:04 EST 2016


Summary of changes:
 arvbox/README.md                                   |  5 +++++
 arvbox/bin/arvbox                                  | 23 +++++++++++++--------
 arvbox/lib/arvbox/docker/Dockerfile.base           |  4 +++-
 .../lib/arvbox/docker/application_yml_override.py  | 24 ++++++++++++++++++++++
 arvbox/lib/arvbox/docker/service/api/run-service   |  2 ++
 arvbox/lib/arvbox/docker/service/sso/run-service   |  2 ++
 .../arvbox/docker/service/workbench/run-service    |  2 ++
 7 files changed, 52 insertions(+), 10 deletions(-)
 create mode 100755 arvbox/lib/arvbox/docker/application_yml_override.py

       via  6f19089ca96e485f457932dce44256e46f1e3711 (commit)
      from  bb26448a7551a9165e8674ade83e32f4d17adc9a (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.


commit 6f19089ca96e485f457932dce44256e46f1e3711
Author: Peter Amstutz <peter.amstutz at curoverse.com>
Date:   Fri Feb 12 15:14:01 2016 -0500

    Add arvbox support for overriding settings in application.yml
    no issue #

diff --git a/arvbox/README.md b/arvbox/README.md
index 9ced1d1..8098686 100644
--- a/arvbox/README.md
+++ b/arvbox/README.md
@@ -46,6 +46,11 @@ are bind mounted from the host file system for easy access and persistence
 across container rebuilds.  Services are bound to the Docker container's
 network IP address and can only be accessed on the local host.
 
+In "dev" mode, you can override the default autogenerated settings of Rails
+projects by adding "application.yml.override" to any Rails project (sso, api,
+workbench).  This can be used to test out API server settings or point
+Workbench at an alternate API server.
+
 ### localdemo
 Demo configuration.  Boots a complete Arvados environment inside the container.
 Unlike the development configuration, code directories are included in the demo
diff --git a/arvbox/bin/arvbox b/arvbox/bin/arvbox
index d60c354..10fac0d 100755
--- a/arvbox/bin/arvbox
+++ b/arvbox/bin/arvbox
@@ -196,7 +196,7 @@ run() {
                    WORKSPACE=/usr/src/arvados \
                    GEM_HOME=/var/lib/gems \
                    "$@"
-        else
+        elif echo "$1" | grep 'dev$' ; then
             docker run \
                    --detach \
                    --name=$ARVBOX_CONTAINER \
@@ -212,6 +212,8 @@ run() {
             updateconf
             wait_for_arvbox
             echo "The Arvados source code is checked out at: $ARVADOS_ROOT"
+        else
+            echo "Unknown configuration '$1'"
         fi
     fi
 }
@@ -348,15 +350,18 @@ case "$subcmd" in
         fi
         ;;
 
-    log|svrestart)
+    log)
         if test -n "$1" ; then
-            if test "$subcmd" = log ; then
-                docker exec -ti $ARVBOX_CONTAINER /usr/bin/env TERM=$TERM less --follow-name +GF "/etc/service/$1/log/main/current"
-            fi
-            if test "$subcmd" = svrestart ; then
-                docker exec -ti $ARVBOX_CONTAINER sv restart "$1"
-                docker exec -ti $ARVBOX_CONTAINER sv restart ready
-            fi
+            docker exec -ti $ARVBOX_CONTAINER /usr/bin/env TERM=$TERM less --follow-name +GF "/etc/service/$1/log/main/current"
+        else
+            docker exec -ti $ARVBOX_CONTAINER /usr/bin/env TERM=$TERM tail $(docker exec -ti $ARVBOX_CONTAINER find -L /etc -path '/etc/service/*/log/main/current' -printf " %p")
+        fi
+        ;;
+
+    svrestart)
+        if test -n "$1" ; then
+            docker exec -ti $ARVBOX_CONTAINER sv restart "$1"
+            docker exec -ti $ARVBOX_CONTAINER sv restart ready
         else
             echo "Usage: $0 $subcmd <service>"
             echo "Available services:"
diff --git a/arvbox/lib/arvbox/docker/Dockerfile.base b/arvbox/lib/arvbox/docker/Dockerfile.base
index 108ed53..c0dc767 100644
--- a/arvbox/lib/arvbox/docker/Dockerfile.base
+++ b/arvbox/lib/arvbox/docker/Dockerfile.base
@@ -6,7 +6,7 @@ RUN apt-get update && \
     ruby rake bundler curl libpq-dev \
     libcurl4-openssl-dev libssl-dev zlib1g-dev libpcre3-dev \
     openssh-server python-setuptools netcat-traditional \
-    libpython-dev fuse libfuse-dev python-pip \
+    libpython-dev fuse libfuse-dev python-pip python-yaml \
     pkg-config libattr1-dev python-llfuse python-pycurl \
     libwww-perl libio-socket-ssl-perl libcrypt-ssleay-perl \
     libjson-perl nginx gitolite3 lsof python-epydoc graphviz
@@ -27,7 +27,9 @@ ADD fuse.conf /etc/
 ADD crunch-setup.sh gitolite.rc \
     keep-setup.sh common.sh createusers.sh \
     logger runsu.sh waitforpostgres.sh \
+    application_yml_override.py \
     /usr/local/lib/arvbox/
+
 ADD service/ /usr/local/lib/arvbox/service
 RUN rmdir /etc/service && ln -sf /usr/local/lib/arvbox/service /etc
 
diff --git a/arvbox/lib/arvbox/docker/application_yml_override.py b/arvbox/lib/arvbox/docker/application_yml_override.py
new file mode 100755
index 0000000..98a8e48
--- /dev/null
+++ b/arvbox/lib/arvbox/docker/application_yml_override.py
@@ -0,0 +1,24 @@
+#!/usr/bin/env python
+
+import yaml
+
+try:
+    with open("application.yml.override") as f:
+        b = yaml.load(f)
+except IOError:
+    exit()
+
+with open("application.yml") as f:
+    a = yaml.load(f)
+
+def recursiveMerge(a, b):
+    if isinstance(a, dict) and isinstance(b, dict):
+        for k in b:
+            print k
+            a[k] = recursiveMerge(a.get(k), b[k])
+        return a
+    else:
+        return b
+
+with open("application.yml", "w") as f:
+    yaml.dump(recursiveMerge(a, b), f)
diff --git a/arvbox/lib/arvbox/docker/service/api/run-service b/arvbox/lib/arvbox/docker/service/api/run-service
index 530a039..058939c 100755
--- a/arvbox/lib/arvbox/docker/service/api/run-service
+++ b/arvbox/lib/arvbox/docker/service/api/run-service
@@ -64,6 +64,8 @@ development:
   default_collection_replication: 1
 EOF
 
+(cd config && /usr/local/lib/arvbox/application_yml_override.py)
+
 if ! test -f /var/lib/arvados/api_database_pw ; then
     ruby -e 'puts rand(2**128).to_s(36)' > /var/lib/arvados/api_database_pw
 fi
diff --git a/arvbox/lib/arvbox/docker/service/sso/run-service b/arvbox/lib/arvbox/docker/service/sso/run-service
index 2f501a4..da413e0 100755
--- a/arvbox/lib/arvbox/docker/service/sso/run-service
+++ b/arvbox/lib/arvbox/docker/service/sso/run-service
@@ -39,6 +39,8 @@ development:
   allow_account_registration: true
 EOF
 
+(cd config && /usr/local/lib/arvbox/application_yml_override.py)
+
 if ! test -f /var/lib/arvados/sso_database_pw ; then
     ruby -e 'puts rand(2**128).to_s(36)' > /var/lib/arvados/sso_database_pw
 fi
diff --git a/arvbox/lib/arvbox/docker/service/workbench/run-service b/arvbox/lib/arvbox/docker/service/workbench/run-service
index 7f0542f..850022a 100755
--- a/arvbox/lib/arvbox/docker/service/workbench/run-service
+++ b/arvbox/lib/arvbox/docker/service/workbench/run-service
@@ -36,3 +36,5 @@ development:
   keep_web_url: http://$localip:${services[keep-web]}/c=%{uuid_or_pdh}
   arvados_docsite: http://$localip:${services[doc]}/
 EOF
+
+(cd config && /usr/local/lib/arvbox/application_yml_override.py)

-----------------------------------------------------------------------


hooks/post-receive
-- 




More information about the arvados-commits mailing list