From 7567e8dd6c0723fde4165c34f56fac480090ec60 Mon Sep 17 00:00:00 2001 From: Long Vu Date: Fri, 23 Feb 2024 16:55:19 -0500 Subject: [PATCH] compose script: allow to pass extra options to `up` operation When disabling components, their existing containers will not be removed unless option `--remove-orphans` is given together with `./pavics-compose.sh up -d`. This change allow any additional options, not just `--remove-orphans`. --- CHANGES.md | 7 +++++++ birdhouse/env.local.example | 4 ++++ birdhouse/pavics-compose.sh | 5 ++++- 3 files changed, 15 insertions(+), 1 deletion(-) diff --git a/CHANGES.md b/CHANGES.md index 76ab90864..56cc576e0 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -21,6 +21,13 @@ To avoid drowing real WARN messages. Many optional vars can be valid if empty. +- compose script: allow to pass extra options to `up` operation + + When disabling components, their existing containers will not be removed + unless option `--remove-orphans` is given together with `./pavics-compose.sh up -d`. + + This change allow any additional options, not just `--remove-orphans`. + [2.1.0](https://github.com/bird-house/birdhouse-deploy/tree/2.1.0) (2024-02-23) ------------------------------------------------------------------------------------------------------------------ diff --git a/birdhouse/env.local.example b/birdhouse/env.local.example index 1487ba44c..155a0568b 100644 --- a/birdhouse/env.local.example +++ b/birdhouse/env.local.example @@ -189,6 +189,10 @@ export GEOSERVER_ADMIN_PASSWORD="${__DEFAULT__GEOSERVER_ADMIN_PASSWORD}" # within the autodeploy docker container as the root user. #export AUTODEPLOY_CODE_OWNERSHIP="1000:1000" +# Extra options for 'pavics-compose.sh up -d'. +# --remove-orphans useful when disabling components. Harmless when left enabled all the time. +#export COMPOSE_UP_EXTRA_OPTS="--remove-orphans" + # Load pre-configured job to auto-renew LetsEncrypt SSL certificate if a # LetsEncrypt SSL certificate has previously been requested. # diff --git a/birdhouse/pavics-compose.sh b/birdhouse/pavics-compose.sh index 9d7e47c63..52e5d35cf 100755 --- a/birdhouse/pavics-compose.sh +++ b/birdhouse/pavics-compose.sh @@ -105,7 +105,10 @@ if [ x"$1" = x"info" ]; then exit 0 fi +COMPOSE_EXTRA_OPTS="" + if [ x"$1" = x"up" ]; then + COMPOSE_EXTRA_OPTS="${COMPOSE_UP_EXTRA_OPTS}" for adir in $ALL_CONF_DIRS; do COMPONENT_PRE_COMPOSE_UP="$adir/pre-docker-compose-up" if [ -x "$COMPONENT_PRE_COMPOSE_UP" ]; then @@ -116,7 +119,7 @@ if [ x"$1" = x"up" ]; then fi # the PROXY_SECURE_PORT is a little trick to make the compose file invalid without the usage of this wrapper script -PROXY_SECURE_PORT=443 HOSTNAME=${PAVICS_FQDN} docker-compose ${COMPOSE_CONF_LIST} $* +PROXY_SECURE_PORT=443 HOSTNAME=${PAVICS_FQDN} docker-compose ${COMPOSE_CONF_LIST} ${COMPOSE_EXTRA_OPTS} $* ERR=$? # execute post-compose function if exists and no error occurred