[ARVADOS-DEV] updated: a0d297b64c24caff3a85167fb9c179c2ae605098

git at public.curoverse.com git at public.curoverse.com
Mon Jan 11 16:42:12 EST 2016


Summary of changes:
 arvbox/README                                      |   2 +-
 arvbox/bin/arvbox                                  | 277 ++++++++++++---------
 arvbox/lib/arvbox/docker/Dockerfile.base           |  18 +-
 arvbox/lib/arvbox/docker/Dockerfile.demo           |  16 +-
 arvbox/lib/arvbox/docker/Dockerfile.dev            |   4 -
 arvbox/lib/arvbox/docker/common.sh                 |  23 ++
 arvbox/lib/arvbox/docker/createusers.sh            |   9 +-
 arvbox/lib/arvbox/docker/crunch-setup.sh           |   8 +-
 arvbox/lib/arvbox/docker/gitolite-setup.sh         |  19 --
 arvbox/lib/arvbox/docker/gitssh-setup.sh           |  24 --
 arvbox/lib/arvbox/docker/keep-setup.sh             |  36 ++-
 arvbox/lib/arvbox/docker/{service => }/logger      |   0
 arvbox/lib/arvbox/docker/{service => }/runsu.sh    |   4 +-
 arvbox/lib/arvbox/docker/service/api/log/run       |   2 +-
 arvbox/lib/arvbox/docker/service/api/run           |   2 +-
 arvbox/lib/arvbox/docker/service/api/run-service   |  10 +-
 .../{keepweb => arv-git-httpd}/log/main/.gitstub   |   0
 .../arvbox/docker/service/arv-git-httpd/log/run    |   1 +
 arvbox/lib/arvbox/docker/service/arv-git-httpd/run |   1 +
 .../service/{githttp => arv-git-httpd}/run-service |  14 +-
 .../{keep1 => crunch-dispatch0}/log/main/.gitstub  |   0
 .../arvbox/docker/service/crunch-dispatch0/log/run |   1 +
 .../lib/arvbox/docker/service/crunch-dispatch0/run |   1 +
 .../{crunch0 => crunch-dispatch0}/run-service      |   0
 .../{keep0 => crunch-dispatch1}/log/main/.gitstub  |   0
 .../arvbox/docker/service/crunch-dispatch1/log/run |   1 +
 .../lib/arvbox/docker/service/crunch-dispatch1/run |   1 +
 .../{crunch1 => crunch-dispatch1}/run-service      |   0
 arvbox/lib/arvbox/docker/service/crunch0/log/run   |   1 -
 arvbox/lib/arvbox/docker/service/crunch0/run       |   1 -
 arvbox/lib/arvbox/docker/service/crunch1/log/run   |   1 -
 arvbox/lib/arvbox/docker/service/crunch1/run       |   1 -
 arvbox/lib/arvbox/docker/service/doc/log/run       |   2 +-
 arvbox/lib/arvbox/docker/service/doc/run           |   2 +-
 arvbox/lib/arvbox/docker/service/doc/run-service   |  30 ++-
 arvbox/lib/arvbox/docker/service/docker/log/run    |   2 +-
 arvbox/lib/arvbox/docker/service/git/log/run       |   1 -
 arvbox/lib/arvbox/docker/service/git/run           |   1 -
 arvbox/lib/arvbox/docker/service/githttp/log/run   |   1 -
 arvbox/lib/arvbox/docker/service/githttp/run       |   1 -
 .../{githttp => gitolite}/log/main/.gitstub        |   0
 arvbox/lib/arvbox/docker/service/gitolite/log/run  |   1 +
 arvbox/lib/arvbox/docker/service/gitolite/run      |   1 +
 .../docker/service/{git => gitolite}/run-service   |  51 +++-
 .../service/{git => keep-web}/log/main/.gitstub    |   0
 arvbox/lib/arvbox/docker/service/keep-web/log/run  |   1 +
 arvbox/lib/arvbox/docker/service/keep-web/run      |   1 +
 .../service/{keepweb => keep-web}/run-service      |  10 +-
 arvbox/lib/arvbox/docker/service/keep0/log/run     |   1 -
 arvbox/lib/arvbox/docker/service/keep0/run         |   1 -
 arvbox/lib/arvbox/docker/service/keep0/run-service |   2 -
 arvbox/lib/arvbox/docker/service/keep1/log/run     |   1 -
 arvbox/lib/arvbox/docker/service/keep1/run         |   1 -
 arvbox/lib/arvbox/docker/service/keep1/run-service |   3 -
 arvbox/lib/arvbox/docker/service/keepproxy/log/run |   2 +-
 arvbox/lib/arvbox/docker/service/keepproxy/run     |   2 +-
 .../arvbox/docker/service/keepproxy/run-service    |  34 +--
 .../{crunch1 => keepstore0}/log/main/.gitstub      |   0
 .../lib/arvbox/docker/service/keepstore0/log/run   |   1 +
 arvbox/lib/arvbox/docker/service/keepstore0/run    |   1 +
 .../arvbox/docker/service/keepstore0/run-service   |   3 +
 .../{crunch0 => keepstore1}/log/main/.gitstub      |   0
 .../lib/arvbox/docker/service/keepstore1/log/run   |   1 +
 arvbox/lib/arvbox/docker/service/keepstore1/run    |   1 +
 .../arvbox/docker/service/keepstore1/run-service   |   3 +
 arvbox/lib/arvbox/docker/service/keepweb/log/run   |   1 -
 arvbox/lib/arvbox/docker/service/keepweb/run       |   1 -
 arvbox/lib/arvbox/docker/service/postgres/log/run  |   2 +-
 arvbox/lib/arvbox/docker/service/postgres/run      |  20 +-
 .../lib/arvbox/docker/service/postgres/run-service |   4 +-
 arvbox/lib/arvbox/docker/service/ready/run         |   2 +-
 arvbox/lib/arvbox/docker/service/ready/run-service |  18 +-
 arvbox/lib/arvbox/docker/service/sdk/log/run       |   2 +-
 arvbox/lib/arvbox/docker/service/sdk/run           |   2 +-
 arvbox/lib/arvbox/docker/service/sdk/run-service   |   2 +-
 arvbox/lib/arvbox/docker/service/ssh/log/run       |   2 +-
 arvbox/lib/arvbox/docker/service/ssh/run           |   4 +-
 arvbox/lib/arvbox/docker/service/sso/log/run       |   2 +-
 arvbox/lib/arvbox/docker/service/sso/run           |   2 +-
 arvbox/lib/arvbox/docker/service/sso/run-service   |   6 +-
 arvbox/lib/arvbox/docker/service/vm/log/run        |   2 +-
 arvbox/lib/arvbox/docker/service/vm/run            |  10 +-
 arvbox/lib/arvbox/docker/service/vm/run-service    |  25 +-
 arvbox/lib/arvbox/docker/service/workbench/log/run |   2 +-
 arvbox/lib/arvbox/docker/service/workbench/run     |   2 +-
 .../arvbox/docker/service/workbench/run-service    |  15 +-
 86 files changed, 402 insertions(+), 364 deletions(-)
 delete mode 100755 arvbox/lib/arvbox/docker/gitolite-setup.sh
 delete mode 100755 arvbox/lib/arvbox/docker/gitssh-setup.sh
 rename arvbox/lib/arvbox/docker/{service => }/logger (100%)
 rename arvbox/lib/arvbox/docker/{service => }/runsu.sh (75%)
 rename arvbox/lib/arvbox/docker/service/{keepweb => arv-git-httpd}/log/main/.gitstub (100%)
 create mode 120000 arvbox/lib/arvbox/docker/service/arv-git-httpd/log/run
 create mode 120000 arvbox/lib/arvbox/docker/service/arv-git-httpd/run
 rename arvbox/lib/arvbox/docker/service/{githttp => arv-git-httpd}/run-service (54%)
 rename arvbox/lib/arvbox/docker/service/{keep1 => crunch-dispatch0}/log/main/.gitstub (100%)
 create mode 120000 arvbox/lib/arvbox/docker/service/crunch-dispatch0/log/run
 create mode 120000 arvbox/lib/arvbox/docker/service/crunch-dispatch0/run
 rename arvbox/lib/arvbox/docker/service/{crunch0 => crunch-dispatch0}/run-service (100%)
 rename arvbox/lib/arvbox/docker/service/{keep0 => crunch-dispatch1}/log/main/.gitstub (100%)
 create mode 120000 arvbox/lib/arvbox/docker/service/crunch-dispatch1/log/run
 create mode 120000 arvbox/lib/arvbox/docker/service/crunch-dispatch1/run
 rename arvbox/lib/arvbox/docker/service/{crunch1 => crunch-dispatch1}/run-service (100%)
 delete mode 120000 arvbox/lib/arvbox/docker/service/crunch0/log/run
 delete mode 120000 arvbox/lib/arvbox/docker/service/crunch0/run
 delete mode 120000 arvbox/lib/arvbox/docker/service/crunch1/log/run
 delete mode 120000 arvbox/lib/arvbox/docker/service/crunch1/run
 delete mode 120000 arvbox/lib/arvbox/docker/service/git/log/run
 delete mode 120000 arvbox/lib/arvbox/docker/service/git/run
 delete mode 120000 arvbox/lib/arvbox/docker/service/githttp/log/run
 delete mode 120000 arvbox/lib/arvbox/docker/service/githttp/run
 rename arvbox/lib/arvbox/docker/service/{githttp => gitolite}/log/main/.gitstub (100%)
 create mode 120000 arvbox/lib/arvbox/docker/service/gitolite/log/run
 create mode 120000 arvbox/lib/arvbox/docker/service/gitolite/run
 rename arvbox/lib/arvbox/docker/service/{git => gitolite}/run-service (62%)
 rename arvbox/lib/arvbox/docker/service/{git => keep-web}/log/main/.gitstub (100%)
 create mode 120000 arvbox/lib/arvbox/docker/service/keep-web/log/run
 create mode 120000 arvbox/lib/arvbox/docker/service/keep-web/run
 rename arvbox/lib/arvbox/docker/service/{keepweb => keep-web}/run-service (59%)
 delete mode 120000 arvbox/lib/arvbox/docker/service/keep0/log/run
 delete mode 120000 arvbox/lib/arvbox/docker/service/keep0/run
 delete mode 100755 arvbox/lib/arvbox/docker/service/keep0/run-service
 delete mode 120000 arvbox/lib/arvbox/docker/service/keep1/log/run
 delete mode 120000 arvbox/lib/arvbox/docker/service/keep1/run
 delete mode 100755 arvbox/lib/arvbox/docker/service/keep1/run-service
 rename arvbox/lib/arvbox/docker/service/{crunch1 => keepstore0}/log/main/.gitstub (100%)
 create mode 120000 arvbox/lib/arvbox/docker/service/keepstore0/log/run
 create mode 120000 arvbox/lib/arvbox/docker/service/keepstore0/run
 create mode 100755 arvbox/lib/arvbox/docker/service/keepstore0/run-service
 rename arvbox/lib/arvbox/docker/service/{crunch0 => keepstore1}/log/main/.gitstub (100%)
 create mode 120000 arvbox/lib/arvbox/docker/service/keepstore1/log/run
 create mode 120000 arvbox/lib/arvbox/docker/service/keepstore1/run
 create mode 100755 arvbox/lib/arvbox/docker/service/keepstore1/run-service
 delete mode 120000 arvbox/lib/arvbox/docker/service/keepweb/log/run
 delete mode 120000 arvbox/lib/arvbox/docker/service/keepweb/run
 mode change 120000 => 100755 arvbox/lib/arvbox/docker/service/vm/run

       via  a0d297b64c24caff3a85167fb9c179c2ae605098 (commit)
       via  f3b90d4c543dcfbcbd4ea8023cfec78a1e65690b (commit)
       via  ba698c52e9be47f547dd743f4e13d7992db80743 (commit)
      from  b6bd09f01642d2ad2dc33259a2382615daadf059 (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 a0d297b64c24caff3a85167fb9c179c2ae605098
Author: Peter Amstutz <peter.amstutz at curoverse.com>
Date:   Mon Jan 11 16:42:08 2016 -0500

    Remove test image, use the same image for dev and test.

diff --git a/arvbox/bin/arvbox b/arvbox/bin/arvbox
index 0d34783..8b3aa0b 100755
--- a/arvbox/bin/arvbox
+++ b/arvbox/bin/arvbox
@@ -14,8 +14,12 @@ if test -z "$ARVBOX_CONTAINER" ; then
     ARVBOX_CONTAINER=arvbox
 fi
 
+if test -z "$ARVBOX_BASE" ; then
+    ARVBOX_BASE="$HOME/.arvbox"
+fi
+
 if test -z "$ARVBOX_DATA" ; then
-    ARVBOX_DATA="$HOME/.arvbox/$ARVBOX_CONTAINER"
+    ARVBOX_DATA="$ARVBOX_BASE/$ARVBOX_CONTAINER"
 fi
 
 if test -z "$ARVADOS_ROOT" ; then
@@ -84,28 +88,29 @@ run() {
                    "--volume=$VAR_DATA:/var/lib/arvados:rw" \
                    "--volume=$PASSENGER:/var/lib/passenger:rw" \
                    "--volume=$GEMS:/var/lib/gems:rw" \
-                   arvados/arvbox-test
+                   arvados/arvbox-dev \
+                   /usr/local/lib/arvbox/service/postgres/run
 
             while ! docker exec -ti \
                     $ARVBOX_CONTAINER \
-                    /etc/tests-service/runsu.sh \
+                    /usr/local/lib/arvbox/runsu.sh \
                     psql -c'\du' ; do
                 sleep 1
             done
 
             docker exec -ti \
                    $ARVBOX_CONTAINER \
-                   /etc/tests-service/runsu.sh \
-                   /etc/service/sso/run-service --only-setup
+                   /usr/local/lib/arvbox/runsu.sh \
+                   /usr/local/lib/arvbox/service/sso/run-service --only-setup
 
             docker exec -ti \
                    $ARVBOX_CONTAINER \
-                   /etc/tests-service/runsu.sh \
-                   /etc/service/api/run-service --only-setup
+                   /usr/local/lib/arvbox/runsu.sh \
+                   /usr/local/lib/arvbox/service/api/run-service --only-setup
 
             docker exec -ti \
                    $ARVBOX_CONTAINER \
-                   /etc/tests-service/runsu.sh \
+                   /usr/local/lib/arvbox/runsu.sh \
                    /usr/src/arvados-dev/jenkins/run-tests.sh \
                    --leave-temp \
                    WORKSPACE=/usr/src/arvados \
@@ -159,9 +164,10 @@ build() {
         exit 1
     fi
     docker build -t arvados/arvbox-base -f "$ARVBOX_DOCKER/Dockerfile.base" "$ARVBOX_DOCKER"
-    docker build -t arvados/arvbox-dev -f "$ARVBOX_DOCKER/Dockerfile.dev" "$ARVBOX_DOCKER"
-    if test "$1" = demo -o "$1" = test ; then
-        docker build -t arvados/arvbox-$1 -f "$ARVBOX_DOCKER/Dockerfile.$1" "$ARVBOX_DOCKER"
+    if test "$1" = dev -o "$1" = test ; then
+        docker build -t arvados/arvbox-dev -f "$ARVBOX_DOCKER/Dockerfile.dev" "$ARVBOX_DOCKER"
+    else
+        docker build -t arvados/arvbox-demo -f "$ARVBOX_DOCKER/Dockerfile.demo" "$ARVBOX_DOCKER"
     fi
 }
 
@@ -173,7 +179,9 @@ check() {
 }
 
 subcmd="$1"
-shift
+if test -n "$subcmd" ; then
+    shift
+fi
 case "$subcmd" in
     build)
         check $@
@@ -195,7 +203,7 @@ case "$subcmd" in
 
     restart)
         check $@
-        stop $@
+        stop
         run $@
         ;;
 
@@ -247,10 +255,10 @@ case "$subcmd" in
     log|svrestart)
         if test -n "$1" ; then
             if test "$subcmd" = log ; then
-                docker exec -ti $ARVBOX_CONTAINER tail -n100 /etc/service/$1/log/main/current
+                docker exec -ti $ARVBOX_CONTAINER tail -n100 "/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 "$1"
                 docker exec -ti $ARVBOX_CONTAINER sv restart ready
             fi
         else
@@ -262,11 +270,12 @@ case "$subcmd" in
 
     clone)
         if test -n "$2" ; then
-            cp -r $HOME/.arvbox/$1 $HOME/.arvbox/$2
+            cp -r "$ARVBOX_BASE/$1" "$ARVBOX_BASE/$2"
             echo "Created new arvbox $2"
             echo "export ARVBOX_CONTAINER=$2"
         else
             echo "clone <from> <to>   clone an arvbox"
+            echo "available arvboxes: $(ls $ARVBOX_BASE)"
         fi
         ;;
 
diff --git a/arvbox/lib/arvbox/docker/Dockerfile.base b/arvbox/lib/arvbox/docker/Dockerfile.base
index e73ba92..e9b90ac 100644
--- a/arvbox/lib/arvbox/docker/Dockerfile.base
+++ b/arvbox/lib/arvbox/docker/Dockerfile.base
@@ -23,6 +23,8 @@ ADD fuse.conf /etc/
 ADD crunch-setup.sh gitolite.rc \
     keep-setup.sh common.sh createusers.sh logger runsu.sh \
     /usr/local/lib/arvbox/
+ADD service/ /usr/local/lib/arvbox/service
+RUN rmdir /etc/service && ln -sf /usr/local/lib/arvbox/service /etc
 
 # Start the supervisor.
 CMD ["/usr/local/bin/runsvinit"]
diff --git a/arvbox/lib/arvbox/docker/Dockerfile.demo b/arvbox/lib/arvbox/docker/Dockerfile.demo
index 8a255f8..1085abc 100644
--- a/arvbox/lib/arvbox/docker/Dockerfile.demo
+++ b/arvbox/lib/arvbox/docker/Dockerfile.demo
@@ -1,4 +1,4 @@
-FROM arvados/arvbox-dev
+FROM arvados/arvbox-base
 
 RUN cd /usr/src && \
     git clone https://github.com/curoverse/arvados.git && \
@@ -6,9 +6,9 @@ RUN cd /usr/src && \
 
 RUN chown -R 1000:1000 /usr/src && /usr/local/lib/arvbox/createusers.sh
 
-RUN sudo -u arvbox /etc/service/sso/run-service --only-deps
-RUN sudo -u arvbox /etc/service/api/run-service --only-deps
-RUN sudo -u arvbox /etc/service/workbench/run-service --only-deps
-RUN sudo -u arvbox /etc/service/doc/run-service --only-deps
-RUN sudo -u arvbox /etc/service/vm/run-service --only-deps
-RUN sudo -u arvbox /etc/service/sdk/run-service
+RUN sudo -u arvbox /usr/local/lib/arvbox/service/sso/run-service --only-deps
+RUN sudo -u arvbox /usr/local/lib/arvbox/service/api/run-service --only-deps
+RUN sudo -u arvbox /usr/local/lib/arvbox/service/workbench/run-service --only-deps
+RUN sudo -u arvbox /usr/local/lib/arvbox/service/doc/run-service --only-deps
+RUN sudo -u arvbox /usr/local/lib/arvbox/service/vm/run-service --only-deps
+RUN sudo -u arvbox /usr/local/lib/arvbox/service/sdk/run-service
diff --git a/arvbox/lib/arvbox/docker/Dockerfile.dev b/arvbox/lib/arvbox/docker/Dockerfile.dev
index fc81bb6..9883d37 100644
--- a/arvbox/lib/arvbox/docker/Dockerfile.dev
+++ b/arvbox/lib/arvbox/docker/Dockerfile.dev
@@ -1,3 +1,11 @@
 FROM arvados/arvbox-base
 
-ADD service /etc/service
+RUN apt-get update && \
+    DEBIAN_FRONTEND=noninteractive apt-get -yq install \
+    python-virtualenv python3-virtualenv linkchecker xvfb iceweasel
+
+RUN set -e && \
+ PJS=phantomjs-1.9.7-linux-x86_64 && \
+ curl -L -o/tmp/$PJS.tar.bz2 https://bitbucket.org/ariya/phantomjs/downloads/$PJS.tar.bz2 && \
+ tar -C /usr/local -xjf /tmp/$PJS.tar.bz2 && \
+ ln -s ../$PJS/bin/phantomjs /usr/local/bin/
diff --git a/arvbox/lib/arvbox/docker/Dockerfile.test b/arvbox/lib/arvbox/docker/Dockerfile.test
deleted file mode 100644
index c84dfb5..0000000
--- a/arvbox/lib/arvbox/docker/Dockerfile.test
+++ /dev/null
@@ -1,13 +0,0 @@
-FROM arvados/arvbox-base
-
-RUN apt-get update && \
-    DEBIAN_FRONTEND=noninteractive apt-get -yq install \
-    python-virtualenv python3-virtualenv linkchecker xvfb iceweasel
-
-RUN set -e && \
- PJS=phantomjs-1.9.7-linux-x86_64 && \
- curl -L -o/tmp/$PJS.tar.bz2 https://bitbucket.org/ariya/phantomjs/downloads/$PJS.tar.bz2 && \
- tar -C /usr/local -xjf /tmp/$PJS.tar.bz2 && \
- ln -s ../$PJS/bin/phantomjs /usr/local/bin/
-
-ADD service/postgres /etc/service/
diff --git a/arvbox/lib/arvbox/docker/common.sh b/arvbox/lib/arvbox/docker/common.sh
index d508c5c..69869a7 100644
--- a/arvbox/lib/arvbox/docker/common.sh
+++ b/arvbox/lib/arvbox/docker/common.sh
@@ -17,7 +17,7 @@ services=(
   [doc]=8001
 )
 
-if test $(id arvbox -u) = 0 ; then
+if test "$(id arvbox -u 2>/dev/null)" = 0 ; then
     PGUSER=postgres
     PGGROUP=postgres
 else

commit f3b90d4c543dcfbcbd4ea8023cfec78a1e65690b
Author: Peter Amstutz <peter.amstutz at curoverse.com>
Date:   Mon Jan 11 15:26:34 2016 -0500

    8080: Better quoting.  Refactor git initialization.  Move runsh and logger
    scripts.  Rename some services.  Add -o pipefail.

diff --git a/arvbox/README b/arvbox/README
index f6b7267..bfc4ab4 100644
--- a/arvbox/README
+++ b/arvbox/README
@@ -4,7 +4,7 @@ Development and demonstration environment for Arvados.
 
 Usage:
 
-$ ./arvbox reboot
+$ ./bin/arvbox reboot
 
 Notes:
 
diff --git a/arvbox/bin/arvbox b/arvbox/bin/arvbox
index af13ab9..0d34783 100755
--- a/arvbox/bin/arvbox
+++ b/arvbox/bin/arvbox
@@ -15,77 +15,117 @@ if test -z "$ARVBOX_CONTAINER" ; then
 fi
 
 if test -z "$ARVBOX_DATA" ; then
-    ARVBOX_DATA=$HOME/.arvbox/$ARVBOX_CONTAINER
+    ARVBOX_DATA="$HOME/.arvbox/$ARVBOX_CONTAINER"
 fi
 
 if test -z "$ARVADOS_ROOT" ; then
-    ARVADOS_ROOT=$ARVBOX_DATA/arvados
+    ARVADOS_ROOT="$ARVBOX_DATA/arvados"
 fi
 
 if test -z "$ARVADOS_DEV_ROOT" ; then
-    ARVADOS_DEV_ROOT=$ARVBOX_DATA/arvados-dev
+    ARVADOS_DEV_ROOT="$ARVBOX_DATA/arvados-dev"
 fi
 
 if test -z "$SSO_ROOT" ; then
-    SSO_ROOT=$ARVBOX_DATA/sso-devise-omniauth-provider
+    SSO_ROOT="$ARVBOX_DATA/sso-devise-omniauth-provider"
 fi
 
