arachnys / cabot

Self-hosted, easily-deployable monitoring and alerts service - like a lightweight PagerDuty
MIT License
5.59k stars 593 forks source link

Preferred Backup and Restoration Procedures? #324

Open aolgin opened 8 years ago

aolgin commented 8 years ago

I'm really liking Cabot so far, but before I actually begin to use it in production, I'd like to figure out a backup and restoration procedure for the database.

I've noticed that I can run fab backup ..., which will work fine for backing up, but I don't see a fabric task for restoring.

Once that backup task is run, it's a simple matter to write a script to schedule backups of it to S3 (although I do note a comment in fabfile.py regarding S3)

From there, I tried restoring the psql database I backed up with fabric on one host and importing it into a new install of Cabot on a different host, using:

gunzip outfile.sql.gz
psql -u cabot index < outfile.sql

That just seems to do an incomplete restoration though. None of the checks created are associated with services or instances.

Is there a better way to go about backing up or restoring the database? How do I completely get the users, checks, services, instances, history, and any relations between those backed up?

My experience with Django and postgres are very minimal, so any help is appreciated.

aolgin commented 8 years ago

I was unable to get this to work, however, I was able to just hook it up to a Postgres RDS instance, which automatically handles backups and can easily do restorations, copies, etc.

I did a backup of our current database with fab backup, and then attempted the restore method to the RDS instance and ran into the same issue of before with no relations being preserved, but luckily, our usage of Cabot is very minimal as I set it up.

It should be noted that the AWS Database Migration Service will NOT work if you are attempting to just use that to migrate your database to RDS. Cabot installs Postgres 9.1, which is not supported by DMS, and so an error was thrown when I initially tried to do this.

So far, the RDS database has been working rather well for us, so I'll close this for now.

dbuxton commented 8 years ago

Sorry not to get to this earlier. The issue is that the relation models (Django creates an intermediate model for M2M relationships) are not being backed up - silly oversight. I'll reopen this as it would be great if backups actually worked ;)

zdenkas commented 8 years ago

+1

firehist commented 8 years ago

@dbuxton is there any plan on that?