4752: Fix failing setup by polling for API server to come up.
authorPeter Amstutz <peter.amstutz@curoverse.com>
Wed, 1 Apr 2015 16:08:35 +0000 (12:08 -0400)
committerPeter Amstutz <peter.amstutz@curoverse.com>
Wed, 1 Apr 2015 16:08:35 +0000 (12:08 -0400)
docker/api/application.yml.in
docker/api/setup.sh.in
docker/compute/setup.sh.in

index c6ee58afc52aa708f0f95363543e3cc6aae5d490..84dc0c3be65cdb8a136fbf42078a912b765e1665 100644 (file)
@@ -56,6 +56,10 @@ production:
 
   auto_admin_first_user: true
 
+  auto_setup_new_users_with_repository: true
+
+  auto_setup_new_users_with_vm_uuid: @@API_HOSTNAME@@-2x53u-csbtkecoa669vkz
+
 test:
   uuid_prefix: zzzzz
   secret_token: <%= rand(2**512).to_s(36) %>
index af9d54d8fd3e9f69ec4ccba59076bba63cf30b34..98bd3bdc39c5d0cbba3d70d53a059a3d8a964a9d 100755 (executable)
@@ -2,14 +2,22 @@
 
 set -x
 
+if test -f /root/finished_arvados_setup ; then
+   exit
+fi
+
 . /etc/profile.d/rvm.sh
 
 export ARVADOS_API_HOST=api
 export ARVADOS_API_HOST_INSECURE=yes
 export ARVADOS_API_TOKEN=@@API_SUPERUSER_SECRET@@
+export HOME=/root
+
+# Wait for API server to come up.
+while ! arv user current ; do sleep 1 ; done
 
 # Arvados repository object
-all_users_group_uuid="$prefix-j7d0g-fffffffffffffff"
+all_users_group_uuid="@@API_HOSTNAME@@-j7d0g-fffffffffffffff"
 repo_uuid=`arv --format=uuid repository create --repository '{"name":"arvados","fetch_url":"git@api.dev.arvados:arvados.git","push_url":"git@api.dev.arvados:arvados.git"}'`
 echo "Arvados repository uuid is $repo_uuid"
 
@@ -41,18 +49,32 @@ if [[ "$?" != "0" ]]; then
 fi
 
 # User repository object
-user_uuid=`arv --format=uuid user current`
-repo_uuid=`arv --format=uuid repository create --repository '{"name":"@@ARVADOS_USER_NAME@@","fetch_url":"git@api.dev.arvados:@@ARVADOS_USER_NAME@@.git","push_url":"git@api.dev.arvados:@@ARVADOS_USER_NAME@@.git"}'`
-echo "User repository uuid is $repo_uuid"
+# user_uuid=`arv --format=uuid user current`
+# repo_uuid=`arv --format=uuid repository create --repository '{"name":"@@ARVADOS_USER_NAME@@","fetch_url":"git@api.dev.arvados:@@ARVADOS_USER_NAME@@.git","push_url":"git@api.dev.arvados:@@ARVADOS_USER_NAME@@.git"}'`
 
-read -rd $'\000' newlink <<EOF; arv link create --link "$newlink"
-{
- "tail_uuid":"$user_uuid",
- "head_uuid":"$repo_uuid",
- "link_class":"permission",
- "name":"can_write"
-}
-EOF
+# echo "User repository uuid is $repo_uuid"
+
+# read -rd $'\000' newlink <<EOF; arv link create --link "$newlink"
+# {
+#  "tail_uuid":"$user_uuid",
+#  "head_uuid":"$repo_uuid",
+#  "link_class":"permission",
+#  "name":"can_write"
+# }
+# EOF
+
+# # Shell machine object
+shell_uuid=`arv --format=uuid virtual_machine create --virtual-machine '{"hostname":"shell"}'`
+arv virtual_machine create --virtual-machine '{"hostname":"shell.dev", "uuid": "@@API_HOSTNAME@@-2x53u-csbtkecoa669vkz"}'
+
+# read -rd $'\000' newlink <<EOF; arv link create --link "$newlink"
+# {
+#  "tail_uuid":"$user_uuid",
+#  "head_uuid":"$shell_uuid",
+#  "link_class":"permission",
+#  "name":"can_login",
+#  "properties": {"username": "@@ARVADOS_USER_NAME@@"}
+# }
+# EOF
 
-# Shell machine object
-arv virtual_machine create --virtual-machine '{"hostname":"shell"}'
+touch /root/finished_arvados_setup
index e107d80bdd7debd2ecd945d2fffdbe954e8a0ea9..6a4e95160a5493d7512824c46d5d19d48cff65a2 100755 (executable)
@@ -6,6 +6,9 @@ export ARVADOS_API_HOST=api
 export ARVADOS_API_HOST_INSECURE=yes
 export ARVADOS_API_TOKEN=@@API_SUPERUSER_SECRET@@
 
+# Wait for API server to come up.
+while ! arv user current ; do sleep 1 ; done
+
 arv node create --node {} > /tmp/node.json
 
 UUID=`grep \"uuid\" /tmp//node.json  |cut -f4 -d\"`