Configure backup of Contao sites on OIALinux server
Intro
My last few posts covered working with OIALinux server and moving Contao CMS managed websites from our unit's webserver to OIT hosted server. Next step is to set up backup of Contao websites. There are two distinct items that are necessary to back up:
- Files that make up Contao sites
- MySQL database that stores some the data about Contao hosted sites
By default all files in /swadm directory are backed up nightly with 30 retention period. This is done automatically without you needing to do anything.
In order to backup up MySQL however it is necessary to make regular "dumps" of the contao database so that those could be backed up.
Configure MySQL backup
From past experience I knew that configuring regular backups of MySQL can be tricky. I searched the web for the scripts that would do this for me and found AutoMySQLBackup sript. This seemed to do exactly what I needed and was easy enough to set up.
I followed the installation instruction on the AutoMySQLBackup sript page with an exception of the step 5 where you asked to place the script in /etc/cron.daily. Since swadm user doesn't have rights to /etc/cron.daily, I needed to set up crontab for swadm and configure an entry in crontab to run AutoMySQLBackup.
I found a good writeup on setting up crontab. By using this guide I set up crontab and placed an entry to run AutoMySQLBackup every day.
With MySQL dumps created and placed into /swadm/backup directory and automatic backup of all files in /swadm directory, the websites hosted by Contao are backed up.