-PG_DATA=$ARVBOX_DATA/postgres
-VAR_DATA=$ARVBOX_DATA/var
-PASSENGER=$ARVBOX_DATA/passenger
-GEMS=$ARVBOX_DATA/gems
+PG_DATA="$ARVBOX_DATA/postgres"
+VAR_DATA="$ARVBOX_DATA/var"
+PASSENGER="$ARVBOX_DATA/passenger"
+GEMS="$ARVBOX_DATA/gems"
 
 run() {
+    if docker ps -a | grep -E "$ARVBOX_CONTAINER$" -q ; then
+        echo "Container $ARVBOX_CONTAINER is already running, use stop, restart or reboot"
+        exit 0
+    fi
+
     if test "$1" = demo ; then
-        if test -d $ARVBOX_DATA ; then
+        if test -d "$ARVBOX_DATA" ; then
             echo "It looks like you already have a development container named $ARVBOX_CONTAINER."
-            echo "Set ARVBOX_CONTAINER to something else"
+            echo "Set ARVBOX_CONTAINER to set the demo container name"
             exit 1
         fi
 
-        if docker ps -a --filter "status=exited" |grep -E "$ARVBOX_CONTAINER$" -q ; then
-            docker start -a $ARVBOX_CONTAINER
-        else
-            docker run \
-                   --name=$ARVBOX_CONTAINER \
-                   --privileged \
-                   arvados/arvbox-demo
+        if ! (docker ps -a | grep -E "$ARVBOX_CONTAINER-data$" -q) ; then
+            docker create -v /var/lib/postgres -v /var/lib/arvados --name $ARVBOX_CONTAINER-data arvados/arvbox-demo /bin/true
         fi
+        docker run \
+               --name=$ARVBOX_CONTAINER \
+               --privileged \
+               --volumes-from $ARVBOX_CONTAINER-data \
+               arvados/arvbox-demo
     else
-        mkdir -p $PG_DATA $VAR_DATA $PASSENGER $GEMS
+        mkdir -p "$PG_DATA" "$VAR_DATA" "$PASSENGER" "$GEMS"
 
-        if ! test -d $ARVADOS_ROOT ; then
-            git clone https://github.com/curoverse/arvados.git $ARVADOS_ROOT
+        if ! test -d "$ARVADOS_ROOT" ; then
+            git clone https://github.com/curoverse/arvados.git "$ARVADOS_ROOT"
         fi
-        if ! test -d $SSO_ROOT ; then
-            git clone https://github.com/curoverse/sso-devise-omniauth-provider.git $SSO_ROOT
+        if ! test -d "$SSO_ROOT" ; then
+            git clone https://github.com/curoverse/sso-devise-omniauth-provider.git "$SSO_ROOT"
         fi
 
-        if test "$1" = testing ; then
+        if test "$1" = test ; then
+            shift
+
+            if ! test -d "$ARVADOS_DEV_ROOT" ; then
+                git clone https://github.com/curoverse/arvados-dev.git "$ARVADOS_DEV_ROOT"
+            fi
+
             docker run \
                    --detach \
                    --name=$ARVBOX_CONTAINER \
                    --privileged \
-                   --volume=$ARVADOS_ROOT:/usr/src/arvados:rw \
-                   --volume=$ARVADOS_DEV_ROOT:/usr/src/arvados-dev:rw \
-                   --volume=$SSO_ROOT:/usr/src/sso:rw \
-                   --volume=$PG_DATA:/var/lib/postgresql:rw \
-                   --volume=$VAR_DATA:/var/lib/arvados:rw \
-                   --volume=$PASSENGER:/var/lib/passenger:rw \
-                   --volume=$GEMS:/var/lib/gems:rw \
-                   arvados/arvbox-dev \
-                   LD_PRELOAD=/lib/runit-docker.so exec runsvdir /etc/tests-service
+                   "--volume=$ARVADOS_ROOT:/usr/src/arvados:rw" \
+                   "--volume=$ARVADOS_DEV_ROOT:/usr/src/arvados-dev:rw" \
+                   "--volume=$SSO_ROOT:/usr/src/sso:rw" \
+                   "--volume=$PG_DATA:/var/lib/postgresql:rw" \
+                   "--volume=$VAR_DATA:/var/lib/arvados:rw" \
+                   "--volume=$PASSENGER:/var/lib/passenger:rw" \
+                   "--volume=$GEMS:/var/lib/gems:rw" \
+                   arvados/arvbox-test
+
+            while ! docker exec -ti \
+                    $ARVBOX_CONTAINER \
+                    /etc/tests-service/runsu.sh \
+                    psql -c'\du' ; do
+                sleep 1
+            done
+
+            docker exec -ti \
+                   $ARVBOX_CONTAINER \
+                   /etc/tests-service/runsu.sh \
+                   /etc/service/sso/run-service --only-setup
+
+            docker exec -ti \
+                   $ARVBOX_CONTAINER \
+                   /etc/tests-service/runsu.sh \
+                   /etc/service/api/run-service --only-setup
+
+            docker exec -ti \
+                   $ARVBOX_CONTAINER \
+                   /etc/tests-service/runsu.sh \
+                   /usr/src/arvados-dev/jenkins/run-tests.sh \
+                   --leave-temp \
+                   WORKSPACE=/usr/src/arvados \
+                   VENVDIR=/var/lib/arvados/tests-venv \
+                   VENV3DIR=/var/lib/arvados/tests-venv3 \
+                   GOPATH=/var/lib/arvados/tests-gostuff \
+                   GEMHOME=/var/lib/gems/ruby/2.1.0 \
+                   GEM_HOME=/var/lib/gems \
+                   "$@"
         else
             docker run \
                    --detach \
                    --name=$ARVBOX_CONTAINER \
                    --privileged \
-                   --volume=$ARVADOS_ROOT:/usr/src/arvados:rw \
-                   --volume=$SSO_ROOT:/usr/src/sso:rw \
-                   --volume=$PG_DATA:/var/lib/postgresql:rw \
-                   --volume=$VAR_DATA:/var/lib/arvados:rw \
-                   --volume=$PASSENGER:/var/lib/passenger:rw \
-                   --volume=$GEMS:/var/lib/gems:rw \
+                   "--volume=$ARVADOS_ROOT:/usr/src/arvados:rw" \
+                   "--volume=$SSO_ROOT:/usr/src/sso:rw" \
+                   "--volume=$PG_DATA:/var/lib/postgresql:rw" \
+                   "--volume=$VAR_DATA:/var/lib/arvados:rw" \
+                   "--volume=$PASSENGER:/var/lib/passenger:rw" \
+                   "--volume=$GEMS:/var/lib/gems:rw" \
                    arvados/arvbox-dev
             FF=/tmp/arvbox-fifo-$$
             mkfifo $FF
@@ -105,32 +145,44 @@ run() {
 }
 
 stop() {
-    if docker ps -a --filter "status=running" |grep -E "$ARVBOX_CONTAINER$" -q ; then
+    if docker ps -a --filter "status=running" | grep -E "$ARVBOX_CONTAINER$" -q ; then
         docker stop $ARVBOX_CONTAINER
     fi
-    if test "$1" != demo ; then
-        if docker ps -a --filter "status=exited" |grep -E "$ARVBOX_CONTAINER$" -q ; then
-            docker rm --volumes=true $ARVBOX_CONTAINER
-        fi
+    if docker ps -a --filter "status=exited" | grep -E "$ARVBOX_CONTAINER$" -q ; then
+        docker rm --volumes=true $ARVBOX_CONTAINER
     fi
 }
 
 build() {
-    docker build -t arvados/arvbox-base -f $ARVBOX_DOCKER/Dockerfile.base $ARVBOX_DOCKER
-    if test "$1" = demo ; then
-        docker build -t arvados/arvbox-demo -f $ARVBOX_DOCKER/Dockerfile.demo $ARVBOX_DOCKER
-    else
-        docker build -t arvados/arvbox-dev -f $ARVBOX_DOCKER/Dockerfile.dev $ARVBOX_DOCKER
+    if ! test -f "$ARVBOX_DOCKER/Dockerfile.base" ;  then
+        echo "Could not find Dockerfile ($ARVBOX_DOCKER/Dockerfile.base)"
+        exit 1
+    fi
+    docker build -t arvados/arvbox-base -f "$ARVBOX_DOCKER/Dockerfile.base" "$ARVBOX_DOCKER"
+    docker build -t arvados/arvbox-dev -f "$ARVBOX_DOCKER/Dockerfile.dev" "$ARVBOX_DOCKER"
+    if test "$1" = demo -o "$1" = test ; then
+        docker build -t arvados/arvbox-$1 -f "$ARVBOX_DOCKER/Dockerfile.$1" "$ARVBOX_DOCKER"
     fi
 }
 
-case $1 in
+check() {
+    if test -z "$1" ; then
+        echo "Argument to $subcmd must be one of dev, test, demo"
+        exit 1
+    fi
+}
+
+subcmd="$1"
+shift
+case "$subcmd" in
     build)
-        build $2
+        check $@
+        build $@
         ;;
 
     start|run)
-        run $2
+        check $@
+        run $@
         ;;
 
     sh*)
@@ -138,111 +190,81 @@ case $1 in
         ;;
 
     stop)
-        stop $2
+        stop
         ;;
 
     restart)
-        stop
-        run
+        check $@
+        stop $@
+        run $@
         ;;
 
     reboot)
+        check $@
         stop
-        build
-        run
+        build $@
+        run $@
         ;;
 
     ip|open)
         IP=$(docker inspect $ARVBOX_CONTAINER | grep \"IPAddress\" | head -n1 | tr -d ' ":,\n' | cut -c10-)
-        if test $1 = 'ip' ; then
+        if test "$subcmd" = 'ip' ; then
             echo $IP
         else
             xdg-open http://$IP
         fi
         ;;
 
-    reset)
-        if test "$2" != -f ; then
-            echo "WARNING!  This will delete your database, git and keep files inside your arvbox ($ARVBOX_DATA).  Use reset -f if you really mean it."
-            exit 1
-        fi
+    reset|destroy)
         stop
-        rm -rf $ARVBOX_DATA/postgres
-        rm -rf $ARVBOX_DATA/var
-        ;;
-
-    destroy)
-        if test "$2" != -f ; then
-            echo "WARNING!  This will delete all code and data inside your arvbox ($ARVBOX_DATA).  Use destroy -f if you really mean it."
-            exit 1
+        if test -d "$ARVBOX_DATA" ; then
+            if test "$subcmd" = destroy ; then
+                if test "$1" != -f ; then
+                    echo "WARNING!  This will delete your entire arvbox ($ARVBOX_DATA)."
+                    echo "Use destroy -f if you really mean it."
+                    exit 1
+                fi
+                rm -rf "$ARVBOX_DATA"
+            else
+                if test "$1" != -f ; then
+                    echo "WARNING!  This will delete your arvbox data ($ARVBOX_DATA)."
+                    echo "Code and downloaded packages will be preserved."
+                    echo "Use reset -f if you really mean it."
+                    exit 1
+                fi
+                rm -rf "$ARVBOX_DATA/postgres"
+                rm -rf "$ARVBOX_DATA/var"
+            fi
+        else
+            if test "$1" != -f ; then
+                echo "WARNING!  This will delete your data container $ARVBOX_CONTAINER-data.  Use -f if you really mean it."
+                exit 1
+            fi
+            docker rm "$ARVBOX_CONTAINER-data"
         fi
-        stop
-        rm -rf $ARVBOX_DATA
         ;;
 
     log|svrestart)
-        if test -n "$2" ; then
-            if test "$1" = log ; then
-                docker exec -ti $ARVBOX_CONTAINER tail -n100 /etc/service/$2/log/main/current
+        if test -n "$1" ; then
+            if test "$subcmd" = log ; then
+                docker exec -ti $ARVBOX_CONTAINER tail -n100 /etc/service/$1/log/main/current
             fi
-            if test "$1" = svrestart ; then
-                docker exec -ti $ARVBOX_CONTAINER sv restart $2
+            if test "$subcmd" = svrestart ; then
+                docker exec -ti $ARVBOX_CONTAINER sv restart $1
                 docker exec -ti $ARVBOX_CONTAINER sv restart ready
             fi
         else
-            echo "Usage: $0 $1 <service>"
+            echo "Usage: $0 $subcmd <service>"
             echo "Available services:"
             docker exec -ti $ARVBOX_CONTAINER ls /etc/service
         fi
         ;;
 
-    run-tests)
-        stop
-
-        if ! test -d $ARVADOS_DEV_ROOT ; then
-            git clone https://github.com/curoverse/arvados-dev.git $ARVADOS_DEV_ROOT
-        fi
-
-        run testing
-
-        shift
-
-        while ! docker exec -ti \
-                $ARVBOX_CONTAINER \
-                /etc/tests-service/runsu.sh \
-                psql -c'\du' ; do
-            sleep 1
-        done
-
-        docker exec -ti \
-               $ARVBOX_CONTAINER \
-               /etc/tests-service/runsu.sh \
-               /etc/service/sso/run-service --only-setup
-
-        docker exec -ti \
-               $ARVBOX_CONTAINER \
-               /etc/tests-service/runsu.sh \
-               /etc/service/api/run-service --only-setup
-
-        docker exec -ti \
-               $ARVBOX_CONTAINER \
-               /etc/tests-service/runsu.sh \
-               /usr/src/arvados-dev/jenkins/run-tests.sh \
-               --leave-temp \
-               WORKSPACE=/usr/src/arvados \
-               VENVDIR=/var/lib/arvados/tests-venv \
-               VENV3DIR=/var/lib/arvados/tests-venv3 \
-               GOPATH=/var/lib/arvados/tests-gostuff \
-               GEMHOME=/var/lib/gems/ruby/2.1.0 \
-               GEM_HOME=/var/lib/gems/ruby/2.1.0 \
-               "$@"
-        ;;
-
     clone)
-        if test -n "$3" ; then
-            cp -r $HOME/.arvbox/$2 $HOME/.arvbox/$3
-            echo "Created new arvbox $3"
-            echo "export ARVBOX_CONTAINER=$3"
+        if test -n "$2" ; then
+            cp -r $HOME/.arvbox/$1 $HOME/.arvbox/$2
+            echo "Created new arvbox $2"
+            echo "export ARVBOX_CONTAINER=$2"
         else
             echo "clone <from> <to>   clone an arvbox"
         fi
diff --git a/arvbox/lib/arvbox/docker/Dockerfile.base b/arvbox/lib/arvbox/docker/Dockerfile.base
index 274dceb..e73ba92 100644
--- a/arvbox/lib/arvbox/docker/Dockerfile.base
+++ b/arvbox/lib/arvbox/docker/Dockerfile.base
@@ -14,13 +14,15 @@ RUN apt-get update && \
 RUN curl -sSL https://get.docker.com/ | sh
 VOLUME /var/lib/docker
 
-ADD runit-docker /root/runit-docker
-
-RUN cd /root/runit-docker && \
-    make && \
-    make install
+RUN cd /root && \
+    GOPATH=$PWD go get github.com/curoverse/runsvinit && \
+    install bin/runsvinit /usr/local/bin
 
 ADD fuse.conf /etc/
 
+ADD crunch-setup.sh gitolite.rc \
+    keep-setup.sh common.sh createusers.sh logger runsu.sh \
+    /usr/local/lib/arvbox/
+
 # Start the supervisor.
-CMD LD_PRELOAD=/lib/runit-docker.so exec runsvdir /etc/service
+CMD ["/usr/local/bin/runsvinit"]
diff --git a/arvbox/lib/arvbox/docker/Dockerfile.demo b/arvbox/lib/arvbox/docker/Dockerfile.demo
index 46ab21e..8a255f8 100644
--- a/arvbox/lib/arvbox/docker/Dockerfile.demo
+++ b/arvbox/lib/arvbox/docker/Dockerfile.demo
@@ -1,12 +1,9 @@
-FROM arvados/arvbox-base
+FROM arvados/arvbox-dev
 
 RUN cd /usr/src && \
     git clone https://github.com/curoverse/arvados.git && \
     git clone https://github.com/curoverse/sso-devise-omniauth-provider.git sso
 
-ADD crunch-setup.sh gitolite-setup.sh gitolite.rc gitssh-setup.sh keep-setup.sh common.sh createusers.sh /usr/local/lib/arvbox/
-ADD service /etc/service
-
 RUN chown -R 1000:1000 /usr/src && /usr/local/lib/arvbox/createusers.sh
 
 RUN sudo -u arvbox /etc/service/sso/run-service --only-deps
diff --git a/arvbox/lib/arvbox/docker/Dockerfile.dev b/arvbox/lib/arvbox/docker/Dockerfile.dev
index cb2873b..fc81bb6 100644
--- a/arvbox/lib/arvbox/docker/Dockerfile.dev
+++ b/arvbox/lib/arvbox/docker/Dockerfile.dev
@@ -1,15 +1,3 @@
 FROM arvados/arvbox-base
 
-RUN apt-get update && \
-    DEBIAN_FRONTEND=noninteractive apt-get -yq install \
-    python-virtualenv python3-virtualenv linkchecker xvfb iceweasel
-
-RUN set -e && \
- PJS=phantomjs-1.9.7-linux-x86_64 && \
- curl -L -o/tmp/$PJS.tar.bz2 https://bitbucket.org/ariya/phantomjs/downloads/$PJS.tar.bz2 && \
- tar -C /usr/local -xjf /tmp/$PJS.tar.bz2 && \
- ln -s ../$PJS/bin/phantomjs /usr/local/bin/
-
-ADD crunch-setup.sh gitolite-setup.sh gitolite.rc gitssh-setup.sh keep-setup.sh common.sh createusers.sh /usr/local/lib/arvbox/
 ADD service /etc/service
-ADD tests-service /etc/tests-service
diff --git a/arvbox/lib/arvbox/docker/Dockerfile.dev b/arvbox/lib/arvbox/docker/Dockerfile.test
similarity index 68%
copy from arvbox/lib/arvbox/docker/Dockerfile.dev
copy to arvbox/lib/arvbox/docker/Dockerfile.test
index cb2873b..c84dfb5 100644
--- a/arvbox/lib/arvbox/docker/Dockerfile.dev
+++ b/arvbox/lib/arvbox/docker/Dockerfile.test
@@ -10,6 +10,4 @@ RUN set -e && \
  tar -C /usr/local -xjf /tmp/$PJS.tar.bz2 && \
  ln -s ../$PJS/bin/phantomjs /usr/local/bin/
 
-ADD crunch-setup.sh gitolite-setup.sh gitolite.rc gitssh-setup.sh keep-setup.sh common.sh createusers.sh /usr/local/lib/arvbox/
-ADD service /etc/service
-ADD tests-service /etc/tests-service
+ADD service/postgres /etc/service/
diff --git a/arvbox/lib/arvbox/docker/common.sh b/arvbox/lib/arvbox/docker/common.sh
index d58c39b..d508c5c 100644
--- a/arvbox/lib/arvbox/docker/common.sh
+++ b/arvbox/lib/arvbox/docker/common.sh
@@ -1,7 +1,22 @@
+
 localip=$(ip addr show eth0 |grep "inet " | sed 's/ *inet \([^/]*\).*/\1/')
 export GEM_HOME=/var/lib/gems
 export GEM_PATH=/var/lib/gems
 
+declare -A services
+services=(
+  [workbench]=80
+  [api]=8000
+  [sso]=8900
+  [arv-git-httpd]=9001
+  [keep-web]=9002
+  [keepproxy]=25100
+  [keepstore0]=25107
+  [keepstore1]=25108
+  [ssh]=22
+  [doc]=8001
+)
+
 if test $(id arvbox -u) = 0 ; then
     PGUSER=postgres
     PGGROUP=postgres
diff --git a/arvbox/lib/arvbox/docker/createusers.sh b/arvbox/lib/arvbox/docker/createusers.sh
index 680d9fe..a90992a 100755
--- a/arvbox/lib/arvbox/docker/createusers.sh
+++ b/arvbox/lib/arvbox/docker/createusers.sh
@@ -1,6 +1,6 @@
-#!/bin/sh
+#!/bin/bash
 
-set -e
+set -e -o pipefail
 
 if ! grep "^arvbox:" /etc/passwd >/dev/null 2>/dev/null ; then
     HOSTUID=$(ls -nd /usr/src/arvados | sed 's/ */ /' | cut -d' ' -f4)
diff --git a/arvbox/lib/arvbox/docker/crunch-setup.sh b/arvbox/lib/arvbox/docker/crunch-setup.sh
index b6f5cda..178fec1 100755
--- a/arvbox/lib/arvbox/docker/crunch-setup.sh
+++ b/arvbox/lib/arvbox/docker/crunch-setup.sh
@@ -1,7 +1,7 @@
-#!/bin/sh
+#!/bin/bash
 
 exec 2>&1
-set -eux
+set -eux -o pipefail
 
 . /usr/local/lib/arvbox/common.sh
 
@@ -11,10 +11,10 @@ cd /var/lib/arvados/gostuff
 export GOPATH=$PWD
 mkdir -p "$GOPATH/src/git.curoverse.com"
 ln -sfn "/usr/src/arvados" "$GOPATH/src/git.curoverse.com/arvados.git"
-go get -t "git.curoverse.com/arvados.git/services/crunchstat"
+flock /var/lib/arvados/gostuff.lock go get -t "git.curoverse.com/arvados.git/services/crunchstat"
 install bin/crunchstat /usr/local/bin
 
-export ARVADOS_API_HOST=$localip:3001
+export ARVADOS_API_HOST=$localip:${services[api]}
 export ARVADOS_API_HOST_INSECURE=1
 export ARVADOS_API_TOKEN=$(cat /usr/src/arvados/services/api/superuser_token)
 export CRUNCH_JOB_BIN=/usr/src/arvados/sdk/cli/bin/crunch-job
diff --git a/arvbox/lib/arvbox/docker/gitolite-setup.sh b/arvbox/lib/arvbox/docker/gitolite-setup.sh
deleted file mode 100755
index 9a2ff9e..0000000
--- a/arvbox/lib/arvbox/docker/gitolite-setup.sh
+++ /dev/null
@@ -1,19 +0,0 @@
-#!/bin/sh
-
-set -e
-
-cd ~
-
-gitolite setup -pk .ssh/id_rsa.pub
-
-if ! test -d gitolite-admin ; then
-    git clone git at localhost:gitolite-admin
-fi
-
-cd gitolite-admin
-git config user.email arvados
-git config user.name arvados
-git config push.default simple
-git push
-
-cp ~git/gitolite.rc ~git/.gitolite.rc
diff --git a/arvbox/lib/arvbox/docker/gitssh-setup.sh b/arvbox/lib/arvbox/docker/gitssh-setup.sh
deleted file mode 100755
index aad7dd4..0000000
--- a/arvbox/lib/arvbox/docker/gitssh-setup.sh
+++ /dev/null
@@ -1,24 +0,0 @@
-#!/bin/sh
-
-exec 2>&1
-set -eux
-
-cd ~
-
-if ! test -s .ssh/id_rsa ; then
-    mkdir -p .ssh
-    chmod -R 0700 .ssh
-    ssh-keygen -t rsa -P '' -f .ssh/id_rsa
-fi
-
-if test -s /var/lib/arvados/git/.ssh/known_hosts ; then
-    ssh-keygen -f "/var/lib/arvados/git/.ssh/known_hosts" -R localhost
-fi
-
-if ! test -s .ssh/authorized_keys ; then
-    cp .ssh/id_rsa.pub .ssh/authorized_keys
-    ssh -o stricthostkeychecking=no localhost
-    rm .ssh/authorized_keys
-else
-    ssh -o stricthostkeychecking=no localhost
-fi
diff --git a/arvbox/lib/arvbox/docker/keep-setup.sh b/arvbox/lib/arvbox/docker/keep-setup.sh
index 529360e..b66463f 100755
--- a/arvbox/lib/arvbox/docker/keep-setup.sh
+++ b/arvbox/lib/arvbox/docker/keep-setup.sh
@@ -2,7 +2,7 @@
 
 exec 2>&1
 sleep 2
-set -eux
+set -eux -o pipefail
 
 . /usr/local/lib/arvbox/common.sh
 
@@ -12,29 +12,17 @@ cd /var/lib/arvados/gostuff
 export GOPATH=$PWD
 mkdir -p "$GOPATH/src/git.curoverse.com"
 ln -sfn "/usr/src/arvados" "$GOPATH/src/git.curoverse.com/arvados.git"
-go get -t "git.curoverse.com/arvados.git/services/keepstore"
+flock /var/lib/arvados/gostuff.lock go get -t "git.curoverse.com/arvados.git/services/keepstore"
 install bin/keepstore /usr/local/bin
 
-mkdir -p /var/lib/arvados/keep
+mkdir -p /var/lib/arvados/$1
 
-export ARVADOS_API_HOST=$localip:3001
+export ARVADOS_API_HOST=$localip:${services[api]}
 export ARVADOS_API_HOST_INSECURE=1
 export ARVADOS_API_TOKEN=$(cat /var/lib/arvados/superuser_token)
 
-if test -s /var/lib/arvados/$1-uuid ; then
-    keep_uuid=$(cat /var/lib/arvados/$1-uuid)
-    set +e
-    read -rd $'\000' keepservice <<EOF
-{
- "service_host":"$localip",
- "service_port":$2
-}
-EOF
-    set -e
-    arv keep_service update --uuid $keep_uuid --keep-service "$keepservice"
-else
-    set +e
-    read -rd $'\000' keepservice <<EOF
+set +e
+read -rd $'\000' keepservice <<EOF
 {
  "service_host":"$localip",
  "service_port":$2,
@@ -42,14 +30,22 @@ else
  "service_type":"disk"
 }
 EOF
-    set -e
+set -e
+
+if test -s /var/lib/arvados/$1-uuid ; then
+    keep_uuid=$(cat /var/lib/arvados/$1-uuid)
+    arv keep_service update --uuid $keep_uuid --keep-service "$keepservice"
+else
     UUID=$(arv --format=uuid keep_service create --keep-service "$keepservice")
     echo $UUID > /var/lib/arvados/$1-uuid
 fi
 
+set +e
+killall -HUP keepproxy
+
 exec /usr/local/bin/keepstore \
      -listen=:$2 \
      -enforce-permissions=true \
      -blob-signing-key-file=/var/lib/arvados/blob_signing_key \
      -max-buffers=20 \
-     -volume=/var/lib/arvados/keep
+     -volume=/var/lib/arvados/$1
diff --git a/arvbox/lib/arvbox/docker/service/logger b/arvbox/lib/arvbox/docker/logger
similarity index 100%
rename from arvbox/lib/arvbox/docker/service/logger
rename to arvbox/lib/arvbox/docker/logger
diff --git a/arvbox/lib/arvbox/docker/service/runsu.sh b/arvbox/lib/arvbox/docker/runsu.sh
similarity index 75%
rename from arvbox/lib/arvbox/docker/service/runsu.sh
rename to arvbox/lib/arvbox/docker/runsu.sh
index d702709..1557d09 100755
--- a/arvbox/lib/arvbox/docker/service/runsu.sh
+++ b/arvbox/lib/arvbox/docker/runsu.sh
@@ -8,7 +8,7 @@ flock /var/lib/arvados/createusers.lock /usr/local/lib/arvbox/createusers.sh
 export HOME=/var/lib/arvados
 
 if test -z "$1" ; then
-    exec chpst -u arvbox:arvbox $0-service
+    exec chpst -u arvbox:arvbox:docker $0-service
 else
-    exec chpst -u arvbox:arvbox $@
+    exec chpst -u arvbox:arvbox:docker $@
 fi
diff --git a/arvbox/lib/arvbox/docker/service/api/log/run b/arvbox/lib/arvbox/docker/service/api/log/run
index f99cc1d..d6aef4a 120000
--- a/arvbox/lib/arvbox/docker/service/api/log/run
+++ b/arvbox/lib/arvbox/docker/service/api/log/run
@@ -1 +1 @@
-../../logger
\ No newline at end of file
+/usr/local/lib/arvbox/logger
\ No newline at end of file
diff --git a/arvbox/lib/arvbox/docker/service/api/run b/arvbox/lib/arvbox/docker/service/api/run
index ef446b5..a388c8b 120000
--- a/arvbox/lib/arvbox/docker/service/api/run
+++ b/arvbox/lib/arvbox/docker/service/api/run
@@ -1 +1 @@
-../runsu.sh
\ No newline at end of file
+/usr/local/lib/arvbox/runsu.sh
\ No newline at end of file
diff --git a/arvbox/lib/arvbox/docker/service/api/run-service b/arvbox/lib/arvbox/docker/service/api/run-service
index 6615736..ceccb72 100755
--- a/arvbox/lib/arvbox/docker/service/api/run-service
+++ b/arvbox/lib/arvbox/docker/service/api/run-service
@@ -1,7 +1,7 @@
-#!/bin/sh
+#!/bin/bash
 
 exec 2>&1
-set -ex
+set -ex -o pipefail
 
 . /usr/local/lib/arvbox/common.sh
 
@@ -42,7 +42,7 @@ common:
   secret_token: $secret_token
   sso_app_secret: $sso_app_secret
   sso_app_id: arvados-server
-  sso_provider_url: "https://$localip:3002"
+  sso_provider_url: "https://$localip:${services[sso]}"
   workbench_address: "http://$localip/"
   sso_insecure: true
 development:
@@ -50,7 +50,7 @@ development:
   auto_admin_first_user: true
   blob_signing_key: $blob_signing_key
   git_repo_ssh_base: "git@$localip:"
-  git_repo_https_base: "http://$localip:9001/"
+  git_repo_https_base: "http://$localip:${services[arv-git-httpd]}/"
 test:
   uuid_prefix: zzzzz
   git_repo_ssh_base: "git at git.zzzzz.arvadosapi.com:"
