Role to set up Stouts.backup jobs for Roots/Trellis Wordpress sites. Archives the database and uploads folder. to Amazon S3 storage.
- 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
- Install
s3cmd
sudo apt-get install s3cmd
- Configure
s3cmd
to use API keys (only required first time)
s3cmd --configure
- 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
From your project directory
- Clone this repository
git clone --depth=1 git@github.com:nbyloff/trellis-backup.git trellis/roles/trellis-backup && rm -rf trellis/roles/trellis-backup/.git
- Clone Stouts.backup
git clone --depth=1 git@github.com:Stouts/Stouts.backup.git trellis/roles/Stouts.backup && rm -rf trellis/roles/Stouts.backup/.git
- Add
trellis-backup
andStouts.backup
to server.yml:
- name: Set up backups
hosts: web:&{{ env }}
become: yes
roles:
- { role: trellis-backup, tags: [backup] }
- { role: Stouts.backup, tags: [backup] }
- 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
- Reprovision your server to add backup tasks:
ansible-playbook server.yml -e env=production