blob: 1ec659c0eeb458d176aa37fad256c2f26c3c3a26 [file] [log] [blame]
Gary Wu1ff56672018-01-17 20:51:45 -08001#!/bin/bash -x
2printenv
3
4mkdir -p /opt/config
5echo "__rancher_ip_addr__" > /opt/config/rancher_ip_addr.txt
Gary Wu11c98742018-05-02 16:19:04 -07006HOST_IP=$(hostname -I)
7echo $HOST_IP `hostname` >> /etc/hosts
8
Gary Wu1ff56672018-01-17 20:51:45 -08009mkdir -p /etc/docker
Gary Wu374498a2018-02-06 17:31:04 -080010if [ ! -z "__docker_proxy__" ]; then
11 cat > /etc/docker/daemon.json <<EOF
Gary Wu1ff56672018-01-17 20:51:45 -080012{
13 "insecure-registries" : ["__docker_proxy__"]
14}
15EOF
Gary Wu374498a2018-02-06 17:31:04 -080016fi
17if [ ! -z "__apt_proxy__" ]; then
18 cat > /etc/apt/apt.conf.d/30proxy<<EOF
Gary Wu1ff56672018-01-17 20:51:45 -080019Acquire::http { Proxy "http://__apt_proxy__"; };
20Acquire::https::Proxy "DIRECT";
21EOF
Gary Wu374498a2018-02-06 17:31:04 -080022fi
Gary Wu1ff56672018-01-17 20:51:45 -080023apt-get -y update
Gary Wu14a6b302018-05-01 15:59:28 -070024
25mkdir -p /dockerdata-nfs
26echo "__rancher_ip_addr__:/dockerdata-nfs /dockerdata-nfs nfs auto,nofail,noatime,nolock,intr,tcp,actimeo=1800 0 0" | tee -a /etc/fstab
27
28apt-get -y install linux-image-extra-$(uname -r) jq nfs-common
Gary Wu1ff56672018-01-17 20:51:45 -080029
30cd ~
31
Gary Wu57abb1a2018-03-09 13:38:28 -080032# install docker 17.03
33curl -s https://releases.rancher.com/install-docker/17.03.sh | sh
Gary Wu1ff56672018-01-17 20:51:45 -080034usermod -aG docker ubuntu
35
Gary Wu1ff56672018-01-17 20:51:45 -080036# Fix virtual memory allocation for onap-log:elasticsearch:
37echo "vm.max_map_count=262144" >> /etc/sysctl.conf
38sysctl -p
39
Gary Wuc98156d2018-01-18 12:03:26 -080040sleep 100
Gary Wu14a6b302018-05-01 15:59:28 -070041
42while [ ! -e /dockerdata-nfs/rancher_agent_cmd.sh ]; do
43 mount /dockerdata-nfs
44 sleep 5
Gary Wuc98156d2018-01-18 12:03:26 -080045done
Gary Wu11c98742018-05-02 16:19:04 -070046cp /dockerdata-nfs/rancher_agent_cmd.sh .
47sed -i "s/docker run/docker run -e CATTLE_AGENT_IP=${HOST_IP}/g" rancher_agent_cmd.sh
48source rancher_agent_cmd.sh