Disaster recover plan?!
Hello,
So I'm deploying my first Rails app built for a customer β π β to production in couple of days β I'm using Hatch β and I'm not sure what kind of setup/plan I should have for "disater recover" if things go wrong for any reason β I hope nothing will go wrong :)
I'm going to enable db backups so I always have most recent db, should I consider DigitalOcean backup β my understanding that they take a snapshot of the server every night β is that useful?
What would be the fastest way to restore the db incase I need to?
If you know of any good resource so look into that would be awesome as well.
Looking forward to your answers :)
Cheers.
This is a great question Karim! Exciting to get your app in production for a customer! π»
So a couple things to consider here:
- Database backups are safest when you upload them to somewhere third-party like S3. You can edit your Backup config on Hatch via SSH to use your S3 credentials for uploads. That will keep them safe in case anything happens to your server.
- DigitalOcean backups are handy for quick restoration of a server. You can create a new server based on your previous one in a minute or two this way. If you didn't have those, you'd need to setup a new server which takes a few minutes using Hatch. It can speed recovery up a little bit which is good.
- You'll want to make sure that you have practiced database restoration at least once before you go to production to be safe. Download one of the db backups from your app to your local computer and try restoring it to Postgres locally. This command should import the backup into a database:
psql -U <username> -d <dbname> -1 -f <filename>.sql
Once it's imported, you can check that all the same data is available locally as it was on your server. - If you have file uploads that upload locally, you'll want to include those in your backup and restore process. If they're uploading to S3, you don't have to worry about it.
That's most of it. You should also setup the Backup config to notify you on slack or email for failed backups to be safe. If anything goes wrong, you'll want to address that right away.
Definitely agreed. That's on the todo list but there are a few things that are higher priority at the moment right now. Plus there are SO many configuration options for the backup gem, that it'd be hard to verify they're all correct and test them in the UI.
Sure I understand. Maybe you can start by the minimal amout of configurations like S3, email, and slack, that should do it for most poeple extra configurations then one gotta ssh in to server and configure him/herself.
I should clarify that. If your uploads are up to S3, any thing that happens to your server won't affect those files (which is good). You can also setup your S3 to back itself up to another bucket, or another service if you wanted.