Production Server Backups
Production server disaster recovery covered by SLA with Fully Managed VPS Server.
Development Server Backups
The filesystembackup.sh script is utilized for scripted backups.
Assumed LAMP Server Directory Structure:
/web/backups/etc-apache2/sites-available/
/web/backups/etc-apache2/sites-enabled/
/web/backups/etc-php-<php.version>-apache2/
/web/backups/mysql/
/web/backups/scripts/
/web/backups/webroot/
Note: created when running the installwebserver.sh script (which installs and configures a LAMP server)
Development Server(s):
LAMP Server Configuration Files:
/etc/php/<php.version>/apache2/php.ini ----->/web/backups/etc-php-<php.version>-apache2/
Website Configuration Files:
/etc/apache2/sites-available/*.*-->/web/backups/etc-apache2/sites-available
/etc/apache2/sites-enabled/*.*-->/web/backups/etc-apache2/sites-enabled
MySQL backups:
/<mysqltables>/*.* --------------->/web/backups/mysql/
webroot Files:
/web/webroot/*-------------------> /web/backups/webroot/
Shell Scripts (.sh)
/web/scripts/*---------------------> /web/backups/scripts/
Ubuntu Backup Locations:
/home/Desktop
/home/Documents
/home/Downloads
/home/ISOs
/home/Music
/home/Pictures
/home/Videos
Backup File Location(s)
Backup File Structure:
Each node’s backup files will be stored in its own folder on the backup device:
\\<device1>\
\\<server>\<backupfolders>\
\\<computer>\<backupfolders>\
\\NTFS\
\\azrael\etc-apache2\
\\azrael\etc-php-<php.version>-apache2\
\\azrael\mysql\
\\azrael\scripts\
\\azrael\webroot\
update to include date? trim old?
Backup Devices (The Smurflings Ext HDD’s located on desk in office):
- Sassette (6TB USB 3.0 – Ext4)
- Snappy (6TB USB 3.0 – NTFS)
- Slouchy (1.5TB USB 3.0 – NTFS)
Files that do NOT require backing up:
- caches & temporary files
- installation files
- core files that can be re-distributed (ie: node_modules)
- log files
CRON Schedule
CRON Jobs are located and served from:
/web/scripts/CRONJOBs/
Scripts in that folder should not be edited directly.
They should be edited elsewhere and when ready, copied over top of the current CRONJOB
To edit file:
crontab -e
Added the following:
# m h dom mon dow command
08 16 * * * sudo /bin/sh /web/scripts/filesystembackup.sh 2>&1 /tmp/mycron.log
Reload cron for above changes to take effect:
# reload cron:
sudo service cron reload
Outstanding/Questions/Todo
- Risk assessment for complete data loss from VPS
- what would happen my server got turned off?
- unrecoverable data loss?
- Versioning / how to archive/deal with old backup files?
- Compression:
- effect of compression on various files types (image vs text)
- How much disk space saved? Is it worth the effort?
- Only archives? (but also store un/compressed files)
- Should MySQL be shut down before backing up?
- What about Production databases?
- Permissions preserved with recovery?
- Write Recovery shell script and test full recovery process
- Checking if things exist first, like directories, and if not, creating them