You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Description of the feature
Currently, I use DBXX_SPLIT_DB=FALSE to back up all databases of an instance to a single file. My pre- and post-backup hooks are used to send a ping to a healthchecks instance (see below for the script), all working as expected.
However, if I want to split the backups to individual files (with DBXX_SPLIT_DB=TRUE), the pre- and post scripts are executed for every database, resulting in a separate ping (and thus a separate healthcheck) for each one. In my current environment, this would result in approximately 30-40 checks, cluttering up my healthchecks project while providing very little benefit.
I don't know how feasible this is to implement w.r.t. the workflow of the app, but if there is a possibility to execute the pre- and post scripts once for every database instance, it would provide the possibility to have separate dumps for each database while only sending one ping for each instance.
Benftits of feature
I haven't seen many other examples of script hooks, but I imagine they're generally used to send notifications or pings to a connected service. If we can reduce the number of notifications sent by this script without changing the functionality, I think this would be a benefit to anyone using a notification delivery service.
Additional context
Pre-backup script:
#!/bin/bash
# Note: Requires the environment variables HEALTHCHECK_DOMAIN and HEALTHCHECK_PING_KEY[_FILE]
# Define command output to send to Healthchecks
# See: https://github.com/tiredofit/docker-db-backup#pre-backup
log="'${1}' Backup Starting on ${2} for ${3} at ${4}. Filename: ${5}"
# Define slug of job
slug="$2-$3-backup"
# Read ping key from file if necessary
if [[ -n "${HEALTHCHECK_PING_KEY_FILE:-}" && -f "$HEALTHCHECK_PING_KEY_FILE" ]]; then
ping_key=$(cat "$HEALTHCHECK_PING_KEY_FILE")
elif [[ -n "${HEALTHCHECK_PING_KEY:-}" ]]; then
ping_key=$HEALTHCHECK_PING_KEY
else
echo 'No ping key supplied!'; exit 1
fi
# Send update to healthchecks
# See: https://healthchecks.io/docs/measuring_script_run_time/
curl -fsS -m 30 --retry 5 --data-raw "$log" "${HEALTHCHECK_DOMAIN}/ping/${ping_key}/${slug}/start?create=1"
Post-backup script:
#!/bin/bash
# Note: Requires the environment variables HEALTHCHECK_DOMAIN and HEALTHCHECK_PING_KEY[_FILE]
# Define command output to send to Healthchecks
# See: https://github.com/tiredofit/docker-db-backup#post-backup
log="${2} Backup Completed (exit code: ${1}) on ${3} for ${4} on ${5} ending ${6} for a duration of ${7} seconds. Filename: ${8} Size: ${9} bytes MD5: ${10}"
# Define slug of job
slug="$3-$4-backup"
# Read ping key from file if necessary
if [[ -n "${HEALTHCHECK_PING_KEY_FILE:-}" && -f "$HEALTHCHECK_PING_KEY_FILE" ]]; then
ping_key=$(cat "$HEALTHCHECK_PING_KEY_FILE")
elif [[ -n "${HEALTHCHECK_PING_KEY:-}" ]]; then
ping_key=$HEALTHCHECK_PING_KEY
else
echo 'No ping key supplied!'; exit 1
fi
# Send update to healthchecks
# See: https://hc.bpvr.nl/docs/signaling_failures/
curl -fsS -m 30 --retry 5 --data-raw "$log" "${HEALTHCHECK_DOMAIN}/ping/${ping_key}/${slug}/$1"
The text was updated successfully, but these errors were encountered:
Description of the feature
Currently, I use
DBXX_SPLIT_DB=FALSE
to back up all databases of an instance to a single file. My pre- and post-backup hooks are used to send a ping to a healthchecks instance (see below for the script), all working as expected.However, if I want to split the backups to individual files (with
DBXX_SPLIT_DB=TRUE
), the pre- and post scripts are executed for every database, resulting in a separate ping (and thus a separate healthcheck) for each one. In my current environment, this would result in approximately 30-40 checks, cluttering up my healthchecks project while providing very little benefit.I don't know how feasible this is to implement w.r.t. the workflow of the app, but if there is a possibility to execute the pre- and post scripts once for every database instance, it would provide the possibility to have separate dumps for each database while only sending one ping for each instance.
Benftits of feature
I haven't seen many other examples of script hooks, but I imagine they're generally used to send notifications or pings to a connected service. If we can reduce the number of notifications sent by this script without changing the functionality, I think this would be a benefit to anyone using a notification delivery service.
Additional context
Pre-backup script:
Post-backup script:
The text was updated successfully, but these errors were encountered: