Files
tiny-forge/plans/cloudflare-dns-management/CONTEXT.md
T
alexei.dolgolyov c730cfaa45 feat: Cloudflare DNS management with automatic record sync
Add flexible DNS management to Docker Watcher. By default, wildcard DNS
is assumed (current behavior). When disabled, users can configure a
Cloudflare DNS provider with API token and zone selection. DNS A records
are automatically created/updated/deleted in sync with proxy consumers
(deployed instances and standalone proxies).

- Settings: wildcard_dns toggle, dns_provider, cloudflare credentials
- Cloudflare client: Provider interface with EnsureRecord/DeleteRecord/ListRecords
- DNS lifecycle hooks in deployer and proxy manager (best-effort)
- Settings UI: DNS config section with provider picker, zone selector, test button
- DNS Records page at /dns with filtering, sync status, reconciliation
- Records visible in both wildcard and managed modes
- Cleanup on provider change: removes old records when switching modes
2026-04-02 14:49:21 +03:00

1.3 KiB

Feature Context: Cloudflare DNS Management

Configuration

  • Development mode: Automated
  • Execution mode: Direct
  • Strategy: Big Bang
  • Build (Go): go build ./cmd/server
  • Build (Frontend): cd web && npm run build
  • Check (Frontend): cd web && npm run check
  • Test: go test ./...
  • Dev server: ./scripts/dev-server.sh (port 8090)

Current State

Starting fresh — no implementation yet.

Cross-Phase Dependencies

  • Phase 2 depends on Phase 1 (settings fields for Cloudflare credentials)
  • Phase 3 depends on Phase 2 (dns.Provider interface)
  • Phase 4 depends on Phase 1 (API endpoints for settings)
  • Phase 5 depends on Phase 2 + Phase 6 (client + sync logic)
  • Phase 6 depends on Phase 2 (Cloudflare client) + Phase 3 (dns_records table)

Key Architecture Decisions

  • DNS provider abstraction via internal/dns.Provider interface
  • Cloudflare API v4 via direct HTTP (no SDK) — keeps dependencies minimal
  • Local dns_records table tracks managed records for reconciliation
  • DNS operations are best-effort (log warnings, don't block deploys)
  • A records only, pointing to ServerIP from settings

Environment & Runtime Notes

  • Encryption key from ENCRYPTION_KEY env var (AES-256-GCM)
  • SQLite with WAL mode, auto-migration on startup
  • Frontend is SvelteKit 2 + Svelte 5 + Tailwind CSS 4