My previous backup strategy is simple login to cpanel, generate full backup and then ftp it and have it stored in the syno box monthly. The disadvantages is that
– wasting a lot of local storage to store a number of full backup
– time consuming to perform these tasks manually and ftping large backup archive periodically.
– Since I’m only performing backup monthly, data is subject to lost if something funny happened on my webhost account (disk crash, hacker, whatover)
Why not just mirroring the live site to the apache on the syno box? The benefit
– automate all backup tasks without manual procedures
– can backup up to like every 10 minutes or even less
– backup only changes!! not full backup everytime
– incremental backup means saving tons of local storage
– can verify the backup content using any browser because the backup site is actually running on the NAS!
Since there is no synchronization plugin available for wordpress, I’m doing this task by a few scripts written myself.
Understanding the sequence
- Firstly, we setup a virtual domain on our NAS in order to host the mirror site.
- We setup a schedule job to backup the wordpress database daily
- After the database is backup, a cron job will download the db backup as well as the web files to our NAS
- After download, another cron job will extract the backup file and import the data to local mysql database.
- Finally, we patch the local data in order to have the wordpress running on the mirror site.
This article requires a lots of technique mentioned in previous articles, make sure you familiar with the setup below, otherwise, refer to previous articles.
- Setup ssh public key authentication (usage series 5)
- Setup DNS and DDNS (usage series 20)
- Data patching
- Setup wordpress (usage series 16)
- Setup cronjob