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

[FEAT] Allow calling a healthcheck URL after a successful backup #21

Merged
merged 1 commit into from
Sep 15, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
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
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,7 @@ Environment variables
| MONGODB_AUTHDB | Authentication DB name | - |
| CRONMODE | If set "true", this container is executed in cron mode. In cron mode, the script will be executed with the specified arguments and at the time specified by CRON_EXPRESSION. | "false" |
| CRON_EXPRESSION | Cron expression (ex. "CRON_EXPRESSION=0 4 * * *" if you want to run at 4:00 every day) | - |
| HEALTHCHECKS_URL | URL that gets called after a successful backup (eg. https://healthchecks.io) | - |

### For `restore`

Expand Down
5 changes: 5 additions & 0 deletions bin/backup.sh
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,11 @@ elif [ `echo $TARGET_BUCKET_URL | cut -f1 -d":"` == "gs" ]; then
gs_copy_file ${TARBALL_FULLPATH} ${TARGET_BUCKET_URL}
fi

# call healthchecks url for successful backup
if [ "x${HEALTHCHECKS_URL}" != "x" ]; then
curl -fsS --retry 3 ${HEALTHCHECKS_URL} > /dev/null
fi

# clean up working files if in cron mode
if ${CRONMODE} ; then
rm -rf ${TARGET}
Expand Down