Upgrade helm version to 2.9.1
[integration.git] / deployment / heat / onap-oom / k8s_vm_entrypoint.sh
1 #!/bin/bash -x
2 #
3 # Copyright 2018 Huawei Technologies Co., Ltd.
4 #
5 # Licensed under the Apache License, Version 2.0 (the "License");
6 # you may not use this file except in compliance with the License.
7 # You may obtain a copy of the License at
8 #
9 #     http://www.apache.org/licenses/LICENSE-2.0
10 #
11
12 printenv
13
14 mkdir -p /opt/config
15 echo "__docker_version__" > /opt/config/docker_version.txt
16 echo "__rancher_ip_addr__" > /opt/config/rancher_ip_addr.txt
17 echo "__rancher_private_ip_addr__" > /opt/config/rancher_private_ip_addr.txt
18 HOST_IP=$(hostname -I)
19 echo $HOST_IP `hostname` >> /etc/hosts
20
21 mkdir -p /etc/docker
22 if [ ! -z "__docker_proxy__" ]; then
23     cat > /etc/docker/daemon.json <<EOF
24 {
25   "insecure-registries" : ["__docker_proxy__"]
26 }
27 EOF
28 fi
29 if [ ! -z "__apt_proxy__" ]; then
30     cat > /etc/apt/apt.conf.d/30proxy<<EOF
31 Acquire::http { Proxy "http://__apt_proxy__"; };
32 Acquire::https::Proxy "DIRECT";
33 EOF
34 fi
35 apt-get -y update
36
37 mkdir -p /dockerdata-nfs
38 echo "__rancher_private_ip_addr__:/dockerdata-nfs /dockerdata-nfs nfs auto,nofail,noatime,nolock,intr,tcp,actimeo=1800 0 0" | tee -a /etc/fstab
39
40 apt-get -y install linux-image-extra-$(uname -r) jq nfs-common
41
42 cd ~
43
44 # install docker 17.03
45 curl -s https://releases.rancher.com/install-docker/__docker_version__.sh | sh
46 usermod -aG docker ubuntu
47
48 # Fix virtual memory allocation for onap-log:elasticsearch:
49 echo "vm.max_map_count=262144" >> /etc/sysctl.conf
50 sysctl -p
51
52 sleep 100
53
54 while [ ! -e /dockerdata-nfs/rancher_agent_cmd.sh ]; do
55     mount /dockerdata-nfs
56     sleep 5
57 done
58 cp /dockerdata-nfs/rancher_agent_cmd.sh .
59 sed -i "s/docker run/docker run -e CATTLE_AGENT_IP=${HOST_IP}/g" rancher_agent_cmd.sh
60 source rancher_agent_cmd.sh