3 # Copyright 2018 Huawei Technologies Co., Ltd.
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
9 # http://www.apache.org/licenses/LICENSE-2.0
15 echo "__rancher_ip_addr__" > /opt/config/rancher_ip_addr.txt
16 HOST_IP=$(hostname -I)
17 echo $HOST_IP `hostname` >> /etc/hosts
20 if [ ! -z "__docker_proxy__" ]; then
21 cat > /etc/docker/daemon.json <<EOF
23 "insecure-registries" : ["__docker_proxy__"]
27 if [ ! -z "__apt_proxy__" ]; then
28 cat > /etc/apt/apt.conf.d/30proxy<<EOF
29 Acquire::http { Proxy "http://__apt_proxy__"; };
30 Acquire::https::Proxy "DIRECT";
35 mkdir -p /dockerdata-nfs
36 echo "__rancher_ip_addr__:/dockerdata-nfs /dockerdata-nfs nfs auto,nofail,noatime,nolock,intr,tcp,actimeo=1800 0 0" | tee -a /etc/fstab
38 apt-get -y install linux-image-extra-$(uname -r) jq nfs-common
42 # install docker 17.03
43 curl -s https://releases.rancher.com/install-docker/17.03.sh | sh
44 usermod -aG docker ubuntu
46 # Fix virtual memory allocation for onap-log:elasticsearch:
47 echo "vm.max_map_count=262144" >> /etc/sysctl.conf
52 while [ ! -e /dockerdata-nfs/rancher_agent_cmd.sh ]; do
56 cp /dockerdata-nfs/rancher_agent_cmd.sh .
57 sed -i "s/docker run/docker run -e CATTLE_AGENT_IP=${HOST_IP}/g" rancher_agent_cmd.sh
58 source rancher_agent_cmd.sh