@@ -104,7 +104,7 @@ if test "$1" = "--only-setup" ; then
     exit
 fi
 
-ARVADOS_WEBSOCKETS=1 exec bundle exec passenger start --port=3001 \
+ARVADOS_WEBSOCKETS=1 exec bundle exec passenger start --port=${services[api]} \
                   --runtime-dir=/var/lib/passenger \
                   --ssl --ssl-certificate=/var/lib/arvados/self-signed.pem \
                   --ssl-certificate-key=/var/lib/arvados/self-signed.key
diff --git a/arvbox/lib/arvbox/docker/service/keepweb/log/main/.gitstub b/arvbox/lib/arvbox/docker/service/arv-git-httpd/log/main/.gitstub
similarity index 100%
rename from arvbox/lib/arvbox/docker/service/keepweb/log/main/.gitstub
rename to arvbox/lib/arvbox/docker/service/arv-git-httpd/log/main/.gitstub
diff --git a/arvbox/lib/arvbox/docker/service/arv-git-httpd/log/run b/arvbox/lib/arvbox/docker/service/arv-git-httpd/log/run
new file mode 120000
index 0000000..d6aef4a
--- /dev/null
+++ b/arvbox/lib/arvbox/docker/service/arv-git-httpd/log/run
@@ -0,0 +1 @@
+/usr/local/lib/arvbox/logger
\ No newline at end of file
diff --git a/arvbox/lib/arvbox/docker/service/arv-git-httpd/run b/arvbox/lib/arvbox/docker/service/arv-git-httpd/run
new file mode 120000
index 0000000..a388c8b
--- /dev/null
+++ b/arvbox/lib/arvbox/docker/service/arv-git-httpd/run
@@ -0,0 +1 @@
+/usr/local/lib/arvbox/runsu.sh
\ No newline at end of file
diff --git a/arvbox/lib/arvbox/docker/service/githttp/run-service b/arvbox/lib/arvbox/docker/service/arv-git-httpd/run-service
similarity index 54%
rename from arvbox/lib/arvbox/docker/service/githttp/run-service
rename to arvbox/lib/arvbox/docker/service/arv-git-httpd/run-service
index 7e4f1de..7bd6a7c 100755
--- a/arvbox/lib/arvbox/docker/service/githttp/run-service
+++ b/arvbox/lib/arvbox/docker/service/arv-git-httpd/run-service
@@ -1,7 +1,7 @@
-#!/bin/sh
+#!/bin/bash
 
 exec 2>&1
-set -eux
+set -eux -o pipefail
 
 . /usr/local/lib/arvbox/common.sh
 
@@ -11,13 +11,17 @@ cd /var/lib/arvados/gostuff
 export GOPATH=$PWD
 mkdir -p "$GOPATH/src/git.curoverse.com"
 ln -sfn "/usr/src/arvados" "$GOPATH/src/git.curoverse.com/arvados.git"
-go get -t "git.curoverse.com/arvados.git/services/arv-git-httpd"
+flock /var/lib/arvados/gostuff.lock go get -t "git.curoverse.com/arvados.git/services/arv-git-httpd"
 install bin/arv-git-httpd /usr/local/bin
 
-export ARVADOS_API_HOST=$localip:3001
+export ARVADOS_API_HOST=$localip:${services[api]}
 export ARVADOS_API_HOST_INSECURE=1
 export GITOLITE_HTTP_HOME=/var/lib/arvados/git
 export GL_BYPASS_ACCESS_CHECKS=1
 export PATH="$PATH:/var/lib/arvados/git/bin"
 cd ~git
-/usr/local/bin/arv-git-httpd -address=:9001 -git-command=/var/lib/arvados/git/gitolite/src/gitolite-shell -repo-root=/var/lib/arvados/git/repositories 2>&1
+
+exec /usr/local/bin/arv-git-httpd \
+     -address=:${services[arv-git-httpd]} \
+     -git-command=/var/lib/arvados/git/gitolite/src/gitolite-shell \
+     -repo-root=/var/lib/arvados/git/repositories
diff --git a/arvbox/lib/arvbox/docker/service/keep1/log/main/.gitstub b/arvbox/lib/arvbox/docker/service/crunch-dispatch0/log/main/.gitstub
similarity index 100%
rename from arvbox/lib/arvbox/docker/service/keep1/log/main/.gitstub
rename to arvbox/lib/arvbox/docker/service/crunch-dispatch0/log/main/.gitstub
diff --git a/arvbox/lib/arvbox/docker/service/crunch-dispatch0/log/run b/arvbox/lib/arvbox/docker/service/crunch-dispatch0/log/run
new file mode 120000
index 0000000..d6aef4a
--- /dev/null
+++ b/arvbox/lib/arvbox/docker/service/crunch-dispatch0/log/run
@@ -0,0 +1 @@
+/usr/local/lib/arvbox/logger
\ No newline at end of file
diff --git a/arvbox/lib/arvbox/docker/service/crunch-dispatch0/run b/arvbox/lib/arvbox/docker/service/crunch-dispatch0/run
new file mode 120000
index 0000000..a388c8b
--- /dev/null
+++ b/arvbox/lib/arvbox/docker/service/crunch-dispatch0/run
@@ -0,0 +1 @@
+/usr/local/lib/arvbox/runsu.sh
\ No newline at end of file
diff --git a/arvbox/lib/arvbox/docker/service/crunch0/run-service b/arvbox/lib/arvbox/docker/service/crunch-dispatch0/run-service
similarity index 100%
rename from arvbox/lib/arvbox/docker/service/crunch0/run-service
rename to arvbox/lib/arvbox/docker/service/crunch-dispatch0/run-service
diff --git a/arvbox/lib/arvbox/docker/service/keep0/log/main/.gitstub b/arvbox/lib/arvbox/docker/service/crunch-dispatch1/log/main/.gitstub
similarity index 100%
rename from arvbox/lib/arvbox/docker/service/keep0/log/main/.gitstub
rename to arvbox/lib/arvbox/docker/service/crunch-dispatch1/log/main/.gitstub
diff --git a/arvbox/lib/arvbox/docker/service/crunch-dispatch1/log/run b/arvbox/lib/arvbox/docker/service/crunch-dispatch1/log/run
new file mode 120000
index 0000000..d6aef4a
--- /dev/null
+++ b/arvbox/lib/arvbox/docker/service/crunch-dispatch1/log/run
@@ -0,0 +1 @@
+/usr/local/lib/arvbox/logger
\ No newline at end of file
diff --git a/arvbox/lib/arvbox/docker/service/crunch-dispatch1/run b/arvbox/lib/arvbox/docker/service/crunch-dispatch1/run
new file mode 120000
index 0000000..a388c8b
--- /dev/null
+++ b/arvbox/lib/arvbox/docker/service/crunch-dispatch1/run
@@ -0,0 +1 @@
+/usr/local/lib/arvbox/runsu.sh
\ No newline at end of file
diff --git a/arvbox/lib/arvbox/docker/service/crunch1/run-service b/arvbox/lib/arvbox/docker/service/crunch-dispatch1/run-service
similarity index 100%
rename from arvbox/lib/arvbox/docker/service/crunch1/run-service
rename to arvbox/lib/arvbox/docker/service/crunch-dispatch1/run-service
diff --git a/arvbox/lib/arvbox/docker/service/crunch0/log/run b/arvbox/lib/arvbox/docker/service/crunch0/log/run
deleted file mode 120000
index f99cc1d..0000000
--- a/arvbox/lib/arvbox/docker/service/crunch0/log/run
+++ /dev/null
@@ -1 +0,0 @@
-../../logger
\ No newline at end of file
diff --git a/arvbox/lib/arvbox/docker/service/crunch0/run b/arvbox/lib/arvbox/docker/service/crunch0/run
deleted file mode 120000
index ef446b5..0000000
--- a/arvbox/lib/arvbox/docker/service/crunch0/run
+++ /dev/null
@@ -1 +0,0 @@
-../runsu.sh
\ No newline at end of file
diff --git a/arvbox/lib/arvbox/docker/service/crunch1/log/run b/arvbox/lib/arvbox/docker/service/crunch1/log/run
deleted file mode 120000
index f99cc1d..0000000
--- a/arvbox/lib/arvbox/docker/service/crunch1/log/run
+++ /dev/null
@@ -1 +0,0 @@
-../../logger
\ No newline at end of file
diff --git a/arvbox/lib/arvbox/docker/service/crunch1/run b/arvbox/lib/arvbox/docker/service/crunch1/run
deleted file mode 120000
index ef446b5..0000000
--- a/arvbox/lib/arvbox/docker/service/crunch1/run
+++ /dev/null
@@ -1 +0,0 @@
-../runsu.sh
\ No newline at end of file
diff --git a/arvbox/lib/arvbox/docker/service/doc/log/run b/arvbox/lib/arvbox/docker/service/doc/log/run
index f99cc1d..d6aef4a 120000
--- a/arvbox/lib/arvbox/docker/service/doc/log/run
+++ b/arvbox/lib/arvbox/docker/service/doc/log/run
@@ -1 +1 @@
-../../logger
\ No newline at end of file
+/usr/local/lib/arvbox/logger
\ No newline at end of file
diff --git a/arvbox/lib/arvbox/docker/service/doc/run b/arvbox/lib/arvbox/docker/service/doc/run
index ef446b5..a388c8b 120000
--- a/arvbox/lib/arvbox/docker/service/doc/run
+++ b/arvbox/lib/arvbox/docker/service/doc/run
@@ -1 +1 @@
-../runsu.sh
\ No newline at end of file
+/usr/local/lib/arvbox/runsu.sh
\ No newline at end of file
diff --git a/arvbox/lib/arvbox/docker/service/doc/run-service b/arvbox/lib/arvbox/docker/service/doc/run-service
index a64d5c8..acbe21c 100755
--- a/arvbox/lib/arvbox/docker/service/doc/run-service
+++ b/arvbox/lib/arvbox/docker/service/doc/run-service
@@ -1,7 +1,7 @@
-#!/bin/sh
+#!/bin/bash
 
 exec 2>&1
-set -ex
+set -ex -o pipefail
 
 . /usr/local/lib/arvbox/common.sh
 
@@ -14,6 +14,28 @@ fi
 
 set -u
 
-bundle exec rake generate baseurl=http://$localip:8000 arvados_api_host=$localip:3001 arvados_workbench_host=http://$localip
+cat <<EOF >/var/lib/arvados/doc-nginx.conf
+worker_processes auto;
+pid /var/lib/arvados/doc-nginx.pid;
+daemon off;
 
-exec bundle exec rake run
+events {
+	worker_connections 64;
+}
+
+http {
+     include /etc/nginx/mime.types;
+     default_type application/octet-stream;
+     server {
+            listen ${services[doc]} default_server;
+            listen [::]:${services[doc]} default_server;
+            root /usr/src/arvados/doc/.site;
+            index index.html;
+            server_name _;
+     }
+}
+EOF
+
+bundle exec rake generate baseurl=http://$localip:${services[doc]} arvados_api_host=$localip:${services[api]} arvados_workbench_host=http://$localip
+
+exec nginx -c /var/lib/arvados/doc-nginx.conf
diff --git a/arvbox/lib/arvbox/docker/service/docker/log/run b/arvbox/lib/arvbox/docker/service/docker/log/run
index f99cc1d..d6aef4a 120000
--- a/arvbox/lib/arvbox/docker/service/docker/log/run
+++ b/arvbox/lib/arvbox/docker/service/docker/log/run
@@ -1 +1 @@
-../../logger
\ No newline at end of file
+/usr/local/lib/arvbox/logger
\ No newline at end of file
diff --git a/arvbox/lib/arvbox/docker/service/git/log/run b/arvbox/lib/arvbox/docker/service/git/log/run
deleted file mode 120000
index f99cc1d..0000000
--- a/arvbox/lib/arvbox/docker/service/git/log/run
+++ /dev/null
@@ -1 +0,0 @@
-../../logger
\ No newline at end of file
diff --git a/arvbox/lib/arvbox/docker/service/git/run b/arvbox/lib/arvbox/docker/service/git/run
deleted file mode 120000
index ef446b5..0000000
--- a/arvbox/lib/arvbox/docker/service/git/run
+++ /dev/null
@@ -1 +0,0 @@
-../runsu.sh
\ No newline at end of file
diff --git a/arvbox/lib/arvbox/docker/service/githttp/log/run b/arvbox/lib/arvbox/docker/service/githttp/log/run
deleted file mode 120000
index f99cc1d..0000000
--- a/arvbox/lib/arvbox/docker/service/githttp/log/run
+++ /dev/null
@@ -1 +0,0 @@
-../../logger
\ No newline at end of file
diff --git a/arvbox/lib/arvbox/docker/service/githttp/run b/arvbox/lib/arvbox/docker/service/githttp/run
deleted file mode 120000
index ef446b5..0000000
--- a/arvbox/lib/arvbox/docker/service/githttp/run
+++ /dev/null
@@ -1 +0,0 @@
-../runsu.sh
\ No newline at end of file
diff --git a/arvbox/lib/arvbox/docker/service/githttp/log/main/.gitstub b/arvbox/lib/arvbox/docker/service/gitolite/log/main/.gitstub
similarity index 100%
rename from arvbox/lib/arvbox/docker/service/githttp/log/main/.gitstub
rename to arvbox/lib/arvbox/docker/service/gitolite/log/main/.gitstub
diff --git a/arvbox/lib/arvbox/docker/service/gitolite/log/run b/arvbox/lib/arvbox/docker/service/gitolite/log/run
new file mode 120000
index 0000000..d6aef4a
--- /dev/null
+++ b/arvbox/lib/arvbox/docker/service/gitolite/log/run
@@ -0,0 +1 @@
+/usr/local/lib/arvbox/logger
\ No newline at end of file
diff --git a/arvbox/lib/arvbox/docker/service/gitolite/run b/arvbox/lib/arvbox/docker/service/gitolite/run
new file mode 120000
index 0000000..a388c8b
--- /dev/null
+++ b/arvbox/lib/arvbox/docker/service/gitolite/run
@@ -0,0 +1 @@
+/usr/local/lib/arvbox/runsu.sh
\ No newline at end of file
diff --git a/arvbox/lib/arvbox/docker/service/git/run-service b/arvbox/lib/arvbox/docker/service/gitolite/run-service
similarity index 62%
rename from arvbox/lib/arvbox/docker/service/git/run-service
rename to arvbox/lib/arvbox/docker/service/gitolite/run-service
index 4f08040..2e5f1e9 100755
--- a/arvbox/lib/arvbox/docker/service/git/run-service
+++ b/arvbox/lib/arvbox/docker/service/gitolite/run-service
@@ -1,28 +1,59 @@
 #!/bin/bash
 
 exec 2>&1
