3 # -------------------------------------------------------------------------
4 # Copyright 2018 Intel Corporation, Inc
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
10 # http://www.apache.org/licenses/LICENSE-2.0
12 # Unless required by applicable law or agreed to in writing, software
13 # distributed under the License is distributed on an "AS IS" BASIS,
14 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 # See the License for the specific language governing permissions and
16 # limitations under the License.
18 # -------------------------------------------------------------------------
21 if [ -e /opt/config/nexus_docker_repo.txt ]
23 NEXUS_DOCKER_REPO=$(cat /opt/config/nexus_docker_repo.txt)
25 NEXUS_DOCKER_REPO=nexus3.onap.org:10001
27 echo "Using ${NEXUS_DOCKER_REPO} for docker Repo"
29 SMS_IMG=${NEXUS_DOCKER_REPO}/onap/aaf/sms:latest
30 QUO_IMG=${NEXUS_DOCKER_REPO}/onap/aaf/smsquorumclient:latest
31 VAU_IMG=library/vault:0.10.0
32 CON_IMG=library/consul:1.0.6
35 if [ "$1" = "start" ]; then
37 # Create Volume for mapping war file and tomcat
38 docker volume create sms-service;
39 docker volume create sms-consul;
40 docker volume create sms-quorum;
42 # Create a network for all the containers to run in.
43 docker network create sms-net;
45 # Create Consul Container
46 docker create --rm --name sms-consul --network sms-net \
47 --hostname sms-consul -p "8500:8500" \
48 -v sms-consul:/consul/data \
50 consul agent -server -client 0.0.0.0 -bootstrap-expect=1 -config-file /consul/config/config.json;
52 # Copy the configuration for Consul
53 docker cp consul.json sms-consul:/consul/config/config.json;
55 # Start the consul container
56 docker start sms-consul;
58 #Wait for Consul to start
61 # Create Vault Container
62 docker create --rm --name sms-vault --network sms-net \
63 --hostname sms-vault -p "8200:8200" \
66 vault server -config /vault/config/config.json;
68 docker cp vault.json sms-vault:/vault/config/config.json;
69 docker start sms-vault;
72 # Matching hostname with cert name
73 docker create --rm --name aaf-sms.onap --network sms-net \
74 --hostname aaf-sms.onap -p "10443:10443" \
75 -v sms-service:/sms/auth \
78 docker cp smsconfig.json aaf-sms.onap:/sms/smsconfig.json
79 docker start aaf-sms.onap
81 # Start 3 Quorum Clients
84 docker create --rm --name sms-quorum-$i --network sms-net \
85 --hostname sms-quorum-$i \
86 -v sms-quorum:/quorumclient/auth \
89 docker cp quorumconfig.json sms-quorum-$i:/quorumclient/config.json
90 docker start sms-quorum-$i
93 # Connect service to host bridge network so that its port can be seen.
94 docker network connect bridge aaf-sms.onap;
98 # Shutdown and clean up.
99 if [ "$1" = "stop" ]; then
100 docker stop sms-vault sms-consul aaf-sms.onap;
102 docker stop sms-quorum-$i
104 docker network rm sms-net;
106 docker volume rm sms-service;
107 docker volume rm sms-consul;
108 docker volume rm sms-quorum;
113 echo "Please type ${0} start or ${0} stop"