dokku-postgres icon indicating copy to clipboard operation
dokku-postgres copied to clipboard

Question: Best Practices for Configuring Health Checks on DB Backups

Open n8creator opened this issue 1 year ago • 4 comments

Hey there! I'm looking to set up automatic database backups on S3 for my applications (I have several of them), and I want to implement health checks to monitor if the database is being backed up according to the schedule. Typically, I make an HTTP GET request to an external service, like so:

curl -m 10 --retry 5 https://hc-ping.com/your-uuid-here

What would be the best way to trigger these calls after the backup-schedule command being executed, such as:

dokku postgres:backup-schedule lollipop "0 3 * * *" my-s3-bucket

Any suggestions or best practices would be greatly appreciated! Thanks in advance for any help.

n8creator avatar Mar 29 '24 09:03 n8creator

There isn't a way to do what you're asking here unfortunately.

josegonzalez avatar Mar 31 '24 02:03 josegonzalez

There isn't a way to do what you're asking here unfortunately.

Ok, thanks for quick answer!

n8creator avatar Mar 31 '24 07:03 n8creator

I'm going to reopen this. It's a good suggestion, just not sure how we can implement it.

josegonzalez avatar Mar 31 '24 08:03 josegonzalez

Here's a suggestion:

To theck

What if we use the the cron expression ( like "0 3 * * *" ):

  1. fetch the last created_at object from s3
  2. check if it's before the current time minus the last time that the cron should be running (using the cron expression)

We can complicate a little bit more considering the time that takes to run a backup. Maybe saving the time of the last backup and consider it to calculate the item 2 .

How to notify

  • If there is like "N (configurable) checks with error" the user can setup a smtp server that we can use to notify some email.
  • A little more complex is to run this checker with node installed so the user can run some js script (configured via mount)
  • Another more complex is to run this checker passing the docker socket and some folder/file so the user can execute some script

Is the backup working?

Note that this doesn't verify the backup file integrity. Only that there is a file.

viniciusoyama avatar Aug 18 '24 01:08 viniciusoyama