Merge branch 'master' into 5493-getting-started-modal
[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 export HOME=/root
9
10 # Wait for API server to come up.
11 while ! arv user current ; do sleep 1 ; done
12
13 if ! test -f /root/node.json ; then
14     arv node create --node "{\"hostname\": \"$(hostname)\"}" > /root/node.json
15
16     # Make sure /dev/fuse permissions are correct (the device appears after fuse is loaded)
17     chmod 1660 /dev/fuse && chgrp fuse /dev/fuse
18 fi
19
20 UUID=`grep \"uuid\" /root/node.json  |cut -f4 -d\"`
21 PING_SECRET=`grep \"ping_secret\" /root/node.json  |cut -f4 -d\"`
22
23 if ! test -f /etc/cron.d/node_ping ; then
24     echo "*/5 * * * * root /usr/bin/curl -k -d ping_secret=$PING_SECRET https://api/arvados/v1/nodes/$UUID/ping" > /etc/cron.d/node_ping
25 fi
26
27 /usr/bin/curl -k -d ping_secret=$PING_SECRET https://api/arvados/v1/nodes/$UUID/ping?ping_secret=$PING_SECRET