2 #############################################################################
4 # Copyright © 2018 Amdocs.
6 # Licensed under the Apache License, Version 2.0 (the "License");
7 # you may not use this file except in compliance with the License.
8 # You may obtain a copy of the License at
9 # http://www.apache.org/licenses/LICENSE-2.0
11 # Unless required by applicable law or agreed to in writing, software
12 # distributed under the License is distributed on an "AS IS" BASIS,
13 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 # See the License for the specific language governing permissions and
15 # limitations under the License.
17 #############################################################################
19 # Amazon AWS specific EFS/NFS share and rancher host join script for each cluster node
20 # https://wiki.onap.org/display/DW/Cloud+Native+Deployment
21 # source from https://jira.onap.org/browse/OOM-320
29 sudo ./cluster.sh -n false -s cl.onap.info -e fs-00c0f00 -r us-east-2
31 sudo ./cluster.sh -n true -s cl.onap.info -e fs-00c0f00 -r us-east-2 -t 23D4:15:qQ -c false -a host1.onap.info -v true
32 sudo ./oom_cluster_host_install.sh -n true -s cd.onap.cloud -e 1 -r us-east-2 -t token -c false -a 104.209.158.156 -v true
34 You must create an EFS (NFS wrapper) on AWS
37 -n [true|false] : is node (non master)
38 -s [master server] : target server (ip or FQDN only)
39 -e [AWS efs id] : AWS Elastic File System ID prefix
40 -r [AWS region prefix] : AWS Region prefix
41 -t [token] : registration token
42 -h [agent ver] : agent version (default 1.2.10 for 1.6.18
43 -c [true/false] : use computed client address
44 -a [IP address] : client address ip - no FQDN
45 -v [validate true/false]: optional
51 DOCKERDATA_NFS=dockerdata-nfs
56 if [[ "$IS_NODE" != false ]]; then
57 sudo curl https://releases.rancher.com/install-docker/$DOCKER_VER.sh | sh
58 sudo usermod -aG docker $USERNAME
60 sudo apt-get install nfs-common -y
61 sudo mkdir /$DOCKERDATA_NFS
62 sudo mount -t nfs4 -o nfsvers=4.1,rsize=1048576,wsize=1048576,hard,timeo=600,retrans=2 $AWS_EFS.efs.$AWS_REGION.amazonaws.com:/ /$DOCKERDATA_NFS
63 if [[ "$IS_NODE" != false ]]; then
64 echo "Running agent docker..."
65 if [[ "$COMPUTEADDRESS" != false ]]; then
66 echo "sudo docker run --rm --privileged -v /var/run/docker.sock:/var/run/docker.sock -v /var/lib/rancher:/var/lib/rancher rancher/agent:v$AGENT_VER http://$MASTER:$PORT/v1/scripts/$TOKEN"
67 sudo docker run --rm --privileged -v /var/run/docker.sock:/var/run/docker.sock -v /var/lib/rancher:/var/lib/rancher rancher/agent:v$AGENT_VER http://$MASTER:$PORT/v1/scripts/$TOKEN
69 echo "sudo docker run -e CATTLE_AGENT_IP=\"$ADDRESS\" --rm --privileged -v /var/run/docker.sock:/var/run/docker.sock -v /var/lib/rancher:/var/lib/rancher rancher/agent:v$AGENT_VER http://$MASTER:$PORT/v1/scripts/$TOKEN"
70 sudo docker run -e CATTLE_AGENT_IP="$ADDRESS" --rm --privileged -v /var/run/docker.sock:/var/run/docker.sock -v /var/lib/rancher:/var/lib/rancher rancher/agent:v$AGENT_VER http://$MASTER:$PORT/v1/scripts/$TOKEN
84 while getopts ":u:n:s:e:r:t:h:c:a:v" PARAM; do
109 COMPUTEADDRESS=${OPTARG}
124 if [ -z $MASTER ]; then
129 register_node $IS_NODE $MASTER $AWS_EFS $AWS_REGION $TOKEN $AGENT_VER $COMPUTEADDRESS $ADDRESS $VALIDATE
130 echo "check dockerdata-nfs"
131 sudo ls /dockerdata-nfs
132 echo "if you get http://$MASTER:8880/v1 is not accessible (The requested URL returned error: 404 Not Found) - check your token"
133 printf "**** Success: Done ****\n"