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

Disaster recovery database backup #834

Open
mbarton opened this issue Mar 8, 2024 · 2 comments
Open

Disaster recovery database backup #834

mbarton opened this issue Mar 8, 2024 · 2 comments

Comments

@mbarton
Copy link
Member

mbarton commented Mar 8, 2024

As we're the "system of record" for audit data we should both keep backups of the database (point in time rollback, VM backup etc) as well as having a disaster recovery backup.

I'm not sure what that should be at the moment: database dump in Azure Blob Storage in a different region seems like a decent starter. We can lose the separate region if there's no other Azure region we can store data in, although we may want to store in another cloud provider then.

We're not really expecting Azure to lose a region or lose our data, it's more likely something goes wrong with our account or we accidentally delete everything. But the mechanism is still the same.

@pacharanero
Copy link
Member

pacharanero commented Mar 8, 2024

Fully agree @mbarton - I had sketched out a similar proposal a while back in #663
For a previous, non-RCPCH project I had a versioned AWS S3 bucket which I simply pushed new versions of the DB dump to.
The script ran on cron on a daily basis (on the same VPS that the webapp ran on), but we could equally use a lambda or other serverless infra.

Here's what I had working for several years, in case it's of help/accelerates things:

#!/usr/bin/env bash

# get the backup over HTTPS with password
curl -v -X POST \
  -F 'master_pwd=<PASSWORD> \
  -F 'backup_format=zip' \
  -o /home/odoo/odoo-backups/odoo-back-up.zip \
  https://odoo.example.com/web/database/backup

# send dump to aws
/usr/local/bin/aws s3 cp /home/odoo/odoo-backups/odoo-back-up.zip s3://uniquely-named-versioned-backup-s3-bucket

# delete local sql dump
rm /home/odoo/odoo-backups/odoo-back-up.zip

# email notification of log
curl -s --user 'api:key-APIKEY-FOR-EMAIL-NOTIFICATION' \
    https://api.mailgun.net/v3/USERNAME/messages \
    -F from='Admin Notifier <notification@example.com>' \
    -F to=adminemail@example.com \
    -F subject='Odoo Backup Notifier & Log' \
    -F text="Odoo SQL Backup completed and saved to AWS. Check AWS bucket at https://s3.console.aws.amazon.com/s3/buckets/uniquely-named-versioned-backup-s3-bucket/?region=eu-west-2 to view status"

@mbarton
Copy link
Member Author

mbarton commented Mar 12, 2024

We would only do this after #832 as that will involve changing databases back to hosted postgres

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants