8936: update blob-signing-ttl related documentation.
[arvados.git] / docker / api / setup.sh.in
1 #!/bin/bash
2
3 set -x
4
5 if test -f /root/finished_arvados_setup ; then
6    exit
7 fi
8
9 . /etc/profile.d/rvm.sh
10
11 export ARVADOS_API_HOST=api
12 export ARVADOS_API_HOST_INSECURE=yes
13 export ARVADOS_API_TOKEN=@@API_SUPERUSER_SECRET@@
14 export HOME=/root
15
16 # Wait for API server to come up.
17 while ! arv user current ; do sleep 1 ; done
18
19 # Arvados repository object
20 all_users_group_uuid="@@API_HOSTNAME@@-j7d0g-fffffffffffffff"
21
22 arv user update --uuid @@API_HOSTNAME@@-tpzed-000000000000000 --user '{"username":"root"}'
23 repo_uuid=`arv --format=uuid repository create --repository '{"owner_uuid":"@@API_HOSTNAME@@-tpzed-000000000000000", "name":"arvados"}'`
24 echo "Arvados repository uuid is $repo_uuid"
25
26 read -rd $'\000' newlink <<EOF; arv link create --link "$newlink"
27 {
28  "tail_uuid":"$all_users_group_uuid",
29  "head_uuid":"$repo_uuid",
30  "link_class":"permission",
31  "name":"can_read"
32 }
33 EOF
34
35 # Make sure the necessary keep_service objects exist
36 arv keep_service list > /tmp/keep_service.list
37
38 grep -q keep_server_0 /tmp/keep_service.list
39 if [[ "$?" != "0" ]]; then
40   arv keep_service create --keep-service "$(cat /root/keep_server_0.json)"
41 fi
42
43 grep -q keep_server_1 /tmp/keep_service.list
44 if [[ "$?" != "0" ]]; then
45   arv keep_service create --keep-service "$(cat /root/keep_server_1.json)"
46 fi
47
48 grep -q keep_proxy /tmp/keep_service.list
49 if [[ "$?" != "0" ]]; then
50   arv keep_service create --keep-service "$(cat /root/keep_proxy.json)"
51 fi
52
53 # User repository object
54 # user_uuid=`arv --format=uuid user current`
55 # 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"}'`
56
57 # echo "User repository uuid is $repo_uuid"
58
59 # read -rd $'\000' newlink <<EOF; arv link create --link "$newlink"
60 # {
61 #  "tail_uuid":"$user_uuid",
62 #  "head_uuid":"$repo_uuid",
63 #  "link_class":"permission",
64 #  "name":"can_write"
65 # }
66 # EOF
67
68 # # Shell machine object
69 shell_uuid=`arv --format=uuid virtual_machine create --virtual-machine '{"hostname":"shell"}'`
70 arv virtual_machine create --virtual-machine '{"hostname":"shell.dev", "uuid": "@@API_HOSTNAME@@-2x53u-csbtkecoa669vkz"}'
71
72 # read -rd $'\000' newlink <<EOF; arv link create --link "$newlink"
73 # {
74 #  "tail_uuid":"$user_uuid",
75 #  "head_uuid":"$shell_uuid",
76 #  "link_class":"permission",
77 #  "name":"can_login",
78 #  "properties": {"username": "@@ARVADOS_USER_NAME@@"}
79 # }
80 # EOF
81
82 touch /root/finished_arvados_setup