[ARVADOS-DEV] updated: c66016db77c59b3e5e5d459bb80d670e8ab075e4

git at public.curoverse.com git at public.curoverse.com
Mon Jan 4 10:46:21 EST 2016


Summary of changes:
 arvbox/arvbox                                      | 42 +++++++++++-----------
 arvbox/docker/common.sh                            |  4 +--
 arvbox/docker/service/api/run                      | 12 +++++--
 arvbox/docker/service/docker/run                   |  7 +++-
 arvbox/docker/service/ready/run                    | 18 +++++++++-
 arvbox/docker/service/sso/run                      | 18 +++++++---
 arvbox/docker/service/workbench/run                |  2 +-
 .../tests-service/{postgres => docker}/log/run     |  0
 .../docker/{service => tests-service}/docker/run   |  0
 arvbox/docker/{service => tests-service}/logger    |  0
 10 files changed, 71 insertions(+), 32 deletions(-)
 copy arvbox/docker/tests-service/{postgres => docker}/log/run (100%)
 copy arvbox/docker/{service => tests-service}/docker/run (100%)
 copy arvbox/docker/{service => tests-service}/logger (100%)

       via  c66016db77c59b3e5e5d459bb80d670e8ab075e4 (commit)
       via  1f01b5bfd46cf5eb6ff06d84fd3515c9d8c5d6ef (commit)
       via  05348254357bd32e126e7a7ee0e8cfc5bb87cc5f (commit)
      from  01cf08200a38f781a62283ebb6099f46a5bf13ef (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 c66016db77c59b3e5e5d459bb80d670e8ab075e4
Author: Peter Amstutz <peter.amstutz at curoverse.com>
Date:   Mon Jan 4 10:42:10 2016 -0500

    8080: Count gems for status reporting.  Store gems in a different place.  Store
    database password and rewrite database.yml on startup.

diff --git a/arvbox/arvbox b/arvbox/arvbox
index ee8910c..f953bc1 100755
--- a/arvbox/arvbox
+++ b/arvbox/arvbox
@@ -27,8 +27,9 @@ fi
 PASSENGER=$ARVBOX_DATA/passenger
 PG_DATA=$ARVBOX_DATA/postgres
 VAR_DATA=$ARVBOX_DATA/var
+GEMS=$ARVBOX_DATA/gems
 
-mkdir -p $PASSENGER $PG_DATA $VAR_DATA
+mkdir -p $PASSENGER $PG_DATA $VAR_DATA $GEMS
 
 run() {
     if ! test -d $ARVADOS_ROOT ; then
@@ -49,6 +50,7 @@ run() {
                --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=/var/lib/docker \
                arvados/arvbox \
                runsvdir /etc/tests-service
@@ -62,6 +64,7 @@ run() {
                --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=/var/lib/docker \
                arvados/arvbox
         FF=/tmp/arvbox-fifo-$$
@@ -105,7 +108,7 @@ case $1 in
 
     reboot)
         stop
-        cd $ARVBOX
+        cd $ARVBOX_SCRIPT
         docker build -t arvados/arvbox docker
         run
         ;;
diff --git a/arvbox/docker/common.sh b/arvbox/docker/common.sh
index ffed7fd..3bf3293 100644
--- a/arvbox/docker/common.sh
+++ b/arvbox/docker/common.sh
@@ -1,6 +1,6 @@
 localip=$(ip addr show eth0 |grep "inet " | sed 's/ *inet \([^/]*\).*/\1/')
-export GEM_HOME=/var/lib/arvados/gems
-export GEM_PATH=/var/lib/arvados/gems
+export GEM_HOME=/var/lib/gems
+export GEM_PATH=/var/lib/gems
 
 run_bundler() {
     if test -f Gemfile.lock ; then
diff --git a/arvbox/docker/service/api/run b/arvbox/docker/service/api/run
index d290420..5c80964 100755
--- a/arvbox/docker/service/api/run
+++ b/arvbox/docker/service/api/run
@@ -45,11 +45,17 @@ common:
   git_repo_https_base: "http://$localip:9001/"
 EOF
 
+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
+database_pw=$(cat /var/lib/arvados/api_database_pw)
+
 if ! test -f /var/lib/arvados/api_database_setup ; then
-   database_pw=$(ruby -e 'puts rand(2**128).to_s(36)')
    su postgres -c "psql -c \"create user arvados with password '$database_pw'\""
    su postgres -c "psql -c \"ALTER USER arvados CREATEDB;\""
-   cat >config/database.yml <<EOF
+fi
+
+cat >config/database.yml <<EOF
 development:
   adapter: postgresql
   encoding: utf8
@@ -67,6 +73,8 @@ test:
   host: localhost
   template: template0
 EOF
+
+if ! test -f /var/lib/arvados/api_database_setup ; then
    bundle exec rake db:setup
    touch /var/lib/arvados/api_database_setup
 fi
diff --git a/arvbox/docker/service/ready/run b/arvbox/docker/service/ready/run
index 2b117b9..0908f01 100755
--- a/arvbox/docker/service/ready/run
+++ b/arvbox/docker/service/ready/run
@@ -59,8 +59,24 @@ fi
 
 if ! [[ -z "$waiting" ]] ; then
     if ps x | grep -v grep | grep "bundle install" > /dev/null; then
-        waiting="$waiting (installing ruby gems)"
+        gemcount=$(ls /var/lib/gems/gems 2>/dev/null | wc -l)
+
+        gemlockcount=0
+        for l in /usr/src/arvados/services/api/Gemfile.lock \
+                     /usr/src/arvados/apps/workbench/Gemfile.lock \
+                     /usr/src/sso/Gemfile.lock ; do
+            gc=$(cat $l \
+                        | grep -vE "(GEM|PLATFORMS|DEPENDENCIES|$^|remote:|specs:)" \
+                        | sed 's/^ *//' | sed 's/(.*)//' | sed 's/ *$//' | sort | uniq | wc -l)
+            gemlockcount=$(($gemlockcount + $gc))
+        done
+        waiting="$waiting (installing ruby gems $gemcount/$gemlockcount)"
+    fi
+
+    if ps x | grep -v grep | grep "c++.*/var/lib/passenger" > /dev/null ; then
+        waiting="$waiting (compiling passenger)"
     fi
+
     if ps x | grep -v grep | grep "pip install" > /dev/null; then
         waiting="$waiting (installing python packages)"
     fi
diff --git a/arvbox/docker/service/sso/run b/arvbox/docker/service/sso/run
index 718c526..73f6df5 100755
--- a/arvbox/docker/service/sso/run
+++ b/arvbox/docker/service/sso/run
@@ -7,7 +7,7 @@ set -eux
 
 cd /usr/src/sso
 export RAILS_ENV=development
-export GEM_HOME=/var/lib/arvados/gems
+export GEM_HOME=/var/lib/gems
 
 run_bundler --without=development
 
@@ -33,11 +33,17 @@ common:
   allow_account_registration: true
 EOF
 
+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
+database_pw=$(cat /var/lib/arvados/sso_database_pw)
+
 if ! test -f /var/lib/arvados/sso_database_setup ; then
-   database_pw=$(ruby -e 'puts rand(2**128).to_s(36)')
-   su postgres -c "psql -c \"create user arvados_sso with password '$database_pw'\""
-   su postgres -c "psql -c \"ALTER USER arvados_sso CREATEDB;\""
-   cat >config/database.yml <<EOF
+    su postgres -c "psql -c \"create user arvados_sso with password '$database_pw'\""
+    su postgres -c "psql -c \"ALTER USER arvados_sso CREATEDB;\""
+fi
+
+cat >config/database.yml <<EOF
 development:
   adapter: postgresql
   encoding: utf8
@@ -55,6 +61,8 @@ test:
   host: localhost
   template: template0
 EOF
+
+if ! test -f /var/lib/arvados/sso_database_setup ; then
    bundle exec rake db:setup
 
    if ! test -s /var/lib/arvados/sso_app_secret ; then
diff --git a/arvbox/docker/service/workbench/run b/arvbox/docker/service/workbench/run
index ea7d242..1bbb5e7 100755
--- a/arvbox/docker/service/workbench/run
+++ b/arvbox/docker/service/workbench/run
@@ -7,7 +7,7 @@ set -eux
 
 cd /usr/src/arvados/apps/workbench
 export RAILS_ENV=development
-export GEM_HOME=/var/lib/arvados/gems
+export GEM_HOME=/var/lib/gems
 
 run_bundler --without=development
 
diff --git a/arvbox/docker/tests-service/docker/log/run b/arvbox/docker/tests-service/docker/log/run
new file mode 120000
index 0000000..f99cc1d
--- /dev/null
+++ b/arvbox/docker/tests-service/docker/log/run
@@ -0,0 +1 @@
+../../logger
\ No newline at end of file
diff --git a/arvbox/docker/tests-service/docker/run b/arvbox/docker/tests-service/docker/run
new file mode 100755
index 0000000..99540e6
--- /dev/null
+++ b/arvbox/docker/tests-service/docker/run
@@ -0,0 +1,95 @@
+#!/bin/bash
+
+# Taken from https://github.com/jpetazzo/dind
+
+exec 2>&1
+
+#!/bin/bash
+
+# Ensure that all nodes in /dev/mapper correspond to mapped devices currently loaded by the device-mapper kernel driver
+dmsetup mknodes
+
+# First, make sure that cgroups are mounted correctly.
+CGROUP=/sys/fs/cgroup
+: {LOG:=stdio}
+
+[ -d $CGROUP ] ||
+	mkdir $CGROUP
+
+mountpoint -q $CGROUP ||
+	mount -n -t tmpfs -o uid=0,gid=0,mode=0755 cgroup $CGROUP || {
+		echo "Could not make a tmpfs mount. Did you use --privileged?"
+		exit 1
+	}
+
+if [ -d /sys/kernel/security ] && ! mountpoint -q /sys/kernel/security
+then
+    mount -t securityfs none /sys/kernel/security || {
+        echo "Could not mount /sys/kernel/security."
+        echo "AppArmor detection and --privileged mode might break."
+    }
+fi
+
+# Mount the cgroup hierarchies exactly as they are in the parent system.
+for SUBSYS in $(cut -d: -f2 /proc/1/cgroup)
+do
+        [ -d $CGROUP/$SUBSYS ] || mkdir $CGROUP/$SUBSYS
+        mountpoint -q $CGROUP/$SUBSYS ||
+                mount -n -t cgroup -o $SUBSYS cgroup $CGROUP/$SUBSYS
+
+        # The two following sections address a bug which manifests itself
+        # by a cryptic "lxc-start: no ns_cgroup option specified" when
+        # trying to start containers withina container.
+        # The bug seems to appear when the cgroup hierarchies are not
+        # mounted on the exact same directories in the host, and in the
+        # container.
+
+        # Named, control-less cgroups are mounted with "-o name=foo"
+        # (and appear as such under /proc/<pid>/cgroup) but are usually
+        # mounted on a directory named "foo" (without the "name=" prefix).
+        # Systemd and OpenRC (and possibly others) both create such a
+        # cgroup. To avoid the aforementioned bug, we symlink "foo" to
+        # "name=foo". This shouldn't have any adverse effect.
+        echo $SUBSYS | grep -q ^name= && {
+                NAME=$(echo $SUBSYS | sed s/^name=//)
+                ln -s $SUBSYS $CGROUP/$NAME
+        }
+
+        # Likewise, on at least one system, it has been reported that
+        # systemd would mount the CPU and CPU accounting controllers
+        # (respectively "cpu" and "cpuacct") with "-o cpuacct,cpu"
+        # but on a directory called "cpu,cpuacct" (note the inversion
+        # in the order of the groups). This tries to work around it.
+        [ $SUBSYS = cpuacct,cpu ] && ln -s $SUBSYS $CGROUP/cpu,cpuacct
+done
+
+# Note: as I write those lines, the LXC userland tools cannot setup
+# a "sub-container" properly if the "devices" cgroup is not in its
+# own hierarchy. Let's detect this and issue a warning.
+grep -q :devices: /proc/1/cgroup ||
+	echo "WARNING: the 'devices' cgroup should be in its own hierarchy."
+grep -qw devices /proc/1/cgroup ||
+	echo "WARNING: it looks like the 'devices' cgroup is not mounted."
+
+# Now, close extraneous file descriptors.
+pushd /proc/self/fd >/dev/null
+for FD in *
+do
+	case "$FD" in
+	# Keep stdin/stdout/stderr
+	[012])
+		;;
+	# Nuke everything else
+	*)
+		eval exec "$FD>&-"
+		;;
+	esac
+done
+popd >/dev/null
+
+
+# If a pidfile is still around (for example after a container restart),
+# delete it so that docker can start.
+rm -rf /var/run/docker.pid
+
+exec docker daemon --storage-driver=overlay $DOCKER_DAEMON_ARGS
diff --git a/arvbox/docker/tests-service/logger b/arvbox/docker/tests-service/logger
new file mode 100755
index 0000000..a79a518
--- /dev/null
+++ b/arvbox/docker/tests-service/logger
@@ -0,0 +1,2 @@
+#!/bin/sh
+exec svlogd -tt ./main

commit 1f01b5bfd46cf5eb6ff06d84fd3515c9d8c5d6ef
Author: Peter Amstutz <peter.amstutz at curoverse.com>
Date:   Mon Jan 4 09:45:05 2016 -0500

    8080: Move arvados and arvados-dev checkouts to ~/.arvbox.

diff --git a/arvbox/arvbox b/arvbox/arvbox
index b0c1f52..ee8910c 100755
--- a/arvbox/arvbox
+++ b/arvbox/arvbox
@@ -2,33 +2,33 @@
 
 set -e
 
-ARVBOX=$(readlink -f $(dirname $0))
+ARVBOX_SCRIPT=$(readlink -f $(dirname $0))
 
-if test -z "$ARVADOS_ROOT" ; then
-    ARVADOS_ROOT=$ARVBOX/arvados
+if test -z "$ARVBOX_CONTAINER" ; then
+    ARVBOX_CONTAINER=arvbox
 fi
 
-if test -z "$ARVADOS_DEV_ROOT" ; then
-    ARVADOS_DEV_ROOT=$ARVBOX/arvados-dev
+if test -z "$ARVBOX_DATA" ; then
+    ARVBOX_DATA=$HOME/.arvbox/$ARVBOX_CONTAINER
 fi
 
-if test -z "$SSO_ROOT" ; then
-    SSO_ROOT=$ARVBOX/sso-devise-omniauth-provider
+if test -z "$ARVADOS_ROOT" ; then
+    ARVADOS_ROOT=$ARVBOX_DATA/arvados
 fi
 
-if test -z "$ARVBOX_CONTAINER" ; then
-    ARVBOX_CONTAINER=arvbox
+if test -z "$ARVADOS_DEV_ROOT" ; then
+    ARVADOS_DEV_ROOT=$ARVBOX_DATA/arvados-dev
 fi
 
-if test -z "$ARVBOX_DATA" ; then
-    ARVBOX_DATA=$HOME/.arvbox/$ARVBOX_CONTAINER
+if test -z "$SSO_ROOT" ; then
+    SSO_ROOT=$ARVBOX_DATA/sso-devise-omniauth-provider
 fi
 
 PASSENGER=$ARVBOX_DATA/passenger
 PG_DATA=$ARVBOX_DATA/postgres
-ARV_DATA=$ARVBOX_DATA/var
+VAR_DATA=$ARVBOX_DATA/var
 
-mkdir -p $PASSENGER $PG_DATA $ARV_DATA
+mkdir -p $PASSENGER $PG_DATA $VAR_DATA
 
 run() {
     if ! test -d $ARVADOS_ROOT ; then
@@ -47,7 +47,7 @@ run() {
                --volume=$ARVADOS_DEV_ROOT:/usr/src/arvados-dev:rw \
                --volume=$SSO_ROOT:/usr/src/sso:rw \
                --volume=$PG_DATA:/var/lib/postgresql:rw \
-               --volume=$ARV_DATA:/var/lib/arvados:rw \
+               --volume=$VAR_DATA:/var/lib/arvados:rw \
                --volume=$PASSENGER:/var/lib/passenger:rw \
                --volume=/var/lib/docker \
                arvados/arvbox \
@@ -60,7 +60,7 @@ run() {
                --volume=$ARVADOS_ROOT:/usr/src/arvados:rw \
                --volume=$SSO_ROOT:/usr/src/sso:rw \
                --volume=$PG_DATA:/var/lib/postgresql:rw \
-               --volume=$ARV_DATA:/var/lib/arvados:rw \
+               --volume=$VAR_DATA:/var/lib/arvados:rw \
                --volume=$PASSENGER:/var/lib/passenger:rw \
                --volume=/var/lib/docker \
                arvados/arvbox
@@ -87,7 +87,7 @@ stop() {
 
 case $1 in
     build)
-        cd $ARVBOX
+        cd $ARVBOX_SCRIPT
         docker build -t arvados/arvbox docker
         ;;
 
@@ -126,12 +126,11 @@ case $1 in
 
     reset)
         if test "$2" != -f ; then
-            echo "WARNING!  This will delete all data inside your arvbox ($PG_DATA and $ARV_DATA).  Use reset -f if you really mean it."
+            echo "WARNING!  This will delete all code and data inside your arvbox ($ARVBOX_DATA).  Use reset -f if you really mean it."
             exit 1
         fi
         stop
-        sudo rm -rf $PG_DATA
-        sudo rm -rf $ARV_DATA
+        sudo rm -rf $ARVBOX_DATA
         ;;
 
     log)

commit 05348254357bd32e126e7a7ee0e8cfc5bb87cc5f
Author: Peter Amstutz <peter.amstutz at curoverse.com>
Date:   Wed Dec 30 16:57:38 2015 -0500

    Use default docker driver with overlayfs as fallback.

diff --git a/arvbox/docker/service/docker/run b/arvbox/docker/service/docker/run
index 99540e6..93834ee 100755
--- a/arvbox/docker/service/docker/run
+++ b/arvbox/docker/service/docker/run
@@ -92,4 +92,9 @@ popd >/dev/null
 # delete it so that docker can start.
 rm -rf /var/run/docker.pid
 
-exec docker daemon --storage-driver=overlay $DOCKER_DAEMON_ARGS
+read pid cmd state ppid pgrp session tty_nr tpgid rest < /proc/self/stat
+trap "kill -TERM -$pgrp; exit" EXIT TERM KILL SIGKILL SIGTERM SIGQUIT
+
+if ! docker daemon $DOCKER_DAEMON_ARGS ; then
+    docker daemon --storage-driver=overlay $DOCKER_DAEMON_ARGS
+fi

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


hooks/post-receive
-- 




More information about the arvados-commits mailing list