Automatic backup monitoring

We have automatic backups configured. As far as I’m aware, they are running without a problem, but we’d like to monitor them with a simple service, such as https://healthchecks.io, to know for sure.

Is there any way to configure a simple call to their API to confirm that a backup has been completed? Something like this:

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

I’m wondering if there’s a pre-backup and/or post-backup completed hook that I can plumb this into?

Thanks

You can Reverse engineer the Discourse API to get a list of backups and then you’d need to do something to see what the latest one was and how long it has been there.

You’ll get a notification if a backup fails.

The only problem I’ve ever had is when backups were scheduled the same time as automated personalized marketing os reboots.

As I see this it works when there is behind the scenes backup schedule of database (because once a day isn’t enough, is it?) and then inbuild warningsystem is lagging behind, max 24 hours. But it would work as early warning system if Discourse is down because of database failing, but because of caching users don’t see it right away.

Am I totally wrong? Not even close?

Thanks. If there’s no way to set a “hook” after a backup has been completed, then I think the idea of reverse engineering the discourse API to find the most recent backup, is probably the way to go, and then we have full control over what to do if a backup hasn’t worked… but if a hook (web or shell command) could be added post-backup, that would be ideal.

Thanks for your help :+1:

If you want to call a hook after the backup is done I think you’d need to create a plugin.

Are you really suggesting that a failed backup is how you want to know if Discourse is down?

/srv/status gives you a pretty good idea, though Discourse can break in ways that aren’t reflected by that. It will indicate if the database is broken.

I’m not suggesting anything else but backuping the database more often than once a day. I was just thinking an email because of error of backuping would act as warning bell TOO.

No it doesn’t. It says “ok” as long as you have rails, Redis and nginx.

root@testbeta:~# service postgresql stop
root@testbeta:~# curl https://testbeta.*************.***/srv/status && echo
ok
2 Likes

Interesting. Maybe if postgres is down when Rails starts it’ll fail to crank up.

1 Like