Open-org/Automatic-Server-Setup — pull request #6 by igreactive (2012-10-24 15:09:00+00:00)
Title: Issue #60

Test serwer with this pull:
http://ec2-50-19-31-114.compute-1.amazonaws.com/igreactive/Automatic-Server-Setup/startsandbox.php

I checked script with both versions, with and without backup.

David, I decided, for simplicity, to not add a ticker if you want to make automatic backup.

I you want automatic snapshot, just add key id and secret key of amazon user, who can do snapshots.
If you don't provide these credentials, backup of snapshots will be not configured.
I you provide incorrenct credentials, backup will be configured, but backup script will not create any snapshot, because of this wrong credentials.

The credentials of snapshot user can be the same as access key and secret key you provide in form for connecting with Amazon. That way it is working for me.

Cron job of backup snapshot is set to 1am every day. You can check it with crontab -l
Backup is saving logs to /var/log/backup.log

As a backup tool I used ec2-consistent-snapshot, it's good start if you want enable raid.

However, If you want to use this snapshots as a backup of PostgreSQL I think that this backup procedure should be updated. I was asking you of it in this comment https://github.com/Open-org/PhotoAccounting/issues/60#issuecomment-9568553

The problem with snapshot of instance with PostgreSQL is, that database binary data files may be not consistent, especially, when we do snapshot of running server. Better tool for consistent backup of PostgreSQL is pg_dump, as I mentioned in comment above. So once again, from docs: "pg_dump is a utility for backing up a PostgreSQL database. It makes consistent backups even if the database is being used concurrently"

ec2-consistent-snapshot currently can do consistent snapshot only for MySQL.

The solution for consistent backup in this situation can be:
1. do pg_dump in backup script before doing snapshot and save this dump in filesystem

If there will be crash, server can be restored from snapshot.
Then we should do manually pg_restore data from dump, then I believe PostgreSQL data will be consistent for sure.