Skip to content

Automated backups of database dump and uploads folder to Amazon S3 account

Notifications You must be signed in to change notification settings

nbyloff/trellis-backup

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 

Repository files navigation

trellis-backup

Role to set up Stouts.backup jobs for Roots/Trellis Wordpress sites. Archives the database and uploads folder. to Amazon S3 storage.

Amazon S3 Account setup

  • Create an account with Amazon AWS
  • Create an S3 bucket to store backups
  • Enable IAM policy for user and new configured backup bucket
  • Get Access ID and Secret Key

Test Amazon S3 Connection

  1. Install s3cmd
sudo apt-get install s3cmd
  1. Configure s3cmd to use API keys (only required first time)
s3cmd --configure
  1. Check for bucket access

This command should return all buckets configured on this account, which should include the one created for this project

s3cmd ls

Usage

From your project directory

  1. Clone this repository
git clone --depth=1 [email protected]:nbyloff/trellis-backup.git trellis/roles/trellis-backup && rm -rf trellis/roles/trellis-backup/.git
  1. Clone Stouts.backup
git clone --depth=1 [email protected]:Stouts/Stouts.backup.git trellis/roles/Stouts.backup && rm -rf trellis/roles/Stouts.backup/.git
  1. Add trellis-backup and Stouts.backup to server.yml:
- name: Set up backups
 hosts: web:&{{ env }}
 become: yes
 roles:
   - { role: trellis-backup, tags: [backup] }
   - { role: Stouts.backup, tags: [backup] }
  1. Add backup configuration to trellis/group_vars/production/vault.yml :
vault_backup:
  backup_user: "{{ admin_user }}"
  bucket_name: YOUR_S3_BUCKET_NAME
  target_user: YOUR_AWS_ACCESS_KEY_ID
  target_password: YOUR_AWS_SECRET_ACCESS_KEY
  1. Reprovision your server to add backup tasks:
ansible-playbook server.yml -e env=production

About

Automated backups of database dump and uploads folder to Amazon S3 account

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published