Blame view
deploy.sh
1.77 KB
a7065b1b3 Add deploy and de... |
1 |
#!/bin/sh |
bb68d7fdb Dump all containe... |
2 3 4 |
dump_logs() { CONTAINERS="suricata elasticsearch logstash kibana webserver composer_api od mltd mqtt timescaledb grafana" for CONTAINER in $CONTAINERS; do |
83d192a8b Mark end of logs too |
5 |
echo "*** Logs for kea_$CONTAINER (start) ***" |
bb68d7fdb Dump all containe... |
6 |
docker logs kea_$CONTAINER |
83d192a8b Mark end of logs too |
7 |
echo "*** Logs for kea_$CONTAINER (end) ***" |
bb68d7fdb Dump all containe... |
8 9 |
done } |
a7065b1b3 Add deploy and de... |
10 11 12 13 14 15 16 17 18 19 |
# Login into the CUREX registry docker login https://registry.curex-project.eu:443/artifactory/curex-local/ # pull all containers docker-compose -f docker-compose-jfrog.yml pull sleep 1 # Prepare installation cd api |
41c17fd87 Fix filename |
20 |
cp .env.example .env |
a7065b1b3 Add deploy and de... |
21 22 23 24 |
docker run --rm -v $(pwd):/app \ registry.curex-project.eu:443/curex-local/kea_composer:2.0.7 \ install cd .. |
3f6bad8ff Run create_volume... |
25 |
sh ./create_volumes.sh |
a7065b1b3 Add deploy and de... |
26 |
|
1898c47f2 Loop until all al... |
27 28 |
# Keep the timestamp of when starting up containers TIME_START=`date +%s` |
a7065b1b3 Add deploy and de... |
29 30 |
# Run containers docker-compose -f docker-compose-jfrog.yml up --detach |
1898c47f2 Loop until all al... |
31 32 |
# loop until all containers are up |
942cf4e44 Fix loop |
33 |
while true; do |
1898c47f2 Loop until all al... |
34 35 36 37 38 39 40 41 |
# if any container other than composer has exited, bail out res=`docker ps -a | \ grep "/curex-local/kea_" | \ grep -v "kea_composer" | \ grep "Exited" | \ wc -l` if [ $res -gt 0 ]; then echo "ERROR: Some containers have exited." |
24c412072 Show header line |
42 |
docker ps -a | grep "^CONTAINER\|/curex-local/kea_" |
bb68d7fdb Dump all containe... |
43 |
dump_logs |
1898c47f2 Loop until all al... |
44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 |
exit 1 fi # count containers that are up res=`docker ps -a | \ grep "/curex-local/kea_" | \ grep -v "kea_composer" | \ grep "Up" | \ wc -l` if [ $res -eq 11 ]; then break fi # only wait for 10 mins until everything is up. It should be more than # enough. TIME_NOW=`date +%s` if [ $((TIME_NOW - TIME_START)) -ge 600 ]; then echo "ERROR: Timeout exceeded." |
bb68d7fdb Dump all containe... |
60 |
dump_logs |
1898c47f2 Loop until all al... |
61 62 63 64 65 66 67 |
exit 2 fi sleep 1 done # Wait a bit more sleep 10 |
a7065b1b3 Add deploy and de... |
68 69 |
# create and populate the database |
64ac3cad4 Specify filename ... |
70 |
docker-compose -f docker-compose-jfrog.yml exec api php artisan migrate:fresh --seed --force |
a7065b1b3 Add deploy and de... |
71 |