[ARVADOS-DEV] updated: d42510f7df41351c540f7caa991720e7293ae669

git at public.curoverse.com git at public.curoverse.com
Wed Jan 13 13:05:28 EST 2016


Summary of changes:
 arvbox/bin/arvbox                                     |  2 +-
 arvbox/lib/arvbox/docker/service/api/run-service      | 11 +++++++++++
 arvbox/lib/arvbox/docker/service/docker/run           |  5 +++++
 arvbox/lib/arvbox/docker/service/gitolite/run-service |  9 ++++++++-
 arvbox/lib/arvbox/docker/service/ready/run-service    | 16 ++++++++++++++++
 arvbox/lib/arvbox/docker/service/vm/run-service       | 10 ++++------
 6 files changed, 45 insertions(+), 8 deletions(-)

       via  d42510f7df41351c540f7caa991720e7293ae669 (commit)
      from  9e77eee58a6b6d4470b405dcf9d285c452e278eb (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 d42510f7df41351c540f7caa991720e7293ae669
Author: Peter Amstutz <peter.amstutz at curoverse.com>
Date:   Wed Jan 13 13:05:26 2016 -0500

    8080: Automatically set up new users with VM and git repo.

diff --git a/arvbox/bin/arvbox b/arvbox/bin/arvbox
index f6aa0bc..d1d1bb2 100755
--- a/arvbox/bin/arvbox
+++ b/arvbox/bin/arvbox
@@ -160,7 +160,7 @@ run() {
             done < $FF
             rm $FF
             echo
-            echo "export ARVADOS_API_HOST="
+            echo "export ARVADOS_API_HOST=$(getip):8000"
             echo "The Arvados source code is checked out at: $ARVADOS_ROOT"
         fi
     fi
diff --git a/arvbox/lib/arvbox/docker/service/api/run-service b/arvbox/lib/arvbox/docker/service/api/run-service
index 508c411..aa41f6b 100755
--- a/arvbox/lib/arvbox/docker/service/api/run-service
+++ b/arvbox/lib/arvbox/docker/service/api/run-service
@@ -37,6 +37,13 @@ test -s /var/lib/arvados/self-signed.key
 
 sso_app_secret=$(cat /var/lib/arvados/sso_app_secret)
 
+if test -s /var/lib/arvados/vm-uuid ; then
+    vm_uuid=$(cat /var/lib/arvados/vm-uuid)
+else
+    vm_uuid=$uuid_prefix-2x53u-$(ruby -e 'puts rand(2**400).to_s(36)[0,15]')
+    echo $vm_uuid > /var/lib/arvados/vm-uuid
+fi
+
 cat >config/application.yml <<EOF
 development:
   uuid_prefix: $uuid_prefix
@@ -49,7 +56,11 @@ development:
   workbench_address: "http://$localip/"
   git_repo_ssh_base: "git@$localip:"
   git_repo_https_base: "http://$localip:${services[arv-git-httpd]}/"
+  new_users_are_active: true
   auto_admin_first_user: true
+  auto_setup_new_users: true
+  auto_setup_new_users_with_vm_uuid: $vm_uuid
+  auto_setup_new_users_with_repository: true
 EOF
 
 if ! test -f /var/lib/arvados/api_database_pw ; then
diff --git a/arvbox/lib/arvbox/docker/service/docker/run b/arvbox/lib/arvbox/docker/service/docker/run
index 64fcc75..67bd58f 100755
--- a/arvbox/lib/arvbox/docker/service/docker/run
+++ b/arvbox/lib/arvbox/docker/service/docker/run
@@ -22,6 +22,11 @@ for CGROUP in /sys/fs/cgroup /cgroup ; do
     fi
 done
 
+if ! mountpoint -q $CGROUP ; then
+    echo "Could not find or mount cgroups. Tried /sys/fs/cgroup and /cgroup.  Did you use --privileged?"
+    exit 1
+fi
+
 if [ -d /sys/kernel/security ] && ! mountpoint -q /sys/kernel/security
 then
     mount -t securityfs none /sys/kernel/security || {
diff --git a/arvbox/lib/arvbox/docker/service/gitolite/run-service b/arvbox/lib/arvbox/docker/service/gitolite/run-service
index 2e5f1e9..8e6cb0e 100755
--- a/arvbox/lib/arvbox/docker/service/gitolite/run-service
+++ b/arvbox/lib/arvbox/docker/service/gitolite/run-service
@@ -33,8 +33,11 @@ fi
 if ! test -f /var/lib/arvados/gitolite-setup ; then
     cd ~git
 
+    # Do a no-op login to populate known_hosts
+    # with the hostkey, so it won't try to ask
+    # about it later.
     cp .ssh/id_rsa.pub .ssh/authorized_keys
-    ssh -o stricthostkeychecking=no git at localhost
+    ssh -o stricthostkeychecking=no git at localhost true
     rm .ssh/authorized_keys
 
     cp -r /usr/local/lib/arvbox/gitolite.rc .
@@ -53,6 +56,10 @@ if ! test -f /var/lib/arvados/gitolite-setup ; then
 
     touch /var/lib/arvados/gitolite-setup
 else
+    # Do a no-op login to populate known_hosts
+    # with the hostkey, so it won't try to ask
+    # about it later.  Don't run anything,
+    # get the default gitolite behavior.
     ssh -o stricthostkeychecking=no git at localhost
 fi
 
diff --git a/arvbox/lib/arvbox/docker/service/ready/run-service b/arvbox/lib/arvbox/docker/service/ready/run-service
index 52c0adc..c027360 100755
--- a/arvbox/lib/arvbox/docker/service/ready/run-service
+++ b/arvbox/lib/arvbox/docker/service/ready/run-service
@@ -44,6 +44,22 @@ if ! (ps x | grep -v grep | grep "crunch-dispatch") > /dev/null ; then
     waiting="$waiting crunch-dispatch"
 fi
 
+export ARVADOS_API_HOST=$localip:${services[api]}
+export ARVADOS_API_HOST_INSECURE=1
+
+vm_ok=0
+if test -s /var/lib/arvados/vm-uuid -a -s /var/lib/arvados/superuser_token; then
+    vm_uuid=$(cat /var/lib/arvados/vm-uuid)
+    export ARVADOS_API_TOKEN=$(cat /var/lib/arvados/superuser_token)
+    if (which arv && arv virtual_machine get --uuid $vm_uuid) >/dev/null 2>/dev/null ; then
+        vm_ok=1
+    fi
+fi
+
+if test $vm_ok = 0 ; then
+    waiting="$waiting vm"
+fi
+
 if ! [[ -z "$waiting" ]] ; then
     if ps x | grep -v grep | grep "bundle install" > /dev/null; then
         gemcount=$(ls /var/lib/gems/ruby/2.1.0/gems 2>/dev/null | wc -l)
diff --git a/arvbox/lib/arvbox/docker/service/vm/run-service b/arvbox/lib/arvbox/docker/service/vm/run-service
index a845e44..5bb6825 100755
--- a/arvbox/lib/arvbox/docker/service/vm/run-service
+++ b/arvbox/lib/arvbox/docker/service/vm/run-service
@@ -18,25 +18,23 @@ set -u
 export ARVADOS_API_HOST=$localip:${services[api]}
 export ARVADOS_API_HOST_INSECURE=1
 export ARVADOS_API_TOKEN=$(cat /var/lib/arvados/superuser_token)
+export ARVADOS_VIRTUAL_MACHINE_UUID=$(cat /var/lib/arvados/vm-uuid)
 
 set +e
 read -rd $'\000' vm <<EOF
 {
+ "uuid": "$ARVADOS_VIRTUAL_MACHINE_UUID",
  "hostname":"$localip"
 }
 EOF
 set -e
 
-if test -s /var/lib/arvados/vm-uuid ; then
-    ARVADOS_VIRTUAL_MACHINE_UUID=$(cat /var/lib/arvados/vm-uuid)
+if arv virtual_machine get --uuid $ARVADOS_VIRTUAL_MACHINE_UUID ; then
     arv virtual_machine update --uuid $ARVADOS_VIRTUAL_MACHINE_UUID --virtual-machine "$vm"
 else
-    ARVADOS_VIRTUAL_MACHINE_UUID=$(arv --format=uuid virtual_machine create --virtual-machine "$vm")
-    echo $ARVADOS_VIRTUAL_MACHINE_UUID > /var/lib/arvados/vm-uuid
+    arv virtual_machine create --virtual-machine "$vm"
 fi
 
-export ARVADOS_VIRTUAL_MACHINE_UUID
-
 while true ; do
       bundle exec arvados-login-sync
       sleep 120

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


hooks/post-receive
-- 




More information about the arvados-commits mailing list