Operations, Backups, Key Rotation & Cloud Mode
Upgrades, age-encrypted disaster recovery drills, zero-downtime KeyRing rotation, Prometheus/Grafana, and cloud billing.
Zero-Downtime Key Rotation (bryfo rotate-keys)
Bryfo encrypts third-party secrets (mail_accounts, system_settings, users.totp_secret_enc, privacy_alias_configs, user_ai_configs, and Valkey privacy:sess:*) with versioned AES-256-GCM keys:
- Prepend key version
2while retaining version1in.env:CREDENTIALS_ENCRYPTION_KEYS=2:<new-base64-32B>,1:<old-base64-32B> - Recreate
app(docker compose up -d app) and verify in dry-run mode:docker compose exec app /usr/local/bin/bryfo rotate-keys --dry-run docker compose exec app /usr/local/bin/bryfo rotate-keys
Encrypted Backups & Disaster Recovery Drills
scripts/backup.sh and scripts/restore.sh create versioned (format_version: 2) archives with SHA256SUMS, PostgreSQL custom dumps, local blob tarballs (or rclone S3 mirrors), and optional age encryption:
# Create snapshot
./scripts/backup.sh
# Non-destructive integrity & TOC preflight
./scripts/restore.sh --dry-run ./backups/bryfo-backup-20261206T020000Z
# Full restore + flush stale Valkey locks/sessions
./scripts/restore.sh --flush-valkey ./backups/bryfo-backup-20261206T020000ZPreserve CREDENTIALS_ENCRYPTION_KEYS Offline
Database dumps store encrypted ciphertext. Always store CREDENTIALS_ENCRYPTION_KEYS and AGE_KEY_FILE in a separate password vault (such as 1Password) — without the active key ring, restored mailbox and gateway credentials cannot be decrypted.
Observability & Commercial cloud Mode
- Prometheus & Grafana: Scrape
GET /metrics(Authorization: Bearer <METRICS_TOKEN>) and importdeploy/monitoring/alerts.yml(14 alert rules) +deploy/monitoring/grafana-dashboard.json. - Cloud Mode (
DEPLOYMENT_MODE=cloud): Enforces fail-closed webhook fulfillment (/api/v1/webhooks/stripe,/api/v1/payments/callback/{provider}), integer minor-unit dual-currency pricing (USD&CNY), expiring-firstcredit_bucketsbefore permanentpaid_credits, and> 2 MiBon-demand IMAP attachment caching. Isolate/admin*behind VPN, Cloudflare Access, or IP allowlists in production.