summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorVenkata Harish K Kajur <vk250x@att.com>2017-09-18 10:48:13 -0400
committerVenkata Harish K Kajur <vk250x@att.com>2017-09-18 10:48:17 -0400
commit8415da7b2cfd499b4791999bc7632ef68be95d40 (patch)
tree9af16c77bba2bbfc0fbcdf31af8891a9cfb0f143
parent120ef10c215f2327d25fd57b74b4d7665db083ca (diff)
Modify deploy script for common docker changes
Issue-ID: AAI-219 Change-Id: I9ee98530c5b446bb76fdf5326c19d76b567595fd Signed-off-by: Venkata Harish K Kajur <vk250x@att.com>
-rwxr-xr-xdeploy_vm1.sh50
-rw-r--r--docker-compose-app.yml2
2 files changed, 26 insertions, 26 deletions
diff --git a/deploy_vm1.sh b/deploy_vm1.sh
index 8d732e7..54d3c79 100755
--- a/deploy_vm1.sh
+++ b/deploy_vm1.sh
@@ -86,6 +86,23 @@ function wait_for_container() {
done
}
+function check_if_user_exists(){
+
+ local user_id=$1;
+
+ if [ -z "$user_id" ]; then
+ echo "Needs to provide at least one argument for check_if_user_exists func";
+ exit 1;
+ fi;
+
+ id -u ${user_id} > /dev/null 2>&1 && {
+ echo "1";
+ } || {
+ echo "0";
+ }
+}
+
+
if [ ! -d "/opt/message-router" ]; then
(cd /opt && \
git clone http://gerrit.onap.org/r/dcae/demo/startup/message-router && \
@@ -115,36 +132,17 @@ docker tag $DOCKER_REGISTRY/openecomp/sparky-be:$DOCKER_IMAGE_VERSION $DOCKER_RE
$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 || {
- echo "Unable to change ownership of $RESOURCE_LOGS to $USER_ID:$GROUP_ID" >> /var/tmp/deploy_vm1.log;
- echo "Trying with sudo now" >> /var/tmp/deploy_vm1.log;
+USER_EXISTS=$(check_if_user_exists aaiadmin);
- chown -R 999:999 $RESOURCES_LOGS;
-
- if [ $? -ne 0 ]; then
- echo "Unable to change ownership of $RESOURCE_LOGS to 999:999 as well" >> /var/tmp/deploy_vm1.log;
- sudo chown -R 999:999 $RESOURCE_LOGS;
- fi;
-
-};
-
-chown -R $USER_ID:$GROUP_ID $TRAVERSAL_LOGS || {
-
- echo "Unable to change ownership of $TRAVERSAL_LOGS to $USER_ID:$GROUP_ID" >> /var/tmp/deploy_vm1.log;
- echo "Trying with sudo now" >> /var/tmp/deploy_vm1.log;
-
- chown -R 999:999 $RESOURCES_LOGS;
+if [ "${USER_EXISTS}" -eq 0 ]; then
+ export USER_ID=9000;
+else
+ export USER_ID=$(id -u aaiadmin);
+fi;
- if [ $? -ne 0 ]; then
- echo "Unable to change ownership of $TRAVERSAL_LOGS to 999:999 as well" >> /var/tmp/deploy_vm1.log;
- sudo chown -R 999:999 $TRAVERSAL_LOGS;
- fi;
+chown -R $USER_ID:$USER_ID $RESOURCE_LOGS $TRAVERSAL_LOGS;
-};
$DOCKER_COMPOSE_CMD up -d sparky-be
RESOURCES_CONTAINER_NAME=$($DOCKER_COMPOSE_CMD up -d aai-resources.api.simpledemo.openecomp.org 2>&1 | grep 'Creating' | grep -v 'volume' | grep -v 'network' | awk '{ print $2; }' | head -1);
diff --git a/docker-compose-app.yml b/docker-compose-app.yml
index 4ba5b4c..68bcf2b 100644
--- a/docker-compose-app.yml
+++ b/docker-compose-app.yml
@@ -9,6 +9,7 @@ services:
- CHEF_BRANCH=master
- CHEF_GIT_URL=http://gerrit.onap.org/r/aai
- AAI_CORE_VERSION=1.1.0-SNAPSHOT
+ - LOCAL_USER_ID=${USER_ID}
ports:
- 8447:8447
volumes:
@@ -27,6 +28,7 @@ services:
- CHEF_BRANCH=master
- CHEF_GIT_URL=http://gerrit.onap.org/r/aai
- AAI_CORE_VERSION=1.1.0-SNAPSHOT
+ - LOCAL_USER_ID=${USER_ID}
volumes:
- ${TRAVERSAL_LOGS}:/opt/aai/logroot/AAI-GQ
ports: