Backup and Restore Documentation - SupaHotBall/OE2-Group-D GitHub Wiki
🕓 Backup Schedule
All servers perform automated backups 4 times daily using Puppet-managed cron jobs.
Time (UTC) | Description |
---|---|
02:10 |
Early morning run |
08:10 |
Morning run |
14:10 |
Afternoon run |
20:10 |
Evening run |
Backups are triggered by cron jobs and executed via Puppet.
📁 Data Locations
mgmt-d
)
🔧 Management Server (/etc/puppetlabs/puppet
/etc/puppetlabs/code/modules
/etc/cron.d
/etc/fstab
/etc/ssh
/etc/sudoers
/etc/hostname
/etc/hosts
/etc/netplan
apps-d
)
☁️ Apps Server (/var/www/owncloud/config
/var/www/owncloud/data
/etc/apache2/sites-available/owncloud.conf
backup-d
)
📊 Backup Server (/usr/local/bin/prometheus/
/etc/systemd/system/prometheus.service
/usr/local/bin/node_exporter
/etc/systemd/system/node_exporter.service
/etc/grafana/
/var/lib/grafana/
/etc/hostname
/etc/hosts
/etc/netplan
db-d
)
🛢️ Database Server (Refer to the restoration notebook for restoring procedures for the db server
🔁 Restore Procedures
This section outlines how to restore files or data from the offsite backup server (20.40.64.18
).
1️⃣ SSH into the Offsite Backup Server
Start by connecting to the server:
2️⃣ Navigate to the Appropriate Backup Directory
cd ~/mgmt # Management server files
cd ~/apps # ownCloud files
cd ~/db # MariaDB SQL dumps
cd ~/backup # Monitoring (Prometheus, Grafana)
Use ls -lh
to browse contents
3️⃣ Transfer Files to the Source Server
Using scp - Example for restoring Puppet configs to the management server:
scp -r [email protected]:/home/group-d/mgmt/etc/puppetlabs/code/modules /etc/puppetlabs/code/
Using rsync - More efficient for large/recursive transfers
sudo rsync -avz -e "ssh" [email protected]:/home/group-d/mgmt/etc/puppetlabs/code/modules /etc/puppetlabs/code/
4️⃣ Restore MariaDB Database from Dump File
Step A: Pull the dump file to the DB server
scp [email protected]:/home/group-d/db/db-backup.sql ~/
Step B: Restore the database
mysql -u root -p < ~/db-backup.sql
You’ll be prompted for the MariaDB root password.
5️⃣ Post-Restore: Verify and Adjust Permissions
sudo chown -R root:root /etc/puppetlabs/code/modules
sudo chmod -R 644 /etc/puppetlabs/code/modules
✅ Summary Table
Task | Command Example |
---|---|
SSH into backup server | ssh [email protected] |
View backups | ls -lh ~/mgmt |
Transfer files via scp |
scp -r [email protected]:/home/group-d/... /etc/... |
Transfer files via rsync |
sudo rsync -avz -e "ssh" [email protected]:/home/group-d/... /etc/... |
Retrieve DB dump | scp [email protected]:/home/group-d/db/db-backup.sql ~/ |
Restore MariaDB database | mysql -u root -p < ~/db-backup.sql |
Fix permissions | sudo chown -R root:root ... sudo chmod -R 644 ... |
⚠️ Always verify restored files before applying them to a live environment.