Backing Up Trellis Sites to an S3 Bucket

To debug script, run ./backup-to-s3.sh from its directory:

cd /srv/www/my-site.com/current/scripts && ./backup-to-s3.sh

instead

bash /srv/www/my-site.com/current/scripts/backup-to-s3.sh

Otherwise the line 2 throw an error:

$ bash /srv/www/my-site.com/current/scripts/backup-to-s3.sh 
cat: ../.env: No such file or directory
/srv/www/my-site.com/current/scripts/backup-to-s3.sh: line 10: cd: /srv/www//current: No such file or directory

Also, I suggest to add this in the document guide:

Change vendor/roles/aws-cli/defaults/main.yml

aws_access_key_id: 'YOUR_ACCESS_KEY_ID'
aws_secret_access_key: 'YOUR_SECRET_ACCESS_KEY'

to

aws_access_key_id: '{{ vault_aws_access_key_id }}'
aws_secret_access_key: '{{ vault_aws_secret_access_key }}'
1 Like