-set -eux
+set -eux -o pipefail
 
 . /usr/local/lib/arvbox/common.sh
 
 mkdir -p /var/lib/arvados/git
 
-export ARVADOS_API_HOST=$localip:3001
+export ARVADOS_API_HOST=$localip:${services[api]}
 export ARVADOS_API_HOST_INSECURE=1
 export ARVADOS_API_TOKEN=$(cat /var/lib/arvados/superuser_token)
 
+export USER=git
+export USERNAME=git
+export LOGNAME=git
+export HOME=/var/lib/arvados/git
+
+cd ~arvbox
+
+mkdir -p ~arvbox/.ssh ~git/.ssh
+chmod 0700 ~arvbox/.ssh ~git/.ssh
+
+if ! test -s ~arvbox/.ssh/id_rsa ; then
+    ssh-keygen -t rsa -P '' -f .ssh/id_rsa
+    cp ~arvbox/.ssh/id_rsa ~arvbox/.ssh/id_rsa.pub ~git/.ssh
+fi
+
+if test -s ~arvbox/.ssh/known_hosts ; then
+    ssh-keygen -f ".ssh/known_hosts" -R localhost
+fi
+
 if ! test -f /var/lib/arvados/gitolite-setup ; then
-   cp -r /usr/local/lib/arvbox/gitolite-setup.sh /usr/local/lib/arvbox/gitssh-setup.sh /usr/local/lib/arvbox/gitolite.rc /var/lib/arvados/git/
+    cd ~git
+
+    cp .ssh/id_rsa.pub .ssh/authorized_keys
+    ssh -o stricthostkeychecking=no git at localhost
+    rm .ssh/authorized_keys
+
+    cp -r /usr/local/lib/arvbox/gitolite.rc .
+
+    gitolite setup -pk .ssh/id_rsa.pub
 
-   chown -R git:git ~git
+    if ! test -d gitolite-admin ; then
+        git clone git at localhost:gitolite-admin
+    fi
 
-   su git -c "/var/lib/arvados/git/gitssh-setup.sh"
-   su git -c "/var/lib/arvados/git/gitolite-setup.sh"
+    cd gitolite-admin
+    git config user.email arvados
+    git config user.name arvados
+    git config push.default simple
+    git push
 
-   touch /var/lib/arvados/gitolite-setup
+    touch /var/lib/arvados/gitolite-setup
 else
-    chown -R git:git ~git
-    su git -c "/var/lib/arvados/git/gitssh-setup.sh"
+    ssh -o stricthostkeychecking=no git at localhost
 fi
 
 prefix=$(arv --format=uuid user current | cut -d- -f1)
@@ -66,7 +97,7 @@ cat > config/arvados-clients.yml <<EOF
 development:
   gitolite_url: /var/lib/arvados/git/repositories/gitolite-admin.git
   gitolite_tmp: /var/lib/arvados/git
-  arvados_api_host: $localip:3001
+  arvados_api_host: $localip:${services[api]}
   arvados_api_token: "$ARVADOS_API_TOKEN"
   arvados_api_host_insecure: true
   gitolite_arvados_git_user_key: "$git_user_key"
diff --git a/arvbox/lib/arvbox/docker/service/git/log/main/.gitstub b/arvbox/lib/arvbox/docker/service/keep-web/log/main/.gitstub
similarity index 100%
rename from arvbox/lib/arvbox/docker/service/git/log/main/.gitstub
rename to arvbox/lib/arvbox/docker/service/keep-web/log/main/.gitstub
diff --git a/arvbox/lib/arvbox/docker/service/keep-web/log/run b/arvbox/lib/arvbox/docker/service/keep-web/log/run
new file mode 120000
index 0000000..d6aef4a
--- /dev/null
+++ b/arvbox/lib/arvbox/docker/service/keep-web/log/run
@@ -0,0 +1 @@
+/usr/local/lib/arvbox/logger
\ No newline at end of file
diff --git a/arvbox/lib/arvbox/docker/service/keep-web/run b/arvbox/lib/arvbox/docker/service/keep-web/run
new file mode 120000
index 0000000..a388c8b
--- /dev/null
+++ b/arvbox/lib/arvbox/docker/service/keep-web/run
@@ -0,0 +1 @@
+/usr/local/lib/arvbox/runsu.sh
\ No newline at end of file
diff --git a/arvbox/lib/arvbox/docker/service/keepweb/run-service b/arvbox/lib/arvbox/docker/service/keep-web/run-service
similarity index 59%
rename from arvbox/lib/arvbox/docker/service/keepweb/run-service
rename to arvbox/lib/arvbox/docker/service/keep-web/run-service
index 38c31f0..a2c6aa1 100755
--- a/arvbox/lib/arvbox/docker/service/keepweb/run-service
+++ b/arvbox/lib/arvbox/docker/service/keep-web/run-service
@@ -1,7 +1,7 @@
-#!/bin/sh
+#!/bin/bash
 
 exec 2>&1
-set -eux
+set -eux -o pipefail
 
 . /usr/local/lib/arvbox/common.sh
 
@@ -11,11 +11,11 @@ cd /var/lib/arvados/gostuff
 export GOPATH=$PWD
 mkdir -p "$GOPATH/src/git.curoverse.com"
 ln -sfn "/usr/src/arvados" "$GOPATH/src/git.curoverse.com/arvados.git"
-go get -t "git.curoverse.com/arvados.git/services/keep-web"
+flock /var/lib/arvados/gostuff.lock go get -t "git.curoverse.com/arvados.git/services/keep-web"
 install bin/keep-web /usr/local/bin
 
-export ARVADOS_API_HOST=$localip:3001
+export ARVADOS_API_HOST=$localip:${services[api]}
 export ARVADOS_API_HOST_INSECURE=1
 export ARVADOS_API_TOKEN=$(cat /var/lib/arvados/superuser_token)
 
-exec /usr/local/bin/keep-web -trust-all-content -listen=":25099"
+exec /usr/local/bin/keep-web -trust-all-content -listen=:${services[keep-web]}
diff --git a/arvbox/lib/arvbox/docker/service/keep0/log/run b/arvbox/lib/arvbox/docker/service/keep0/log/run
deleted file mode 120000
index f99cc1d..0000000
--- a/arvbox/lib/arvbox/docker/service/keep0/log/run
+++ /dev/null
@@ -1 +0,0 @@
-../../logger
\ No newline at end of file
diff --git a/arvbox/lib/arvbox/docker/service/keep0/run b/arvbox/lib/arvbox/docker/service/keep0/run
deleted file mode 120000
index ef446b5..0000000
--- a/arvbox/lib/arvbox/docker/service/keep0/run
+++ /dev/null
@@ -1 +0,0 @@
-../runsu.sh
\ No newline at end of file
diff --git a/arvbox/lib/arvbox/docker/service/keep0/run-service b/arvbox/lib/arvbox/docker/service/keep0/run-service
deleted file mode 100755
index 7f87b88..0000000
--- a/arvbox/lib/arvbox/docker/service/keep0/run-service
+++ /dev/null
@@ -1,2 +0,0 @@
-#!/bin/sh
-exec /usr/local/lib/arvbox/keep-setup.sh keep0 25107
diff --git a/arvbox/lib/arvbox/docker/service/keep1/log/run b/arvbox/lib/arvbox/docker/service/keep1/log/run
deleted file mode 120000
index f99cc1d..0000000
--- a/arvbox/lib/arvbox/docker/service/keep1/log/run
+++ /dev/null
@@ -1 +0,0 @@
-../../logger
\ No newline at end of file
diff --git a/arvbox/lib/arvbox/docker/service/keep1/run b/arvbox/lib/arvbox/docker/service/keep1/run
deleted file mode 120000
index ef446b5..0000000
--- a/arvbox/lib/arvbox/docker/service/keep1/run
+++ /dev/null
@@ -1 +0,0 @@
-../runsu.sh
\ No newline at end of file
diff --git a/arvbox/lib/arvbox/docker/service/keep1/run-service b/arvbox/lib/arvbox/docker/service/keep1/run-service
deleted file mode 100755
index a44c8dd..0000000
--- a/arvbox/lib/arvbox/docker/service/keep1/run-service
+++ /dev/null
@@ -1,3 +0,0 @@
-#!/bin/sh
-sleep 1
-exec /usr/local/lib/arvbox/keep-setup.sh keep1 25108
diff --git a/arvbox/lib/arvbox/docker/service/keepproxy/log/run b/arvbox/lib/arvbox/docker/service/keepproxy/log/run
index f99cc1d..d6aef4a 120000
--- a/arvbox/lib/arvbox/docker/service/keepproxy/log/run
+++ b/arvbox/lib/arvbox/docker/service/keepproxy/log/run
@@ -1 +1 @@
-../../logger
\ No newline at end of file
+/usr/local/lib/arvbox/logger
\ No newline at end of file
diff --git a/arvbox/lib/arvbox/docker/service/keepproxy/run b/arvbox/lib/arvbox/docker/service/keepproxy/run
index ef446b5..a388c8b 120000
--- a/arvbox/lib/arvbox/docker/service/keepproxy/run
+++ b/arvbox/lib/arvbox/docker/service/keepproxy/run
@@ -1 +1 @@
-../runsu.sh
\ No newline at end of file
+/usr/local/lib/arvbox/runsu.sh
\ No newline at end of file
diff --git a/arvbox/lib/arvbox/docker/service/keepproxy/run-service b/arvbox/lib/arvbox/docker/service/keepproxy/run-service
index 87b46d9..413a67e 100755
--- a/arvbox/lib/arvbox/docker/service/keepproxy/run-service
+++ b/arvbox/lib/arvbox/docker/service/keepproxy/run-service
@@ -2,7 +2,7 @@
 
 exec 2>&1
 sleep 2
-set -eux
+set -eux -o pipefail
 
 . /usr/local/lib/arvbox/common.sh
 
@@ -12,38 +12,30 @@ cd /var/lib/arvados/gostuff
 export GOPATH=$PWD
 mkdir -p "$GOPATH/src/git.curoverse.com"
 ln -sfn "/usr/src/arvados" "$GOPATH/src/git.curoverse.com/arvados.git"
-go get -t "git.curoverse.com/arvados.git/services/keepproxy"
+flock /var/lib/arvados/gostuff.lock go get -t "git.curoverse.com/arvados.git/services/keepproxy"
 install bin/keepproxy /usr/local/bin
 
-export ARVADOS_API_HOST=$localip:3001
+export ARVADOS_API_HOST=$localip:${services[api]}
 export ARVADOS_API_HOST_INSECURE=1
 export ARVADOS_API_TOKEN=$(cat /var/lib/arvados/superuser_token)
 
-if test -s /var/lib/arvados/keepproxy-uuid ; then
-    keep_uuid=$(cat /var/lib/arvados/keepproxy-uuid)
-    set +e
-    read -rd $'\000' keepservice <<EOF
-{
- "service_host":"$localip",
- "service_port":25100,
- "service_type":"proxy"
-}
-EOF
-   set -e
-   arv keep_service update --uuid $keep_uuid --keep-service "$keepservice"
-else
-    set +e
-    read -rd $'\000' keepservice <<EOF
+set +e
+read -rd $'\000' keepservice <<EOF
 {
  "service_host":"$localip",
- "service_port":25100,
+ "service_port":${services[keepproxy]},
  "service_ssl_flag":false,
  "service_type":"proxy"
 }
 EOF
-    set -e
+set -e
+
+if test -s /var/lib/arvados/keepproxy-uuid ; then
+    keep_uuid=$(cat /var/lib/arvados/keepproxy-uuid)
+    arv keep_service update --uuid $keep_uuid --keep-service "$keepservice"
+else
     UUID=$(arv --format=uuid keep_service create --keep-service "$keepservice")
     echo $UUID > /var/lib/arvados/keepproxy-uuid
 fi
 
