Backup and restore
What you would lose
Section titled “What you would lose”| Data | Rebuildable? |
|---|---|
| Watch definitions | Yes — from YAML files, if you keep them |
| Run state (seen content, notified events, ledger, pending deliveries) | No |
| Run history | No |
| Trust rules | Only by hand |
| Stored API keys | Only by re-adding them |
| Accounts | Only by recreating them |
Free tiers usually do not back up
Section titled “Free tiers usually do not back up”Most free database tiers provide no automated backups. If that is your setup, backups are your responsibility. The repository includes a scheduled workflow that takes a weekly compressed dump and retains it as a build artifact — a reasonable baseline for a personal instance.
Taking a backup
Section titled “Taking a backup”Any standard MongoDB dump works:
mongodump --uri="$MongoDB_URI" --archive=watcher-backup.gz --gzipRestoring
Section titled “Restoring”-
Stop anything that writes — pause the scheduled job and stop the service. Restoring underneath a running scheduler produces a mess.
-
Restore the archive:
Terminal window mongorestore --uri="$MongoDB_URI" --archive=watcher-backup.gz --gzip -
Check the encryption key. Stored API keys are encrypted with
CONFIG_ENCRYPTION_KEY. Restoring the data to an environment with a different key means those keys cannot be decrypted — they will be skipped with a warning and Watcher falls back to environment keys. -
Sanity-check before resuming:
pnpm watches:listshows your watches, andpnpm watches history <id>shows history from before the backup. -
Resume the scheduler.
Restoring to a point before recent alerts
Section titled “Restoring to a point before recent alerts”If your backup predates alerts you already received, the restored state does not know about them and they may be re-sent. Options:
- Accept one noisy run — usually simplest for a personal instance.
- Disable the affected watches, let one run pass to re-learn current content, then re-enable. You will miss anything that changes in that window.
A minimal disaster-recovery plan
Section titled “A minimal disaster-recovery plan”| Keep | Where |
|---|---|
| Watch definitions as YAML | Version control |
| Environment configuration (names, not values) | Documented alongside |
| Secrets | Your platform’s secret store, or a password manager |
| A recent database dump | Off the database host |
With those four, a total loss is a rebuild of an hour, not a rewrite.
What is not backed up anywhere
Section titled “What is not backed up anywhere”Per-process key cooldowns and rate-limiter windows are in memory and are simply lost. They self-heal; there is nothing to restore.