-
Notifications
You must be signed in to change notification settings - Fork 15
/
Copy pathsetup
executable file
·132 lines (92 loc) · 3.71 KB
/
setup
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/bash
clear
mkdir ~/Nameles/
# getting the user choice for type of installation
echo -e " "
echo -e " +---------------------------------+"
echo -e " | Welcome to Nameles Installation |"
echo -e " +---------------------------------+"
echo -e
read -p " INSTALLATION MODE: 'single' or 'multi' : " CHOICE
case $CHOICE in
[single]* ) echo -e "\n Deploying single-system \n"; MODE=(single);;
[multi]* ) echo -e "\n Deploying single-system \n"; MODE=(multi);;
* ) echo "You did not make an accepted choice";;
esac
# get the docker compose file for single
if [ "$MODE" == single ]; then
wget https://raw.githubusercontent.com/Nameles-Org/Nameles/master/docker-compose.yml
mv docker-compose.yml ~/Nameles/nameles-docker-compose.yml
fi
# get the docker compose file for multi
if [ "$MODE" == multi ]; then
wget https://raw.githubusercontent.com/Nameles-Org/data-processing-module/master/docker-compose.yml
mv docker-compose.yml ~/Nameles/data-docker-compose.yml
wget https://raw.githubusercontent.com/Nameles-Org/scoring-module/master/docker-compose.yml
mv docker-compose.yml ~/Nameles/scoring-docker-compose.yml
wget https://raw.githubusercontent.com/Nameles-Org/dsp-emulator/master/docker-compose.yml
mv docker-compose.yml ~/Nameles/emulator-docker-compose.yml
fi
clear
echo " "
# getting the user choice for type of installation
read -p " REMOVING OLD VERSION OF DOCKER: This is recommended, are you ok with it (y/n)? : " yn
case $yn in
[Yy]* ) sudo apt-get -qq remove docker docker-engine docker.io -y;;
[Nn]* ) echo "Ok, we're keeping your current docker version. Let's see how it goes.";;
* ) echo "Please choose Yy or Nn";;
esac
clear
echo ""
echo -e "Starting installation, please wait. This should be over in a few minutes."
echo " "
# update packages
sudo apt-get -qq update -y
# install linux-extra-image-*
sudo apt-get install linux-image-extra-$(uname -r) -y
sudo apt-get install linux-image-extra-virtual -y
# update packages
sudo apt-get -qq update -y
# install dependencies
sudo apt-get -qq install apt-transport-https -y
sudo apt-get -qq install ca-certificates -y
sudo apt-get -qq install curl -y
sudo apt-get -qq install software-properties-common -y
# add the docker GPG key
curl -fsSL https://download.docker.com/linux/$(. /etc/os-release; echo "$ID")/gpg | sudo apt-key add -
# test the key fingerprint
sudo apt-key fingerprint 0EBFCD88
# add the repository / package
sudo add-apt-repository \
"deb [arch=amd64] https://download.docker.com/linux/$(. /etc/os-release; echo "$ID") \
$(lsb_release -cs) \
stable"
# update packages
sudo apt-get -qq update -y
# and (finally) the actual install
sudo apt-get -qq install docker-ce -y
# download the latest version of docker-compose
sudo curl -L https://github.com/docker/compose/releases/download/1.16.1/docker-compose-`uname -s`-`uname -m` -o /usr/local/bin/docker-compose
# change the permissions
sudo chmod +x /usr/local/bin/docker-compose
# add current user to the docker group
sudo usermod -aG docker $USER
# test that docker works ok
docker run hello-world > docker.temp
head -3 docker.temp
rm docker.temp
# verify the docker-compose version
docker-compose --version
# install psql
sudo apt-get -qq install postgresql-client -y
# execute compose
if [ "$MODE" == single ]; then
sudo docker-compose -f ~/Nameles/nameles-docker-compose.yml up
fi
if [ "$MODE" == multi ]; then
nohup sudo docker-compose -f ./data-processing-module/docker-compose.yml up >> data.out 2>> data.err &
sleep 30
nohup sudo docker-compose -f ./scoring-module/docker-compose.yml up >> scoring.out 2>> scoring.err &
sleep 5
nohup sudo docker-compose -f ./dsp-emulator/docker-compose.yml up >> dsp.out 2>> dsp.err &
fi