blob: 9d34eb079666fe100b9377b7b126006b5b423acb [file] [log] [blame]
Andrew Grimbergebc710a2017-01-30 12:59:38 -08001#!/bin/bash
2
3# vim: ts=4 sw=4 sts=4 et tw=72 :
4
Andrew Grimberg8ffb2132017-02-07 10:48:06 -08005# force any errors to cause the script and job to end in failure
Andrew Grimberg7fb50b32017-02-07 10:54:58 -08006set -xeu -o pipefail
Andrew Grimberg8ffb2132017-02-07 10:48:06 -08007
Andrew Grimbergebc710a2017-01-30 12:59:38 -08008rh_systems() {
9 # Assumes that python is already installed by basebuild
10
11 # Install dependencies for robotframework and robotframework-sshlibrary
Andrew Grimberg8ffb2132017-02-07 10:48:06 -080012 yum install -y yum-utils unzip sshuttle nc libffi-devel openssl-devel
Andrew Grimbergebc710a2017-01-30 12:59:38 -080013
14 # Install docker
15 yum install -y docker supervisor bridge-utils
16 systemctl enable docker
17
18 # configure docker networking so that it does not conflict with LF
19 # internal networks
20 cat <<EOL > /etc/sysconfig/docker-network
21# /etc/sysconfig/docker-network
22DOCKER_NETWORK_OPTIONS='--bip=10.250.0.254/24'
23EOL
24 # configure docker daemon to listen on port 5555 enabling remote
25 # managment
26 sed -i -e "s#='--selinux-enabled'#='--selinux-enabled -H unix:///var/run/docker.sock -H tcp://0.0.0.0:5555'#g" /etc/sysconfig/docker
27
28 # docker group doesn't get created by default for some reason
29 groupadd docker
Andrew Grimbergebc710a2017-01-30 12:59:38 -080030}
31
Jessica Wagantall46994752017-11-06 18:13:14 -080032ubuntu_docker_mtu_fix(){
33 echo "---> Fixing docker's mtu settings"
34 systemctl stop docker
Jessica Wagantall8d6333a2017-11-07 10:30:32 -080035 cat <<'EOL' > /etc/systemd/system/docker.service
Jessica Wagantall46994752017-11-06 18:13:14 -080036[Unit]
37Description=Docker Application Container Engine
38Documentation=https://docs.docker.com
39After=network.target docker.socket
40Requires=docker.socket
41
42[Service]
43Type=notify
44# the default is not to use systemd for cgroups because the delegate issues still
45# exists and systemd currently does not support the cgroup feature set required
46# for containers run by docker
47ExecStart=
48ExecStart=/usr/bin/dockerd --mtu 1454 -H tcp://0.0.0.0:2375 -H unix:///var/run/docker.sock
49ExecReload=/bin/kill -s HUP $MAINPID
50# Having non-zero Limit*s causes performance problems due to accounting overhead
51# in the kernel. We recommend using cgroups to do container-local accounting.
52LimitNOFILE=infinity
53LimitNPROC=infinity
54LimitCORE=infinity
55# Uncomment TasksMax if your systemd version supports it.
56# Only systemd 226 and above support this version.
57TasksMax=infinity
58TimeoutStartSec=0
59# set delegate yes so that systemd does not reset the cgroups of docker containers
60Delegate=yes
61# kill only the docker process, not all processes in the cgroup
62KillMode=process
63
64[Install]
65WantedBy=multi-user.target
66EOL
67 systemctl start docker
68 echo "---> Checking MTU"
69 docker network inspect bridge
70 echo "---> MTU set to 1454"
71}
72
Andrew Grimbergebc710a2017-01-30 12:59:38 -080073ubuntu_systems() {
74 # Assumes that python is already installed by basebuild
75
Jessica Wagantallb95d13f2017-10-13 10:37:35 -070076 # Install Python3.6
77 sudo add-apt-repository -y ppa:jonathonf/python-3.6
78 sudo apt-get update
Jessica Wagantall62260462017-10-19 08:51:03 -070079 sudo apt-get install -y python3.6 python3.6-dev
Jessica Wagantallb95d13f2017-10-13 10:37:35 -070080
Andrew Grimbergebc710a2017-01-30 12:59:38 -080081 # Install dependencies for robotframework and robotframework-sshlibrary
82 apt install -y unzip sshuttle netcat libffi-dev libssl-dev
Jessica Wagantall86366492017-08-31 11:52:55 -070083 wget https://github.com/mozilla/geckodriver/releases/download/v0.18.0/geckodriver-v0.18.0-linux64.tar.gz
84 tar xvzf geckodriver-v0.18.0-linux64.tar.gz -C /usr/local/bin
85 export PATH=$PATH:/usr/local/bin
Andrew Grimbergebc710a2017-01-30 12:59:38 -080086
87 # Install docker
88 apt install -y docker.io
Jessica Wagantall46994752017-11-06 18:13:14 -080089
90 # Fixing Docker MTU settings
91 ubuntu_docker_mtu_fix
Andrew Grimbergebc710a2017-01-30 12:59:38 -080092}
93
94all_systems() {
Gary Wu86f7b4e2017-08-17 12:20:26 -070095 # Install docker-compose
96 curl -o /usr/local/bin/docker-compose -L "https://github.com/docker/compose/releases/download/1.15.0/docker-compose-$(uname -s)-$(uname -m)"
97 chmod +x /usr/local/bin/docker-compose
98 docker-compose -v
Andrew Grimbergebc710a2017-01-30 12:59:38 -080099}
100
101echo "---> Detecting OS"
102ORIGIN=$(facter operatingsystem | tr '[:upper:]' '[:lower:]')
103
104case "${ORIGIN}" in
105 fedora|centos|redhat)
106 echo "---> RH type system detected"
107 rh_systems
108 ;;
109 ubuntu)
110 echo "---> Ubuntu system detected"
111 ubuntu_systems
112 ;;
113 *)
114 echo "---> Unknown operating system"
115 ;;
116esac
117
118# execute steps for all systems
119all_systems