]> git.somenet.org - pub/jan/aic18.git/blob - provision.sh
GITOLITE.txt
[pub/jan/aic18.git] / provision.sh
1 #!/bin/bash
2
3 cd /vagrant
4
5
6 ##################################################
7 # Fix default gateway on publically reachable VM #
8 ##################################################
9 if [ -f /vagrant/.online ]; then
10     echo "ONLINE-provisioning detected. Fixing network."
11     ip route del default
12     ip route add default via 10.11.0.254 dev eth1
13 fi
14
15
16 ###############################
17 # Get Docker + Docker-Compose #
18 ###############################
19 # Check for updates only once per boot.
20 dpkg-query -W docker-ce docker-compose &>/dev/null || rm -f /tmp/apt_run_this_boot
21
22 if [ ! -f /tmp/apt_run_this_boot ]; then
23     apt-get update
24     apt-get install -y -q apt-transport-https vim
25
26     wget -q "https://download.docker.com/linux/debian/gpg" -O - | apt-key add
27     echo "deb https://download.docker.com/linux/debian stretch stable" > /etc/apt/sources.list.d/docker_com.list
28
29     apt-get update
30     apt-get install -y -q docker-ce docker-compose
31
32     date -Isec > /tmp/apt_run_this_boot
33 fi
34
35 #############################
36 # remove running containers #
37 #############################
38 docker rm -f $(docker ps -aq) 2>/dev/null
39
40 ###################
41 # (re)compose all #
42 ###################
43 docker-compose -f g6t4.yml up --build -d
44
45 ###########
46 # cleanup #
47 ###########
48 docker system prune --volumes -f
49
50 #####################
51 # provision camunda #
52 #####################
53 cd /vagrant/camunda-overlay
54 echo "*** camunda.py ***"
55 ./camunda.py