Skip to content

Instantly share code, notes, and snippets.

@jcuervo
Last active May 21, 2016 05:51
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jcuervo/f7f30b5c215eea80ea5afe92ec5900e1 to your computer and use it in GitHub Desktop.
Save jcuervo/f7f30b5c215eea80ea5afe92ec5900e1 to your computer and use it in GitHub Desktop.
Run an auto-backup script from Ubuntu (running Ruby on Rails app) on PostGres database.
Attempt to run an auto-backup script from DigitalOcean Ubuntu Droplet (running Ruby on Rails app) on PostGres database.
1. Setup s3cmd
S3cmd will upload the backup files generated.
The `sync` command will be executed after the autopostgresqlbackup script finished it's job (added on the POSTBACKUP command).
Follow the steps enumerated in https://levels.io/backup-linode-digital-ocean-vps-amazon-s3/ until the recusive part:
s3cmd sync --recursive --preserve /your-folder-name-to-backup s3://nameofyours3bucket
2. Setup AutoPostGresqlBackup
Follow the instructions in the `Installing and configuring autopostgresqlbackup in CentOS 7` from:
http://www.tecmint.com/mysql-mariadb-postgresql-database-backup-using-automysqlbackup-autopostgresqlbackup/
NOTE: skip the systemctl steps (Postgresql is already running and enabled):
# systemctl start postgresql
# systemctl enable postgresql
3. Setup Cron
30 01 * * * /opt/autopostgresqlbackup/autopostgresqlbackup.sh
4. TODO: setup Postfix to enable the backup script to send email of the backup job summary
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment