spantaleev / matrix-docker-ansible-deploy

🐳 Matrix (An open network for secure, decentralized communication) server setup using Ansible and Docker
GNU Affero General Public License v3.0
4.83k stars 1.04k forks source link

[Feat] Provide cron job for backing up database #429

Open abeluck opened 4 years ago

abeluck commented 4 years ago

I imagine many users would like to have automatic backups of the database available.

Ideally the postgres role could also provide a script and cron job that performs the backup. It could be controlled with a few simple variables, here are some suggested defaults:

matrix_postgres_backup_enabled: true
matrix_postgres_backup_location: /matrix/postgres/backups
matrix_postgres_backup_cron_schedule: @daily

Then when combined with a backup tool like borg, tarsnap, or even rsync, it would be dead simple to ensure the matrix deployment is backed up.

Obviously large deployments might have perf issues with daily backups, but I suspect they should be/are using external an postgres server anyways.

spantaleev commented 4 years ago

This sounds like something that would work well for most people, so I think we should do it. And then we can provide some samples for how to pull these backups using rsync, etc. It would be nice to ensure safety for most deployments.

For larger deployments or people who do their backups in a more specialized way, it could always be be turned off.

ptman commented 2 years ago

https://github.com/spantaleev/matrix-docker-ansible-deploy/blob/master/docs/configuring-playbook-postgres-backup.md