Know when Coolify's database backups stop working
One Coolify user found their uploads to Cloudflare R2 had stopped “about two weeks ago or so (yeah, it took me this long to notice)”. Another sees about 4% of hourly uploads to Backblaze B2 fail while the job reports “succeeded with a warning” and Validate connection stays green. A scheduled backup can stop, or upload something that does not restore, and look fine in the dashboard. This guide checks the backups Coolify already makes, first with a script, then with SafeGrd.
1. What to check
| Check | Catches |
|---|---|
| The newest backup is younger than its schedule allows | Uploads that stopped: a changed key, a full bucket, a server that was rebuilt without its schedule. |
| It is about as large as the last one | A dump cut short in the upload, or a database that lost most of its rows before the backup. |
| It restores, and its tables hold rows | A file that is not a dump at all, or one pg_restore refuses. |
Coolify writes PostgreSQL backups with pg_dump --format=custom, named
pg-dump-DATABASE-UNIXTIME-ID.dmp, under
data/coolify/backups/databases/TEAM/DIRECTORY/ in the bucket, and the same path
on the server when S3 is off.
2. With a script
Run it from cron on a machine other than the Coolify server, once a day for a daily backup.
The age limit is 26 hours. The last line pings a Healthchecks.io check, which alerts you when
the script fails or stops running. date -d is GNU's; on macOS use
gdate. Compare the size by hand, or keep yesterday's from aws s3 ls
in a file. Run pg_restore from the same PostgreSQL major as the database, or a
newer one.
3. With SafeGrd
Add the location as a surface on any host with the SafeGrd daemon, with a key that can only list and read the prefix:
- Every day the daemon reads the newest backup once and counts each table's rows. When Coolify writes nothing for two days, the surface is Overdue and you get an alert.
- Threat Shield compares each backup's rows and size with the last, and warns on a drop. A dump that does not open, or ends early, is a failed backup.
- Fire Drills load the backup into a throwaway database and compare every table with the count. The certificate says Coolify made the backup.
- The key stays on your host, and nothing Coolify wrote passes through SafeGrd's server.
This proves the backup restores. It does not prove the dump holds every row, because SafeGrd never reads the database itself. For that, let SafeGrd take its own backups too (Coolify backup). The details are on the PostgreSQL page.