-exec /usr/local/bin/keepproxy -listen=":25100"
+exec /usr/local/bin/keepproxy -listen=:${services[keepproxy]}
diff --git a/arvbox/lib/arvbox/docker/service/crunch1/log/main/.gitstub b/arvbox/lib/arvbox/docker/service/keepstore0/log/main/.gitstub
similarity index 100%
rename from arvbox/lib/arvbox/docker/service/crunch1/log/main/.gitstub
rename to arvbox/lib/arvbox/docker/service/keepstore0/log/main/.gitstub
diff --git a/arvbox/lib/arvbox/docker/service/keepstore0/log/run b/arvbox/lib/arvbox/docker/service/keepstore0/log/run
new file mode 120000
index 0000000..d6aef4a
--- /dev/null
+++ b/arvbox/lib/arvbox/docker/service/keepstore0/log/run
@@ -0,0 +1 @@
+/usr/local/lib/arvbox/logger
\ No newline at end of file
diff --git a/arvbox/lib/arvbox/docker/service/keepstore0/run b/arvbox/lib/arvbox/docker/service/keepstore0/run
new file mode 120000
index 0000000..a388c8b
--- /dev/null
+++ b/arvbox/lib/arvbox/docker/service/keepstore0/run
@@ -0,0 +1 @@
+/usr/local/lib/arvbox/runsu.sh
\ No newline at end of file
diff --git a/arvbox/lib/arvbox/docker/service/keepstore0/run-service b/arvbox/lib/arvbox/docker/service/keepstore0/run-service
new file mode 100755
index 0000000..cf411e4
--- /dev/null
+++ b/arvbox/lib/arvbox/docker/service/keepstore0/run-service
@@ -0,0 +1,3 @@
+#!/bin/bash
+. /usr/local/lib/arvbox/common.sh
+exec /usr/local/lib/arvbox/keep-setup.sh keep0 ${services[keepstore0]}
diff --git a/arvbox/lib/arvbox/docker/service/crunch0/log/main/.gitstub b/arvbox/lib/arvbox/docker/service/keepstore1/log/main/.gitstub
similarity index 100%
rename from arvbox/lib/arvbox/docker/service/crunch0/log/main/.gitstub
rename to arvbox/lib/arvbox/docker/service/keepstore1/log/main/.gitstub
diff --git a/arvbox/lib/arvbox/docker/service/keepstore1/log/run b/arvbox/lib/arvbox/docker/service/keepstore1/log/run
new file mode 120000
index 0000000..d6aef4a
--- /dev/null
+++ b/arvbox/lib/arvbox/docker/service/keepstore1/log/run
@@ -0,0 +1 @@
+/usr/local/lib/arvbox/logger
\ No newline at end of file
diff --git a/arvbox/lib/arvbox/docker/service/keepstore1/run b/arvbox/lib/arvbox/docker/service/keepstore1/run
new file mode 120000
index 0000000..a388c8b
--- /dev/null
+++ b/arvbox/lib/arvbox/docker/service/keepstore1/run
@@ -0,0 +1 @@
+/usr/local/lib/arvbox/runsu.sh
\ No newline at end of file
diff --git a/arvbox/lib/arvbox/docker/service/keepstore1/run-service b/arvbox/lib/arvbox/docker/service/keepstore1/run-service
new file mode 100755
index 0000000..8d34d06
--- /dev/null
+++ b/arvbox/lib/arvbox/docker/service/keepstore1/run-service
@@ -0,0 +1,3 @@
+#!/bin/bash
+. /usr/local/lib/arvbox/common.sh
+exec /usr/local/lib/arvbox/keep-setup.sh keep1 ${services[keepstore1]}
diff --git a/arvbox/lib/arvbox/docker/service/keepweb/log/run b/arvbox/lib/arvbox/docker/service/keepweb/log/run
deleted file mode 120000
index f99cc1d..0000000
--- a/arvbox/lib/arvbox/docker/service/keepweb/log/run
+++ /dev/null
@@ -1 +0,0 @@
-../../logger
\ No newline at end of file
diff --git a/arvbox/lib/arvbox/docker/service/keepweb/run b/arvbox/lib/arvbox/docker/service/keepweb/run
deleted file mode 120000
index ef446b5..0000000
--- a/arvbox/lib/arvbox/docker/service/keepweb/run
+++ /dev/null
@@ -1 +0,0 @@
-../runsu.sh
\ No newline at end of file
diff --git a/arvbox/lib/arvbox/docker/service/postgres/log/run b/arvbox/lib/arvbox/docker/service/postgres/log/run
index f99cc1d..d6aef4a 120000
--- a/arvbox/lib/arvbox/docker/service/postgres/log/run
+++ b/arvbox/lib/arvbox/docker/service/postgres/log/run
@@ -1 +1 @@
-../../logger
\ No newline at end of file
+/usr/local/lib/arvbox/logger
\ No newline at end of file
diff --git a/arvbox/lib/arvbox/docker/service/postgres/run b/arvbox/lib/arvbox/docker/service/postgres/run
index ad9cc37..4918bd7 100755
--- a/arvbox/lib/arvbox/docker/service/postgres/run
+++ b/arvbox/lib/arvbox/docker/service/postgres/run
@@ -1,4 +1,4 @@
-#!/bin/sh
+#!/bin/bash
 
 flock /var/lib/arvados/createusers.lock /usr/local/lib/arvbox/createusers.sh
 
diff --git a/arvbox/lib/arvbox/docker/service/postgres/run-service b/arvbox/lib/arvbox/docker/service/postgres/run-service
index 0a67d6c..dd2eb1a 100755
--- a/arvbox/lib/arvbox/docker/service/postgres/run-service
+++ b/arvbox/lib/arvbox/docker/service/postgres/run-service
@@ -1,7 +1,7 @@
-#!/bin/sh
+#!/bin/bash
 
 exec 2>&1
-set -eux
+set -eux -o pipefail
 
 if ! test -d /var/lib/postgresql/9.4/main ; then
     /usr/lib/postgresql/9.4/bin/initdb -D /var/lib/postgresql/9.4/main
diff --git a/arvbox/lib/arvbox/docker/service/ready/run b/arvbox/lib/arvbox/docker/service/ready/run
index ef446b5..a388c8b 120000
--- a/arvbox/lib/arvbox/docker/service/ready/run
+++ b/arvbox/lib/arvbox/docker/service/ready/run
@@ -1 +1 @@
-../runsu.sh
\ No newline at end of file
+/usr/local/lib/arvbox/runsu.sh
\ No newline at end of file
diff --git a/arvbox/lib/arvbox/docker/service/ready/run-service b/arvbox/lib/arvbox/docker/service/ready/run-service
index a26d47c..52c0adc 100755
--- a/arvbox/lib/arvbox/docker/service/ready/run-service
+++ b/arvbox/lib/arvbox/docker/service/ready/run-service
@@ -2,7 +2,7 @@
 
 . /usr/local/lib/arvbox/common.sh
 
-set -eu
+set -eu -o pipefail
 
 if ! [[ -d /tmp/arvbox-ready ]] ; then
    echo
@@ -16,24 +16,8 @@ fi
 
 sleep 3
 
-declare -A services
-services=(
-  [workbench]=80
-  [api]=3001
-  [sso]=3002
-  [githttp]=9001
-  [keepweb]=25099
-  [keepproxy]=25100
-  [keep0]=25107
-  [keep1]=25108
-  [ssh]=22
-  [doc]=8000
-)
-
 waiting=""
 
-. /usr/local/lib/arvbox/common.sh
-
 for s in "${!services[@]}"
 do
   if ! [[ -f /tmp/arvbox-ready/$s ]] ; then
diff --git a/arvbox/lib/arvbox/docker/service/sdk/log/run b/arvbox/lib/arvbox/docker/service/sdk/log/run
index f99cc1d..d6aef4a 120000
--- a/arvbox/lib/arvbox/docker/service/sdk/log/run
+++ b/arvbox/lib/arvbox/docker/service/sdk/log/run
@@ -1 +1 @@
-../../logger
\ No newline at end of file
+/usr/local/lib/arvbox/logger
\ No newline at end of file
diff --git a/arvbox/lib/arvbox/docker/service/sdk/run b/arvbox/lib/arvbox/docker/service/sdk/run
index e6c844d..816b166 100755
--- a/arvbox/lib/arvbox/docker/service/sdk/run
+++ b/arvbox/lib/arvbox/docker/service/sdk/run
@@ -1,5 +1,5 @@
 #!/bin/sh
 set -e
 
-/etc/service/runsu.sh $0-service
+/usr/local/lib/arvbox/runsu.sh $0-service
 sv stop sdk
diff --git a/arvbox/lib/arvbox/docker/service/sdk/run-service b/arvbox/lib/arvbox/docker/service/sdk/run-service
index fd376ba..b51f0fc 100755
--- a/arvbox/lib/arvbox/docker/service/sdk/run-service
+++ b/arvbox/lib/arvbox/docker/service/sdk/run-service
@@ -1,7 +1,7 @@
 #!/bin/bash
 
 exec 2>&1
-set -eux
+set -eux -o pipefail
 
 . /usr/local/lib/arvbox/common.sh
 
diff --git a/arvbox/lib/arvbox/docker/service/ssh/log/run b/arvbox/lib/arvbox/docker/service/ssh/log/run
index f99cc1d..d6aef4a 120000
--- a/arvbox/lib/arvbox/docker/service/ssh/log/run
+++ b/arvbox/lib/arvbox/docker/service/ssh/log/run
@@ -1 +1 @@
-../../logger
\ No newline at end of file
+/usr/local/lib/arvbox/logger
\ No newline at end of file
diff --git a/arvbox/lib/arvbox/docker/service/ssh/run b/arvbox/lib/arvbox/docker/service/ssh/run
index 0db3ffa..0f23542 100755
--- a/arvbox/lib/arvbox/docker/service/ssh/run
+++ b/arvbox/lib/arvbox/docker/service/ssh/run
@@ -1,7 +1,7 @@
-#!/bin/sh
+#!/bin/bash
 
 exec 2>&1
-set -eux
+set -eux -o pipefail
 
 if ! test -d /var/run/sshd ; then
    mkdir /var/run/sshd
diff --git a/arvbox/lib/arvbox/docker/service/sso/log/run b/arvbox/lib/arvbox/docker/service/sso/log/run
index f99cc1d..d6aef4a 120000
--- a/arvbox/lib/arvbox/docker/service/sso/log/run
+++ b/arvbox/lib/arvbox/docker/service/sso/log/run
@@ -1 +1 @@
-../../logger
\ No newline at end of file
+/usr/local/lib/arvbox/logger
\ No newline at end of file
diff --git a/arvbox/lib/arvbox/docker/service/sso/run b/arvbox/lib/arvbox/docker/service/sso/run
index ef446b5..a388c8b 120000
--- a/arvbox/lib/arvbox/docker/service/sso/run
+++ b/arvbox/lib/arvbox/docker/service/sso/run
@@ -1 +1 @@
-../runsu.sh
\ No newline at end of file
+/usr/local/lib/arvbox/runsu.sh
\ No newline at end of file
diff --git a/arvbox/lib/arvbox/docker/service/sso/run-service b/arvbox/lib/arvbox/docker/service/sso/run-service
index 29951f5..d1c566a 100755
--- a/arvbox/lib/arvbox/docker/service/sso/run-service
+++ b/arvbox/lib/arvbox/docker/service/sso/run-service
@@ -1,7 +1,7 @@
-#!/bin/sh
+#!/bin/bash
 
 exec 2>&1
-set -ex
+set -ex -o pipefail
 
 . /usr/local/lib/arvbox/common.sh
 
@@ -96,7 +96,7 @@ if test "$1" = "--only-setup" ; then
     exit
 fi
 
-exec bundle exec passenger start --port=3002 \
+exec bundle exec passenger start --port=${services[sso]} \
      --runtime-dir=/var/lib/passenger \
      --ssl --ssl-certificate=/var/lib/arvados/self-signed.pem \
      --ssl-certificate-key=/var/lib/arvados/self-signed.key
diff --git a/arvbox/lib/arvbox/docker/service/vm/log/run b/arvbox/lib/arvbox/docker/service/vm/log/run
index f99cc1d..d6aef4a 120000
--- a/arvbox/lib/arvbox/docker/service/vm/log/run
+++ b/arvbox/lib/arvbox/docker/service/vm/log/run
@@ -1 +1 @@
-../../logger
\ No newline at end of file
+/usr/local/lib/arvbox/logger
\ No newline at end of file
diff --git a/arvbox/lib/arvbox/docker/service/vm/run b/arvbox/lib/arvbox/docker/service/vm/run
deleted file mode 120000
index ef446b5..0000000
--- a/arvbox/lib/arvbox/docker/service/vm/run
+++ /dev/null
@@ -1 +0,0 @@
-../runsu.sh
\ No newline at end of file
diff --git a/arvbox/lib/arvbox/docker/service/vm/run b/arvbox/lib/arvbox/docker/service/vm/run
new file mode 100755
index 0000000..b7fb9cc
--- /dev/null
+++ b/arvbox/lib/arvbox/docker/service/vm/run
@@ -0,0 +1,9 @@
+#!/bin/bash
+set -e
+
+. /usr/local/lib/arvbox/common.sh
+
+git config --system "credential.http://$localip:${services[arv-git-httpd]}/.username" none
+git config --system "credential.http://$localip:${services[arv-git-httpd]}/.helper" '!cred(){ cat >/dev/null; if [ "$1" = get ]; then echo password=$ARVADOS_API_TOKEN; fi; };cred'
+
+exec /usr/local/lib/arvbox/runsu.sh $0-service
diff --git a/arvbox/lib/arvbox/docker/service/vm/run-service b/arvbox/lib/arvbox/docker/service/vm/run-service
index 9b894ff..a845e44 100755
--- a/arvbox/lib/arvbox/docker/service/vm/run-service
+++ b/arvbox/lib/arvbox/docker/service/vm/run-service
@@ -2,7 +2,7 @@
 
 exec 2>&1
 sleep 2
