From f1f7d435889665caad593467820430cddbb935b2 Mon Sep 17 00:00:00 2001 From: Chandra Y Date: Thu, 26 Sep 2024 09:58:10 -0500 Subject: [PATCH] WI-193: provide service name to post deploy script (#52) * provide service info to post deploy script * Add default post deploy script --- Makefile | 4 ++-- conf/scripts/post-deploy-core.sh | 4 ---- conf/scripts/post-deploy.sh | 12 ++++++++++++ 3 files changed, 14 insertions(+), 6 deletions(-) delete mode 100644 conf/scripts/post-deploy-core.sh create mode 100644 conf/scripts/post-deploy.sh diff --git a/Makefile b/Makefile index 4d7af0c..ac15e6f 100644 --- a/Makefile +++ b/Makefile @@ -62,7 +62,7 @@ deploy-service: $(DOCKER_COMPOSE) stop $(service) $(DOCKER_COMPOSE) up -d $(service) ifdef POST_DEPLOY_SCRIPT - chmod +x ${CAMINO_HOME}/conf/camino/${POST_DEPLOY_SCRIPT} && ${CAMINO_HOME}/conf/camino/${POST_DEPLOY_SCRIPT} + chmod +x ${CAMINO_HOME}/conf/camino/${POST_DEPLOY_SCRIPT} && ${CAMINO_HOME}/conf/camino/${POST_DEPLOY_SCRIPT} $(service) endif $(DOCKER_COMPOSE) restart nginx @@ -72,7 +72,7 @@ deploy-all: $(DOCKER_COMPOSE) stop $(DOCKER_COMPOSE) up -d ifdef POST_DEPLOY_SCRIPT - chmod +x ${CAMINO_HOME}/conf/camino/${POST_DEPLOY_SCRIPT} && ${CAMINO_HOME}/conf/camino/${POST_DEPLOY_SCRIPT} + chmod +x ${CAMINO_HOME}/conf/camino/${POST_DEPLOY_SCRIPT} && ${CAMINO_HOME}/conf/camino/${POST_DEPLOY_SCRIPT} all endif $(DOCKER_COMPOSE) restart nginx diff --git a/conf/scripts/post-deploy-core.sh b/conf/scripts/post-deploy-core.sh deleted file mode 100644 index ae604f6..0000000 --- a/conf/scripts/post-deploy-core.sh +++ /dev/null @@ -1,4 +0,0 @@ -#!/bin/bash -docker exec portal_django python manage.py migrate -docker exec portal_django python manage.py collectstatic -c --noinput -docker restart designsafe_django diff --git a/conf/scripts/post-deploy.sh b/conf/scripts/post-deploy.sh new file mode 100644 index 0000000..880637a --- /dev/null +++ b/conf/scripts/post-deploy.sh @@ -0,0 +1,12 @@ +#!/bin/bash +service=$1 + +if [[ "$service" == *"core"* ]] || [[ "$service" == "all" ]]; then + docker exec portal_django python3 manage.py migrate + docker exec portal_django python3 manage.py collectstatic --noinput --clear +fi + +if [[ "$service" == *"cms"* ]] || [[ "$service" == "all" ]]; then + docker exec portal_cms python3 manage.py migrate + docker exec portal_cms python3 manage.py collectstatic --noinput --clear +fi \ No newline at end of file