Skip to content

Latest commit

 

History

History
83 lines (64 loc) · 1.88 KB

File metadata and controls

83 lines (64 loc) · 1.88 KB

Backend Backup / Restore Guide

Use this guide to protect and recover the mutable backend state for the production Socket.io service.

What is backed up

The provided backup flow captures the key mutable server data:

  • leaderboards.json
  • rpg_database.json
  • maps/
  • characters/
  • achievement_profiles/
  • emulator_states/

Create a backup on the VPS manually

Run on the server:

cd /opt/bobsgameweb/server/ops
bash backup-backend-data.sh

This creates a timestamped archive under:

  • /opt/bobsgameweb/backups/

Trigger and download a backup from your local machine

Run locally:

BACKEND_HOST=ws.bobsgame.com BACKEND_USER=root ./scripts/fetch-backend-backup.sh

Optional local destination:

BACKEND_HOST=ws.bobsgame.com BACKEND_USER=root LOCAL_BACKUP_DIR=./backups ./scripts/fetch-backend-backup.sh

Restore a backup manually on the VPS

1. Stop the backend first

sudo systemctl stop bobsgameweb-server

2. Extract the backup from the server root

Example:

cd /opt/bobsgameweb/server
tar -xzf /opt/bobsgameweb/backups/YOUR_BACKUP_FILE.tar.gz

3. Start the backend again

sudo systemctl start bobsgameweb-server
sudo systemctl status bobsgameweb-server --no-pager

4. Re-verify health

BACKEND_URL=https://ws.bobsgame.com ./scripts/check-backend-host.sh

Recommended operational habit

  • take a backup before major backend changes
  • take a backup before first production cutover
  • take a backup before schema/storage changes
  • keep at least one known-good off-server copy
  • periodically prune old on-server backups so disk usage stays predictable

Prune old backups on the server

A prune helper is included:

  • server/ops/prune-backups.sh

Example:

KEEP_COUNT=10 bash prune-backups.sh

Related runbooks

  • BACKEND_RECOVERY.md
  • POST_DEPLOY_CHECKLIST.md
  • HARDENING_CHECKLIST.md