forked from man-group/pytest-plugins
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathinstall.sh
221 lines (174 loc) · 5.88 KB
/
install.sh
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
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
#!/bin/bash
set -eo pipefail
# Suppress the "dpkg-preconfigure: unable to re-open stdin: No such file or directory" error
export DEBIAN_FRONTEND=noninteractive
function install_base_tools {
apt-get update
apt-get install -y \
build-essential \
default-jdk \
curl \
wget \
git \
unzip
}
function install_python_ppa {
apt-get install -y software-properties-common
add-apt-repository -y ppa:deadsnakes/ppa
apt-get update
}
function install_python_packaging {
local py=$1
$py -m pip install --upgrade pip
$py -m pip install --upgrade setuptools
$py -m pip install --upgrade virtualenv
}
function install_python {
local py=$1
apt-get install -y $py $py-dev
curl --silent --show-error --retry 5 https://bootstrap.pypa.io/get-pip.py | $py
install_python_packaging $py
}
function choco_install {
local args=$*
# choco fails randomly with network errors on travis, have a few goes
for i in {1..5}; do
choco install $args && return 0
echo 'choco install failed, log tail follows:'
tail -500 C:/ProgramData/chocolatey/logs/chocolatey.log
echo 'sleeping for a bit and retrying'.
sleep 5
done
return 1
}
function install_windows_make {
choco_install make --params "/InstallDir:C:\\tools\\make"
}
function install_windows_py27 {
choco_install python2 --params "/InstallDir:C:\\Python"
export PATH="/c/Python:/c/Python/Scripts:$PATH"
install_python_packaging python
}
function install_windows_py35 {
choco_install python --version 3.5.4 --params "/InstallDir:C:\\Python"
export PATH="/c/Python35:/c/Python35/Scripts:$PATH"
install_python_packaging python
}
function install_windows_py36 {
choco_install python --version 3.6.8 --params "/InstallDir:C:\\Python"
export PATH="/c/Python36:/c/Python36/Scripts:$PATH"
install_python_packaging python
}
function install_windows_py37 {
choco_install python --version 3.7.5 --params "/InstallDir:C:\\Python"
export PATH="/c/Python37:/c/Python37/Scripts:$PATH"
install_python_packaging python
}
function init_venv {
local py=$1
virtualenv venv --python=$py
if [ -f venv/Scripts/activate ]; then
. venv/Scripts/activate
else
. venv/bin/activate
fi
}
function update_apt_sources {
wget -qO- https://download.rethinkdb.com/apt/pubkey.gpg | apt-key add -
. /etc/lsb-release && echo "deb http://download.rethinkdb.com/apt $DISTRIB_CODENAME main" | tee /etc/apt/sources.list.d/rethinkdb.list
wget -q -O - https://pkg.jenkins.io/debian/jenkins-ci.org.key | apt-key add -
sh -c 'echo deb http://pkg.jenkins.io/debian-stable binary/ > /etc/apt/sources.list.d/jenkins.list'
apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv 0C49F3730359A14518585931BC711F9BA15703C6
echo "deb [ arch=amd64 ] http://repo.mongodb.org/apt/ubuntu trusty/mongodb-org/3.4 multiverse" | tee /etc/apt/sources.list.d/mongodb-org-3.4.list
apt-get update
}
function install_system_deps {
apt-get install -y \
xvfb \
x11-utils \
subversion \
graphviz \
pandoc
}
function install_postgresql {
apt-get install -y postgresql postgresql-contrib libpq-dev
service postgresql stop; update-rc.d postgresql disable;
}
function install_redis {
apt-get install -y redis-server
}
function install_rethinkdb {
apt-get install -y rethinkdb
service rethinkdb stop; update-rc.d rethinkdb disable;
}
function install_jenkins {
apt-get install -y jenkins
service jenkins stop; update-rc.d jenkins disable;
}
function install_mongodb {
apt-get install -y mongodb-org mongodb-org-server
}
function install_apache {
apt-get install -y apache2
service apache2 stop; update-rc.d apache2 disable;
}
function install_minio {
wget -q https://dl.minio.io/server/minio/release/linux-amd64/minio -O /tmp/minio
mv /tmp/minio /usr/local/bin/minio
chmod a+x /usr/local/bin/minio
}
function install_chrome_headless {
wget -q https://dl.google.com/linux/direct/google-chrome-stable_current_amd64.deb -O /tmp/google-chrome-stable_current_amd64.deb
dpkg -i --force-depends /tmp/google-chrome-stable_current_amd64.deb || apt-get install -f -y
wget -q https://chromedriver.storage.googleapis.com/2.43/chromedriver_linux64.zip -O /tmp/chromedriver_linux64.zip
unzip /tmp/chromedriver_linux64.zip
mv chromedriver /usr/local/bin/
chmod a+x /usr/local/bin/chromedriver
}
function install_kubernetes {
apt-get update && apt-get install -y apt-transport-https curl
curl -s https://packages.cloud.google.com/apt/doc/apt-key.gpg | apt-key add -
cat <<EOF >/etc/apt/sources.list.d/kubernetes.list
deb https://apt.kubernetes.io/ kubernetes-xenial main
EOF
apt-get update
apt-get install -y kubelet kubeadm kubectl
apt-mark hold kubelet kubeadm kubectl
systemctl daemon-reload
systemctl stop kubelet
swapoff -a
kubeadm init --ignore-preflight-errors=SystemVerification --pod-network-cidr=192.168.0.0/16
export KUBECONFIG=/etc/kubernetes/admin.conf
# install cni (calico)
kubectl apply -f https://docs.projectcalico.org/v3.3/getting-started/kubernetes/installation/hosted/rbac-kdd.yaml
kubectl apply -f https://docs.projectcalico.org/v3.3/getting-started/kubernetes/installation/hosted/kubernetes-datastore/calico-networking/1.7/calico.yaml
kubectl get node
# allow master node to run pods since we are creating a single-node cluster
kubectl taint node $(hostname -s) node-role.kubernetes.io/master-
# copy kubeconfig
cp -f /etc/kubernetes/admin.conf /home/vagrant/.kube/config
chown -R vagrant: /home/vagrant/.kube
}
function install_black {
python3.6 -mpip install black
}
# Install all
function install_all {
install_base_tools
install_python_ppa
install_python python2.7
install_python python3.5
install_python python3.6
install_python python3.7
install_black
update_apt_sources
install_system_deps
install_postgresql
install_redis
install_rethinkdb
install_jenkins
install_mongodb
install_apache
install_minio
install_chrome_headless
}