Problem
Backups are often treated as a checkbox, but restores are where failures happen. Manual backup and restore processes are error-prone: wrong paths, wrong database, missing uploads, failed search-replace, or accidental overwrites—especially during high-stress recovery situations.
Goal
Design a backup and disaster recovery workflow that:
-
consistently backs up files and the database
-
restores safely with guardrails
-
supports environment changes (search/replace)
-
works both interactively and unattended
-
reduces human error during recovery
Approach
I built a pair of shell scripts around WP-CLI to formalize both backup and restore as a single, predictable workflow. The scripts prioritize safety and clarity over speed, using sensible defaults, configuration files for automation, and prompts only when decisions matter.
The restore process was treated as a first-class concern, not an afterthought.
Implementation Highlights
-
Full site backups (files + database) using WP-CLI
-
Database details extracted directly from
wp-config.php -
Config-file support for unattended or repeatable runs
-
Restore safety mechanisms:
-
detect existing WordPress installations before overwrite
-
configurable database drop behavior (yes / no / ask)
-
optional search-replace during restore for environment changes
-
-
Clear terminal output and cleanup steps to reduce confusion during recovery
Outcome
-
Reliable, repeatable backups with predictable restores
-
Faster recovery when rebuilding staging or handling migrations
-
Reduced risk of data loss or accidental overwrites
-
Disaster recovery became a documented, executable process instead of a manual checklist
Links
-
Backup & restore scripts:
→ https://norbertferia.com/gist/backup-wp
→ https://norbertferia.com/gist/restore-wp
(adjust URLs if needed)
Future Enhancements
-
Orchestrate backups via cron, Slack commands, or n8n triggers
-
Store artifacts in remote storage with retention policies
-
Add verification steps (dump validation, quick smoke checks after restore)