Updated Setting up Backup (markdown)

Theodotos Andreou 2018-01-16 11:22:13 +02:00
parent 436260b1af
commit 545adbc2e0

@ -16,6 +16,26 @@ $ drush dl backup_migrate
$ drush en backup_migrate
```
## Deny access to the backup folders
Add these in the virtualhost file (*/etc/nginx/sites-available/cms*):
```
location ~ ^/sites/.*/files/private/backup_migrate/manual {
deny all;
}
location ~ ^/sites/.*/files/private/backup_migrate/scheduled {
deny all;
}
```
Reload *Nginx*:
```
$ sudo systemctl reload nginx
```
## Create a scheduled backup
Go to `Configuration -> Backup and Migrate -> Schedules`:
@ -37,12 +57,13 @@ Prepare the following script (*/etc/cron.daily/backup-cms*):
#!/bin/sh
PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
HOSTNAME=$(hostname)
CMS_BACKUP_PATH=/srv/webadmin/cms/sites/default/private/backup_migrate/scheduled
S3_CMS_LOG_PATH=/var/log/aws-s3-sync-cms-$(date +%F).log
S3_BUCKET=s3.example.com
aws s3 sync ${CMS_BACKUP_PATH} s3://${S3_BUCKET}/${HOSTNAME}/ 2>&1 ${S3_CMS_LOG_PATH}
aws s3 sync ${CMS_BACKUP_PATH} s3://${S3_BUCKET}/${HOSTNAME} > ${S3_CMS_LOG_PATH} 2>&1
find ${CMS_BACKUP_PATH} -type f -mtime +30 -delete
find /var/log/aws-s3-sync-*.log -type f -mtime +30 -delete