Problem
If dns-sync apply fails midway (network error, API rate limit, partial provider failure), records already applied cannot be reverted. The zone ends up in a partially-synced state with no recovery path.
Proposed solution
Automatic snapshot before apply
Before executing any changes, serialize the current state of each target provider zone to a local snapshot file:
.dns-sync/snapshots/{zone}/{provider}/{timestamp}.yaml
Rollback command
dns-sync rollback -c config.yaml # roll back to latest snapshot
dns-sync rollback -c config.yaml --snapshot 2024-01-15T10:30:00 # specific snapshot
dns-sync rollback -c config.yaml --zone example.com. --provider cloudflare
Automatic rollback on failure
# config.yaml
apply:
rollback_on_failure: true # auto-rollback if apply fails after partial changes
Implementation notes
- Snapshot format can reuse the existing YAML zone file format
- Snapshots should be stored alongside the config (or configurable path)
- Rollback is itself an apply in reverse — reuses
ApplyPlanAsync with source=snapshot, target=provider
- Need to decide snapshot retention policy (keep last N, or by age)
- Snapshots should be gitignore'd by default (contain live DNS state)
Related
- Pairs well with an audit log feature to record what changed and when
Problem
If
dns-sync applyfails midway (network error, API rate limit, partial provider failure), records already applied cannot be reverted. The zone ends up in a partially-synced state with no recovery path.Proposed solution
Automatic snapshot before apply
Before executing any changes, serialize the current state of each target provider zone to a local snapshot file:
Rollback command
Automatic rollback on failure
Implementation notes
ApplyPlanAsyncwith source=snapshot, target=providerRelated