summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorVenkata Harish K Kajur <vk250x@att.com>2017-05-22 17:20:26 -0400
committerVenkata Harish K Kajur <vk250x@att.com>2017-05-22 17:40:36 -0400
commit5b1de57d352dd6903385731ee9611300f05e8abd (patch)
tree74d549e97ea2b9727be2eb8a9de266f87695b7b9
parentffcebde0d6f0b163dec4e1ba35f4771502276f3a (diff)
Add deploy scripts and docker-compose for aai
Change-Id: I9558e4ae1da125a6c18c616aab93009c3e9d57bb Signed-off-by: Venkata Harish K Kajur <vk250x@att.com>
-rwxr-xr-xdeploy_vm1.sh73
-rwxr-xr-xdeploy_vm2.sh63
-rw-r--r--docker-compose-app.yml56
-rw-r--r--docker-compose-db.yml31
4 files changed, 223 insertions, 0 deletions
diff --git a/deploy_vm1.sh b/deploy_vm1.sh
new file mode 100755
index 0000000..09ddfff
--- /dev/null
+++ b/deploy_vm1.sh
@@ -0,0 +1,73 @@
+#!/bin/bash
+
+if [ -f "/opt/docker/docker-compose" ];
+then
+ DOCKER_COMPOSE_CMD="/opt/docker/docker-compose -f docker-compose-app.yml"
+else
+ DOCKER_COMPOSE_CMD="docker-compose -f docker-compose-app.yml"
+fi
+
+export RESOURCES_LOGS="/opt/aai/logroot/AAI-RESOURCES";
+export TRAVERSAL_LOGS="/opt/aai/logroot/AAI-TRAVERSAL";
+
+if [ ! -d "$RESOURCES_LOGS" ];
+then
+ echo "Warning: Unable to find the volume directory $RESOURCES_LOGS so creating it as regular directory";
+ mkdir -p $RESOURCES_LOGS;
+fi;
+
+if [ ! -d "$TRAVERSAL_LOGS" ];
+then
+ echo "Warning: Unable to find the volume directory $TRAVERSAL_LOGS so creating it as regular directory";
+ mkdir -p $TRAVERSAL_LOGS;
+fi;
+
+export MTU=${MTU:-1500};
+export DOCKER_REGISTRY="${DOCKER_REGISTRY:-localhost:5000}";
+export HBASE_IMAGE="${HBASE_IMAGE:-wc9368/aai-hbase-1.2.3}";
+export GREMLIN_SERVER_IMAGE="${GREMLIN_SERVER_IMAGE:-gremlin-server}";
+export AAI_HAPROXY_IMAGE="${AAI_HAPROXY_IMAGE:-aai-haproxy}";
+
+function wait_for_container() {
+
+ CONTAINER_NAME="$1";
+ START_TEXT="$2";
+
+ TIMEOUT=160
+
+ # wait for the real startup
+ AMOUNT_STARTUP=$(docker logs ${CONTAINER_NAME} 2>&1 | grep "$START_TEXT" | wc -l)
+ while [[ ${AMOUNT_STARTUP} -ne 1 ]];
+ do
+ echo "Waiting for '$CONTAINER_NAME' deployment to finish ..."
+ AMOUNT_STARTUP=$(docker logs ${CONTAINER_NAME} 2>&1 | grep "$START_TEXT" | wc -l)
+ if [ "$TIMEOUT" = "0" ];
+ then
+ echo "ERROR: $CONTAINER_NAME deployment failed."
+ exit 1
+ fi
+ let TIMEOUT-=1
+ sleep 1
+ done
+}
+
+# cleanup
+$DOCKER_COMPOSE_CMD stop
+$DOCKER_COMPOSE_CMD rm -f -v
+
+USER_ID=$(docker run -it --rm --entrypoint=id $DOCKER_REGISTRY/openecomp/aai-resources -u | sed 's/[^0-9]//g')
+GROUP_ID=$(docker run -it --rm --entrypoint=id $DOCKER_REGISTRY/openecomp/aai-resources -g | sed 's/[^0-9]//g')
+
+chown -R $USER_ID:$GROUP_ID $RESOURCES_LOGS;
+chown -R $USER_ID:$GROUP_ID $TRAVERSAL_LOGS;
+
+RESOURCES_CONTAINER_NAME=$($DOCKER_COMPOSE_CMD up -d aai-resources.api.simpledemo.openecomp.org 2>&1 | grep 'Creating' | awk '{ print $2; }' | head -1);
+wait_for_container $RESOURCES_CONTAINER_NAME '0.0.0.0:8447';
+
+GRAPH_CONTAINER_NAME=$($DOCKER_COMPOSE_CMD up -d aai-traversal.api.simpledemo.openecomp.org 2>&1 | grep 'Creating' | awk '{ print $2; }' | head -1);
+wait_for_container $GRAPH_CONTAINER_NAME '0.0.0.0:8446';
+
+# deploy
+$DOCKER_COMPOSE_CMD up -d aai.api.simpledemo.openecomp.org
+
+docker exec -it $GRAPH_CONTAINER_NAME "/opt/app/aai-traversal/scripts/install/updateQueryData.sh";
diff --git a/deploy_vm2.sh b/deploy_vm2.sh
new file mode 100755
index 0000000..305a2b2
--- /dev/null
+++ b/deploy_vm2.sh
@@ -0,0 +1,63 @@
+#!/bin/bash
+
+if [ -f "/opt/docker/docker-compose" ];
+then
+ DOCKER_COMPOSE_CMD="/opt/docker/docker-compose -f docker-compose-db.yml"
+else
+ DOCKER_COMPOSE_CMD="docker-compose -f docker-compose-db.yml"
+fi
+
+export RESOURCES_LOGS="/opt/aai/logroot/AAI-RESOURCES";
+export TRAVERSAL_LOGS="/opt/aai/logroot/AAI-TRAVERSAL";
+
+if [ ! -d "$RESOURCES_LOGS" ];
+then
+ echo "Warning: Unable to find the volume directory $RESOURCES_LOGS so creating it as regular directory";
+ mkdir -p $RESOURCES_LOGS;
+fi;
+
+if [ ! -d "$TRAVERSAL_LOGS" ];
+then
+ echo "Warning: Unable to find the volume directory $TRAVERSAL_LOGS so creating it as regular directory";
+ mkdir -p $TRAVERSAL_LOGS;
+fi;
+
+export MTU=${MTU:-1500};
+export HBASE_IMAGE="${HBASE_IMAGE:-wc9368/aai-hbase-1.2.3}";
+#export HBASE_IMAGE="${HBASE_IMAGE:-harisekhon/hbase}";
+export GREMLIN_SERVER_IMAGE="${GREMLIN_SERVER_IMAGE:-gremlin-server}";
+
+function wait_for_container() {
+
+ CONTAINER_NAME="$1";
+ START_TEXT="$2";
+
+ TIMEOUT=160
+
+ # wait for the real startup
+ AMOUNT_STARTUP=$(docker logs ${CONTAINER_NAME} 2>&1 | grep "$START_TEXT" | wc -l)
+ while [[ ${AMOUNT_STARTUP} -ne 1 ]];
+ do
+ echo "Waiting for '$CONTAINER_NAME' deployment to finish ..."
+ AMOUNT_STARTUP=$(docker logs ${CONTAINER_NAME} 2>&1 | grep "$START_TEXT" | wc -l)
+ if [ "$TIMEOUT" = "0" ];
+ then
+ echo "ERROR: $CONTAINER_NAME deployment failed."
+ exit 1
+ fi
+ let TIMEOUT-=1
+ sleep 1
+ done
+}
+
+# cleanup
+$DOCKER_COMPOSE_CMD stop
+$DOCKER_COMPOSE_CMD rm -f -v
+
+HBASE_CONTAINER_NAME=$($DOCKER_COMPOSE_CMD up -d aai.hbase.simpledemo.openecomp.org 2>&1 | grep 'Creating' | grep -v 'network' | awk '{ print $2; }' | head -1);
+wait_for_container $HBASE_CONTAINER_NAME '^starting regionserver';
+#wait_for_container $HBASE_CONTAINER_NAME 'HBase metrics system started';
+
+GREMLIN_CONTAINER_NAME=$($DOCKER_COMPOSE_CMD up -d aai.gremlinserver.simpledemo.openecomp.org 2>&1 | grep 'Creating' | awk '{ print $2; }' | head -1);
+wait_for_container $GREMLIN_CONTAINER_NAME 'Channel started at port 8182';
+
diff --git a/docker-compose-app.yml b/docker-compose-app.yml
new file mode 100644
index 0000000..18d5f9a
--- /dev/null
+++ b/docker-compose-app.yml
@@ -0,0 +1,56 @@
+version: '2'
+services:
+ aai-resources.api.simpledemo.openecomp.org:
+ image: ${DOCKER_REGISTRY}/openecomp/aai-resources
+ hostname: aai-resources.api.simpledemo.openecomp.org
+ environment:
+ - AAI_CHEF_ENV=simpledemo
+ - AAI_CHEF_LOC=/var/chef/aai-data/environments
+ - CHEF_BRANCH=master
+ - CHEF_GIT_URL=http://gerrit.onap.org/r/aai
+ ports:
+ - 8447:8447
+ volumes:
+ - ${RESOURCES_LOGS}:/opt/aai/logroot/AAI-RES
+ logging:
+ driver: "json-file"
+ options:
+ max-size: "30m"
+ max-file: "5"
+ aai-traversal.api.simpledemo.openecomp.org:
+ image: ${DOCKER_REGISTRY}/openecomp/aai-traversal
+ hostname: aai-traversal.api.simpledemo.openecomp.org
+ environment:
+ - AAI_CHEF_ENV=simpledemo
+ - AAI_CHEF_LOC=/var/chef/aai-data/environments
+ - CHEF_BRANCH=master
+ - CHEF_GIT_URL=http://gerrit.onap.org/r/aai
+ volumes:
+ - ${TRAVERSAL_LOGS}:/opt/aai/logroot/AAI-GQ
+ ports:
+ - 8446:8446
+ logging:
+ driver: "json-file"
+ options:
+ max-size: "30m"
+ max-file: "5"
+ aai.api.simpledemo.openecomp.org:
+ image: ${AAI_HAPROXY_IMAGE}
+ hostname: aai.api.simpledemo.openecomp.org
+ ports:
+ - 8443:8443
+ links:
+ - aai-resources.api.simpledemo.openecomp.org
+ - aai-traversal.api.simpledemo.openecomp.org
+ volumes:
+ - /dev/log:/dev/log
+ logging:
+ driver: "json-file"
+ options:
+ max-size: "30m"
+ max-file: "5"
+networks:
+ default:
+ driver: bridge
+ driver_opts:
+ com.docker.network.driver.mtu: ${MTU}
diff --git a/docker-compose-db.yml b/docker-compose-db.yml
new file mode 100644
index 0000000..7f55858
--- /dev/null
+++ b/docker-compose-db.yml
@@ -0,0 +1,31 @@
+version: '2'
+services:
+ aai.hbase.simpledemo.openecomp.org:
+ image: ${HBASE_IMAGE}
+ hostname: aai.hbase.simpledemo.openecomp.org
+ logging:
+ driver: "json-file"
+ options:
+ max-size: "30m"
+ max-file: "5"
+ aai.gremlinserver.simpledemo.openecomp.org:
+ image: ${GREMLIN_SERVER_IMAGE}
+ hostname: aai.gremlinserver.simpledemo.openecomp.org
+ environment:
+ - SERVER_HOST=aai.hbase.simpledemo.openecomp.org
+ - SERVER_TABLE=aaigraph.dev
+ - GREMLIN_HOST=aai.gremlinserver.simpledemo.openecomp.org
+ links:
+ - aai.hbase.simpledemo.openecomp.org
+ ports:
+ - 8182:8182
+ logging:
+ driver: "json-file"
+ options:
+ max-size: "30m"
+ max-file: "5"
+networks:
+ default:
+ driver: bridge
+ driver_opts:
+ com.docker.network.driver.mtu: ${MTU}