From a303338116163dfa87b208ecf28b3ab6a705802e Mon Sep 17 00:00:00 2001 From: Vermaas <vermaas@astron.nl> Date: Tue, 10 Dec 2024 15:12:00 +0100 Subject: [PATCH] update script --- README.md | 30 +++++++++++++------ .../templates/taskdatabase/index.html | 2 +- deploy_atdb_local_prod.sh | 16 ++++++++++ 3 files changed, 38 insertions(+), 10 deletions(-) create mode 100644 deploy_atdb_local_prod.sh diff --git a/README.md b/README.md index 5bb5b33c..8be66264 100644 --- a/README.md +++ b/README.md @@ -80,15 +80,27 @@ On the host, this repo can then be cloned and pulled, and the image built and de #### update: - > export DOCKER_BUILD_DIR=$HOME/my_docker/atdb-ldv/atdb - > export DOCKER_COMPOSE_DIR=$DOCKER_BUILD_DIR/docker - > cd $DOCKER_BUILD_DIR - > git pull - > docker build -t atdb-ldv:latest . - > cd $DOCKER_COMPOSE_DIR - > docker-compose -f docker-compose-dev-pull-local.yml -p atdb up -d - or - > docker-compose -f docker-compose-production-pull-local.yml -p atdb up -d +This can be done with the `deploy_atdb_local_dev.sh` script. + +````commandline +#!/usr/bin/bash + +export ATDB_DIR=$HOME/my_docker/atdb-ldv + +while true; do + cd $ATDB_DIR + git pull + + # Proceed with build and redeploy, this only does something when new changes were detected by the git pull + cd atdb + docker build -t atdb-ldv:latest . + docker-compose -f docker/docker-compose-dev-pull-local.yml -p atdb up -d + + sleep 60 # Wait for 1 minute before the next iteration + +done +```` + #### Database changes and migrations When the `models.py` is changed, then the database must be migrated. diff --git a/atdb/taskdatabase/templates/taskdatabase/index.html b/atdb/taskdatabase/templates/taskdatabase/index.html index 758ed067..c0ca8e7c 100644 --- a/atdb/taskdatabase/templates/taskdatabase/index.html +++ b/atdb/taskdatabase/templates/taskdatabase/index.html @@ -31,7 +31,7 @@ {% include 'taskdatabase/pagination.html' %} </div> </div> - <p class="footer"> Version 10 Dec 2024 - 15:00</p> + <p class="footer"> Version 10 Dec 2024 - 15:15</p> </div> {% include 'taskdatabase/refresh.html' %} diff --git a/deploy_atdb_local_prod.sh b/deploy_atdb_local_prod.sh new file mode 100644 index 00000000..1fa9352e --- /dev/null +++ b/deploy_atdb_local_prod.sh @@ -0,0 +1,16 @@ +#!/usr/bin/bash + +export ATDB_DIR=$HOME/my_docker/atdb-ldv + +while true; do + cd $ATDB_DIR + git pull + + # Proceed with build and redeploy, this only does something when new changes were detected by the git pull + cd atdb + docker build -t atdb-ldv:latest . + docker-compose -f docker/docker-compose-production-pull-local.yml -p atdb up -d + + sleep 60 # Wait for 1 minute before the next iteration + +done \ No newline at end of file -- GitLab