Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

decrease optional var logging level and allow to pass extra opts to pavics-compose.sh up -d #426

Merged
merged 11 commits into from
Mar 6, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,13 @@

To avoid drowing real WARN messages. Many optional vars can be valid if empty.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"drowning" ?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes, thanks !


- 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)
------------------------------------------------------------------------------------------------------------------
Expand Down
4 changes: 4 additions & 0 deletions birdhouse/env.local.example
Original file line number Diff line number Diff line change
Expand Up @@ -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'.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a nitpick, but it should be 'pavics-compose.sh up' since -d itself is an extra optional flag

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Agreed ! Too used to always use up with -d that I just type it without thinking about it. In fact, I think for my env.local, I will bake -d in that new var to ensure I never forget to use -d !

If you forget to use -d, it goes to the foreground, and the only way out is Ctrl-C which will stop the entire stack, so annoying.

# --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.
#
Expand Down
5 changes: 4 additions & 1 deletion birdhouse/pavics-compose.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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} $*
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should there be some kind of duplicate filtering, or we simply let the command fail with any (possibility ambiguous) error message?
For example, COMPOSE_EXTRA_OPTS="-d" and the user does pavics-compose up -d by mistake.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good catch, yes double -d do not work ! Weird ! Which reason would motivate such a strict cli args parsing !

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Often CLI libraries support duplicating flags to increase some level. For example, -v means verbose level 1 and -v -v means verbose level 2.
Differentiating between options that support this duplication and those that don't are important to these argument parsing libraries.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Right ! But activating this "strict count" for all options seems excessive !

PROXY_SECURE_PORT=443 HOSTNAME=${PAVICS_FQDN} docker-compose ${COMPOSE_CONF_LIST} ${COMPOSE_EXTRA_OPTS} $*
mishaschwartz marked this conversation as resolved.
Show resolved Hide resolved
ERR=$?

# execute post-compose function if exists and no error occurred
Expand Down
Loading