Rails Machine Wiki

About Backups

Rails Machine takes pride in using reliable hardware, but problems can happen, and you should be prepared for them. Your machine’s data sits on a RAID 10 drive array, which does mitigate some of the risk. In addition, Rails Machine takes daily snapshots of each server in case of catastrophic failure.

But none of this is a replacement for having good backups within reach in case an important file or directory is accidentally deleted or becomes corrupted.

What should you back up? This depends on what you’re running on your machine, but for a basic Rails application, you’ll need backups of your database and of your SVN repository. Maybe a copy of the current running version would be a good idea as well.

Please note: Backup storage is not included in all plans. Please see your plan details for more information.

If your plan does include backup storage, you will have a RAID 10 network drive mounted on /backup/storage. You are free to use this for your backups, or you can pull files from your Rails Machine to some off-site backup of your choice. Whether this be a computer at your home or office, possibly then burned to a CD or DVD, it’s up to you.

To back up your database, assuming you’re using the default of mysql, use the mysqldump script. It’s usually a good idea to compress the output, since it tends to be verbose and can get very large very quickly:

mysqldump -u deploy -p mydatabasename | gzip - > mydatabasename-backup.sql.gz

Backing up your SVN repository can be done by one of two methods, described at http://svnbook.red-bean.com/nightly/en/svn.reposadmin.maint.html#svn.reposadmin.maint.backup.

The backup script described is on your Rails Machine at /usr/share/doc/subversion-1.2.1/tools/backup/hot-backup.py. Whichever method you choose, you can use the /backup/storage directory as the destination or you can move the file off of your server with scp/sftp.

Offsite backups

In the event of meteor, both your server and the backup server will be converted to dust. If you’d like to add offsite backups of your database and other important files, we suggest uploading a backup of your database, repository and any files uploaded by your users to Amazon S3.

Here’s are some rake tasks and tips to get you started. http://www.rubyinside.com/advent2006/15-s3rake.html

Once you get that working, just create a cron job and your app will be safe no matter how much of the East Coast is obliterated.

Meta