aboutsummaryrefslogtreecommitdiffstats
path: root/moon_forming/run.sh
blob: 6cf90f56bc8826b2dab58d19702863b8878168d6 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
#!/usr/bin/env bash

populate_args=$*

echo "Waiting for Consul (http://consul:8500)"
while ! python -c "import requests; req = requests.get('http://consul:8500')" 2>/dev/null ; do
    sleep 5 ;
    echo -n "."
done
echo "."
echo "Consul (http://consul:8500) is up."

python3 /root/conf2consul.py /etc/moon/moon.conf

echo "Waiting for DB (tcp://db:3306)"
while ! python -c "import socket, sys; s = socket.socket(socket.AF_INET, socket.SOCK_STREAM); s.connect(('db', 3306)); sys.exit(0)" 2>/dev/null ; do
    sleep 5 ;
    echo -n "."
done
echo "."
echo "Database (http://db:3306) is up."

moon_db_manager upgrade

echo "Waiting for Keystone (http://keystone:5000)"
while ! python -c "import requests; req = requests.get('http://keystone:5000')" 2>/dev/null ; do
    sleep 5 ;
    echo -n "."
done
echo "."
echo "Keystone (http://keystone:5000) is up."

echo "Waiting for Manager (http://manager:8082)"
while ! python -c "import requests; req = requests.get('http://manager:8082')" 2>/dev/null ; do
    sleep 5 ;
    echo -n "."
done
echo "."
echo "Manager (http://manager:8082) is up."

for i in /data/*.py ; do
    moon_populate_values $populate_args --consul-host=consul --consul-port=8500 $i
done