-
Notifications
You must be signed in to change notification settings - Fork 9
/
install-dockerized
132 lines (120 loc) · 5.12 KB
/
install-dockerized
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
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
#!/bin/sh
if [ -z ${TAG} ]; then
export TAG="main"
fi
# Checks if given program is available in path
# $1: basename of program
check() {
echo "Check if "$1" is available"
if ! [ -x "$(command -v "$1")" ]; then
echo ""$1" is not installed" >&2
return 1
fi
return 0
}
echo
echo "==============================================================================="
echo " Dockerized OpenTOSCA Environment"
echo " Version: $TAG"
echo "==============================================================================="
echo
echo " Haftungsausschluss
------------------
Dies ist ein Forschungsprototyp. Die Haftung für entgangenen Gewinn,
Produktionsausfall, Betriebsunterbrechung, entgangene Nutzungen, Verlust von
Daten und Informationen, Finanzierungsaufwendungen sowie sonstige Vermögens-
und Folgeschäden ist, außer in Fällen von grober Fahrlässigkeit, Vorsatz und
Personenschäden ausgeschlossen.
Disclaimer of Warranty
----------------------
Unless required by applicable law or agreed to in writing, Licensor provides
the Work (and each Contributor provides its Contributions) on an "AS IS"
BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied,
including, without limitation, any warranties or conditions of TITLE,
NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A PARTICULAR PURPOSE. You
are solely responsible for determining the appropriateness of using or
redistributing the Work and assume any risks associated with Your exercise of
permissions under this License."
echo
echo "==============================================================================="
echo
if check docker; then
echo "Docker is already installed"
else
echo "Installing Docker..."
sudo apt-get -qq update
sudo apt-get -qq -y install apt-transport-https ca-certificates curl software-properties-common
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -
sudo add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable"
sudo apt-get -qq update
sudo apt-get -qq -y install docker-ce
sudo groupadd docker
sudo usermod -aG docker $USER
sudo systemctl enable docker
sudo sed -ie "s/ExecStart=\/usr\/bin\/dockerd -H fd:\/\/$/ExecStart=\/usr\/bin\/dockerd -H fd:\/\/ -H tcp:\/\/0.0.0.0:2375/g" /lib/systemd/system/docker.service
sudo systemctl daemon-reload
sudo systemctl restart docker
fi
if check docker-compose; then
echo "Docker Compose is already installed"
else
echo "Installing Docker Compose..."
sudo curl -L https://github.com/docker/compose/releases/download/1.21.1/docker-compose-`uname -s`-`uname -m` -o /usr/local/bin/docker-compose
sudo chmod +x /usr/local/bin/docker-compose
fi
# Determine IP address
echo "Determine external hostname..."
if [ -z "$IP_ADDRESS" ]; then
IP_ADDRESS=`curl -s http://169.254.169.254/latest/meta-data/public-ipv4`
if [ -z "$IP_ADDRESS" ]; then
IP_ADDRESS=`curl -s ifconfig.co`;
fi
fi
echo "External hostname: $IP_ADDRESS"
echo "Prepare environment..."
curl -s https://packagecloud.io/install/repositories/github/git-lfs/script.deb.sh | sudo bash
sudo apt-get -qq update
sudo apt-get -qq -y install wget unzip git git-lfs
sudo -u $USER git lfs install
sudo rm -rf /var/opentosca
sudo mkdir -p /var/opentosca/portainer
sudo mkdir -p /var/opentosca/container/data
sudo mkdir -p /var/opentosca/container/repository
sudo mkdir -p /var/opentosca/winery
sudo git clone --depth=1 https://github.com/OpenTOSCA/tosca-definitions-public.git /var/opentosca/winery/repository
sudo chown -R $USER:$USER /var/opentosca
echo "Downloading OpenTOSCA Docker setup..."
sudo rm -rf /opt/opentosca
sudo git clone -b $TAG https://github.com/OpenTOSCA/opentosca-docker.git /opt/opentosca
echo "Configuring Docker environment..."
sudo sed -e "s/PUBLIC_HOSTNAME=.*/PUBLIC_HOSTNAME=$IP_ADDRESS/g" /opt/opentosca/_.env > /opt/opentosca/.env
sudo sh -c "echo $IP_ADDRESS container >> /etc/hosts"
sudo sh -c "echo $IP_ADDRESS container-repository >> /etc/hosts"
sudo sh -c "echo $IP_ADDRESS ui >> /etc/hosts"
sudo sh -c "echo $IP_ADDRESS engine-plan >> /etc/hosts"
sudo sh -c "echo $IP_ADDRESS engine-ia >> /etc/hosts"
sudo sh -c "echo $IP_ADDRESS winery >> /etc/hosts"
sudo sh -c "echo $IP_ADDRESS portainer >> /etc/hosts"
sudo chown -R $USER:$USER /opt/opentosca
echo "Starting OpenTOSCA..."
cd /opt/opentosca
sudo docker-compose --project-directory /opt/opentosca \
-f /opt/opentosca/docker-compose.yml \
-f /opt/opentosca/docker-compose.prod.yml \
pull
sudo docker-compose --project-directory /opt/opentosca \
-f /opt/opentosca/docker-compose.yml \
-f /opt/opentosca/docker-compose.prod.yml \
up -d
cd -
echo
echo "Startup will be finished in background..."
echo
echo "OpenTOSCA UI: http://$IP_ADDRESS:8088"
echo "OpenTOSCA Modelling: http://$IP_ADDRESS:8080"
echo "OpenTOSCA Container API: http://$IP_ADDRESS:1337"
echo "OpenTOSCA Container Repository: http://$IP_ADDRESS:8081"
echo "Plan Engine (Apache ODE): http://$IP_ADDRESS:9763/ode"
echo "IA Engine (Apache Tomcat): http://$IP_ADDRESS:8090/manager (user: admin, password: admin)"
echo "Docker Management UI: http://$IP_ADDRESS:9000"
echo