-set -eux
+set -ex -o pipefail
 
 . /usr/local/lib/arvbox/common.sh
 
@@ -13,31 +13,24 @@ if test "$1" = "--only-deps" ; then
     exit
 fi
 
-git config --system "credential.http://$localip:9001/.username" none
-git config --system "credential.http://$localip:9001/.helper" '!cred(){ cat >/dev/null; if [ "$1" = get ]; then echo password=$ARVADOS_API_TOKEN; fi; };cred'
+set -u
 
-export ARVADOS_API_HOST=$localip:3001
+export ARVADOS_API_HOST=$localip:${services[api]}
 export ARVADOS_API_HOST_INSECURE=1
 export ARVADOS_API_TOKEN=$(cat /var/lib/arvados/superuser_token)
 
-if test -s /var/lib/arvados/vm-uuid ; then
-    ARVADOS_VIRTUAL_MACHINE_UUID=$(cat /var/lib/arvados/vm-uuid)
-    set +e
-    read -rd $'\000' vm <<EOF
+set +e
+read -rd $'\000' vm <<EOF
 {
  "hostname":"$localip"
 }
 EOF
-    set -e
+set -e
+
+if test -s /var/lib/arvados/vm-uuid ; then
+    ARVADOS_VIRTUAL_MACHINE_UUID=$(cat /var/lib/arvados/vm-uuid)
     arv virtual_machine update --uuid $ARVADOS_VIRTUAL_MACHINE_UUID --virtual-machine "$vm"
 else
-    set +e
-    read -rd $'\000' vm <<EOF
-{
- "hostname":"$localip"
-}
-EOF
-    set -e
     ARVADOS_VIRTUAL_MACHINE_UUID=$(arv --format=uuid virtual_machine create --virtual-machine "$vm")
     echo $ARVADOS_VIRTUAL_MACHINE_UUID > /var/lib/arvados/vm-uuid
 fi
diff --git a/arvbox/lib/arvbox/docker/service/workbench/log/run b/arvbox/lib/arvbox/docker/service/workbench/log/run
index f99cc1d..d6aef4a 120000
--- a/arvbox/lib/arvbox/docker/service/workbench/log/run
+++ b/arvbox/lib/arvbox/docker/service/workbench/log/run
@@ -1 +1 @@
-../../logger
\ No newline at end of file
+/usr/local/lib/arvbox/logger
\ No newline at end of file
diff --git a/arvbox/lib/arvbox/docker/service/workbench/run b/arvbox/lib/arvbox/docker/service/workbench/run
index f121ce7..6ac0476 100755
--- a/arvbox/lib/arvbox/docker/service/workbench/run
+++ b/arvbox/lib/arvbox/docker/service/workbench/run
@@ -1,7 +1,7 @@
 #!/bin/sh
 set -e
 
-/etc/service/runsu.sh $0-service $1
+/usr/local/lib/arvbox/runsu.sh $0-service $1
 
 cd /usr/src/arvados/apps/workbench
 
diff --git a/arvbox/lib/arvbox/docker/service/workbench/run-service b/arvbox/lib/arvbox/docker/service/workbench/run-service
index dadd989..a5f7195 100755
--- a/arvbox/lib/arvbox/docker/service/workbench/run-service
+++ b/arvbox/lib/arvbox/docker/service/workbench/run-service
@@ -1,13 +1,12 @@
-#!/bin/sh
+#!/bin/bash
 
 exec 2>&1
-set -ex
+set -ex -o pipefail
 
 .  /usr/local/lib/arvbox/common.sh
 
 cd /usr/src/arvados/apps/workbench
 export RAILS_ENV=development
-export GEM_HOME=/var/lib/gems
 
 run_bundler --without=development
 bundle exec passenger start --runtime-check-only --runtime-dir=/var/lib/passenger
@@ -30,10 +29,10 @@ fi
 cat >config/application.yml <<EOF
 common:
   secret_token: $secret_token
-  arvados_login_base: https://$localip:3001/login
-  arvados_v1_base: https://$localip:3001/arvados/v1
+  arvados_login_base: https://$localip:${services[api]}/login
+  arvados_v1_base: https://$localip:${services[api]}/arvados/v1
   arvados_insecure_https: true
-  keep_web_download_url: http://$localip:25099/c=%{uuid_or_pdh}
-  keep_web_url: http://$localip:25099/c=%{uuid_or_pdh}
-  arvados_docsite: http://$localip:8000/
+  keep_web_download_url: http://$localip:${services[keep-web]}/c=%{uuid_or_pdh}
+  keep_web_url: http://$localip:${services[keep-web]}/c=%{uuid_or_pdh}
+  arvados_docsite: http://$localip:${services[doc]}/
 EOF

commit ba698c52e9be47f547dd743f4e13d7992db80743
Author: Peter Amstutz <peter.amstutz at curoverse.com>
Date:   Fri Jan 8 16:24:43 2016 -0500

    Working on getting demo image to work.  Not quite there yet.

diff --git a/arvbox/bin/arvbox b/arvbox/bin/arvbox
index 57c0905..af13ab9 100755
--- a/arvbox/bin/arvbox
+++ b/arvbox/bin/arvbox
@@ -35,12 +35,16 @@ VAR_DATA=$ARVBOX_DATA/var
 PASSENGER=$ARVBOX_DATA/passenger
 GEMS=$ARVBOX_DATA/gems
 
-mkdir -p $PG_DATA $VAR_DATA $PASSENGER $GEMS
-
 run() {
     if test "$1" = demo ; then
+        if test -d $ARVBOX_DATA ; then
+            echo "It looks like you already have a development container named $ARVBOX_CONTAINER."
+            echo "Set ARVBOX_CONTAINER to something else"
+            exit 1
+        fi
+
         if docker ps -a --filter "status=exited" |grep -E "$ARVBOX_CONTAINER$" -q ; then
-            docker start $ARVBOX_CONTAINER
+            docker start -a $ARVBOX_CONTAINER
         else
             docker run \
                    --name=$ARVBOX_CONTAINER \
@@ -48,6 +52,8 @@ run() {
                    arvados/arvbox-demo
         fi
     else
+        mkdir -p $PG_DATA $VAR_DATA $PASSENGER $GEMS
+
         if ! test -d $ARVADOS_ROOT ; then
             git clone https://github.com/curoverse/arvados.git $ARVADOS_ROOT
         fi
@@ -68,7 +74,7 @@ run() {
                    --volume=$PASSENGER:/var/lib/passenger:rw \
                    --volume=$GEMS:/var/lib/gems:rw \
                    arvados/arvbox-dev \
-                   runsvdir /etc/tests-service
+                   LD_PRELOAD=/lib/runit-docker.so exec runsvdir /etc/tests-service
         else
             docker run \
                    --detach \
diff --git a/arvbox/lib/arvbox/docker/Dockerfile.base b/arvbox/lib/arvbox/docker/Dockerfile.base
index 9308d9c..274dceb 100644
--- a/arvbox/lib/arvbox/docker/Dockerfile.base
+++ b/arvbox/lib/arvbox/docker/Dockerfile.base
@@ -20,9 +20,7 @@ RUN cd /root/runit-docker && \
     make && \
     make install
 
-ENV LD_PRELOAD /lib/runit-docker.so
-
 ADD fuse.conf /etc/
 
 # Start the supervisor.
-CMD ["runsvdir", "/etc/service"]
+CMD LD_PRELOAD=/lib/runit-docker.so exec runsvdir /etc/service
diff --git a/arvbox/lib/arvbox/docker/Dockerfile.demo b/arvbox/lib/arvbox/docker/Dockerfile.demo
index 2ab772e..46ab21e 100644
--- a/arvbox/lib/arvbox/docker/Dockerfile.demo
+++ b/arvbox/lib/arvbox/docker/Dockerfile.demo
@@ -7,10 +7,11 @@ RUN cd /usr/src && \
 ADD crunch-setup.sh gitolite-setup.sh gitolite.rc gitssh-setup.sh keep-setup.sh common.sh createusers.sh /usr/local/lib/arvbox/
 ADD service /etc/service
 
-RUN mkdir -p /var/lib/arvados
-RUN /etc/service/sso/run-service --only-deps
-RUN /etc/service/api/run-service --only-deps
-RUN /etc/service/workbench/run-service --only-deps
-RUN /etc/service/doc/run-service --only-deps
-RUN /etc/service/vm/run-service --only-deps
-RUN /etc/service/sdk/run-service
+RUN chown -R 1000:1000 /usr/src && /usr/local/lib/arvbox/createusers.sh
+
+RUN sudo -u arvbox /etc/service/sso/run-service --only-deps
+RUN sudo -u arvbox /etc/service/api/run-service --only-deps
+RUN sudo -u arvbox /etc/service/workbench/run-service --only-deps
+RUN sudo -u arvbox /etc/service/doc/run-service --only-deps
+RUN sudo -u arvbox /etc/service/vm/run-service --only-deps
+RUN sudo -u arvbox /etc/service/sdk/run-service
diff --git a/arvbox/lib/arvbox/docker/common.sh b/arvbox/lib/arvbox/docker/common.sh
index bc328f7..d58c39b 100644
--- a/arvbox/lib/arvbox/docker/common.sh
+++ b/arvbox/lib/arvbox/docker/common.sh
@@ -2,6 +2,14 @@ localip=$(ip addr show eth0 |grep "inet " | sed 's/ *inet \([^/]*\).*/\1/')
 export GEM_HOME=/var/lib/gems
 export GEM_PATH=/var/lib/gems
 
+if test $(id arvbox -u) = 0 ; then
+    PGUSER=postgres
+    PGGROUP=postgres
+else
+    PGUSER=arvbox
+    PGGROUP=arvbox
+fi
+
 run_bundler() {
     if test -f Gemfile.lock ; then
         frozen=--frozen
diff --git a/arvbox/lib/arvbox/docker/createusers.sh b/arvbox/lib/arvbox/docker/createusers.sh
index 8d27990..680d9fe 100755
--- a/arvbox/lib/arvbox/docker/createusers.sh
+++ b/arvbox/lib/arvbox/docker/createusers.sh
@@ -7,7 +7,8 @@ if ! grep "^arvbox:" /etc/passwd >/dev/null 2>/dev/null ; then
     HOSTGID=$(ls -nd /usr/src/arvados | sed 's/ */ /' | cut -d' ' -f5)
     FUSEGID=$(ls -nd /dev/fuse | sed 's/ */ /' | cut -d' ' -f5)
 
-    mkdir -p /var/lib/arvados/git
+    mkdir -p /var/lib/arvados/git /var/lib/gems /var/lib/passenger
+
     groupadd --gid $HOSTGID --non-unique arvbox
     groupadd --gid $FUSEGID --non-unique fuse
     groupadd --gid $HOSTGID --non-unique git
@@ -19,7 +20,7 @@ if ! grep "^arvbox:" /etc/passwd >/dev/null 2>/dev/null ; then
     useradd --home-dir /var/lib/arvados/git --uid $HOSTUID --gid $HOSTGID --non-unique git
     useradd --groups docker,fuse crunch
 
-    chown arvbox:arvbox -R /usr/local
+    chown arvbox:arvbox -R /usr/local /var/lib/arvados /var/lib/gems /var/lib/passenger
 
     mkdir -p /var/lib/gems/ruby/2.1.0
     chown arvbox:arvbox -R /var/lib/gems/ruby/2.1.0
diff --git a/arvbox/lib/arvbox/docker/service/postgres/run b/arvbox/lib/arvbox/docker/service/postgres/run
index 55d11a0..ad9cc37 100755
--- a/arvbox/lib/arvbox/docker/service/postgres/run
+++ b/arvbox/lib/arvbox/docker/service/postgres/run
@@ -2,17 +2,11 @@
 
 flock /var/lib/arvados/createusers.lock /usr/local/lib/arvbox/createusers.sh
 
-if test $(id arvbox -u) = 0 ; then
-    USER=postgres
-    GROUP=postgres
-else
-    USER=arvbox
-    GROUP=arvbox
-fi
+. /usr/local/lib/arvbox/common.sh
 
-chown -R $USER:$GROUP /var/lib/postgresql
-chown -R $USER:$GROUP /var/run/postgresql
-chown -R $USER:$GROUP /etc/postgresql
-chown -R $USER:$GROUP /etc/ssl/private
+chown -R $PGUSER:$PGGROUP /var/lib/postgresql
+chown -R $PGUSER:$PGGROUP /var/run/postgresql
+chown -R $PGUSER:$PGGROUP /etc/postgresql
+chown -R $PGUSER:$PGGROUP /etc/ssl/private
 
-exec su $USER $0-service
+exec chpst -u $PGUSER:$PGGROUP $0-service
diff --git a/arvbox/lib/arvbox/docker/service/runsu.sh b/arvbox/lib/arvbox/docker/service/runsu.sh
index 32eccdf..d702709 100755
--- a/arvbox/lib/arvbox/docker/service/runsu.sh
+++ b/arvbox/lib/arvbox/docker/service/runsu.sh
@@ -8,7 +8,7 @@ flock /var/lib/arvados/createusers.lock /usr/local/lib/arvbox/createusers.sh
 export HOME=/var/lib/arvados
 
 if test -z "$1" ; then
-    exec sudo -u arvbox -- $0-service
+    exec chpst -u arvbox:arvbox $0-service
 else
-    exec sudo -u arvbox -- $@
+    exec chpst -u arvbox:arvbox $@
 fi

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


hooks/post-receive
-- 




More information about the arvados-commits mailing list