4752: Fix failing setup by polling for API server to come up.
[arvados.git] / docker / compute / setup.sh.in
1 #!/bin/bash
2
3 . /etc/profile.d/rvm.sh
4
5 export ARVADOS_API_HOST=api
6 export ARVADOS_API_HOST_INSECURE=yes
7 export ARVADOS_API_TOKEN=@@API_SUPERUSER_SECRET@@
8
9 # Wait for API server to come up.
10 while ! arv user current ; do sleep 1 ; done
11
12 arv node create --node {} > /tmp/node.json
13
14 UUID=`grep \"uuid\" /tmp//node.json  |cut -f4 -d\"`
15 PING_SECRET=`grep \"ping_secret\" /tmp//node.json  |cut -f4 -d\"`
16
17 echo "*/5 * * * * root /usr/bin/curl -k -d ping_secret=$PING_SECRET https://api/arvados/v1/nodes/$UUID/ping" > /etc/cron.d/node_ping
18
19 # Send a ping now
20 /usr/bin/curl -k -d ping_secret=$PING_SECRET https://api/arvados/v1/nodes/$UUID/ping?ping_secret=$PING_SECRET
21
22 # Just make sure /dev/fuse permissions are correct (the device appears after fuse is loaded)
23 chmod 1660 /dev/fuse && chgrp fuse /dev/fuse