Keep sanitized Compose sources in-repo with a confirmation-gated Ansible playbook, add repo-wide validation, tighten runbook ownership/STOP/review metadata, and archive stale research docs. Co-authored-by: Cursor <cursoragent@cursor.com>
2.9 KiB
2.9 KiB
Runbook: Vaultwarden SQLite → Postgres (us2)
Purpose
Replay checklist for the exceptional SQLite→Postgres migration on us2.
Scope
- Applicable: us2.wsvc.info,
/opt/vaultwarden. - Not applicable: routine reconcile — this is destructive and intentionally not automated.
Ownership
- Owner: personal ops (Windy)
- Last reviewed: 2026-08-17
- Related systems: us2.wsvc.info (
/opt/vaultwarden)
Safety
- Destructive: requires explicit approval; confirm backups exist before starting.
- Do not commit
.envor password-bearing files to git. - If any step diverges from this checklist,
STOPand report.
Target: us2.wsvc.info
Upstream: Using the PostgreSQL Backend · docs/vaultwarden-upstream.md
Done on 2026-08-01 for this host. Keep this as the replay checklist. This is an exceptional, destructive migration procedure: it is intentionally not automated by the routine Ansible reconciliation playbook.
Summary of what we did
- Backup
vw-data+.env→backups/pre-pg-migrate-<timestamp>/ - Baseline counts from SQLite (then: users=1, ciphers=1327)
- Drop/recreate empty Postgres DB; pin image
vaultwarden/server:1.37.1 - Set compose
DATABASE_URL=postgresql://${DB_USER}:${DB_PASS}@${DB_HOST}:${DB_PORT}/${DB_NAME} - Start VW once → diesel schema → stop
pgloaderdata only (exclude__diesel_schema_migrations) with CAST bigint→integer- Remaining intentional bigints:
attachments.file_size,twofactor.last_used,twofactor_duo_ctx.exp - Align
config.jsonSMTP 587/starttls,ip_header=X-Forwarded-For,DOMAINwithout trailing slash - Rotate
DB_PASS/PGWEB_PASS;pgwebbehind composeprofiles: [debug] - Move live sqlite file to
backups/sqlite-cold/(cold only) - After VW recreate, restart Traefik so Docker provider picks up the router
Critical pitfalls
config.jsonoverrides.env(admin wins). Fix SMTP there or via/admin.- SMTP password drift: if
.envAUTH works but VW mail fails with535, syncvw-data/config.json(+.smtp-credentials) to the mailbox password — do not assume env alone is enough. - From this network, mx2:465 times out; use 587 + starttls.
- After recreating
vaultwarden, Traefik may 404 untildocker restart traefik. - pgloader needs a writable directory for the sqlite file (CANTOPEN if mount is awkward).
- After pgloader, wrong integer types → silent “wrong password”; see Discussion #7134.
- Do not commit
.envor load files with passwords into git.
Rollback
docker compose stop vaultwarden- Restore
vw-datafrombackups/pre-pg-migrate-*(including sqlite) - Remove
DATABASE_URLfrom composeenvironment docker compose up -d vaultwarden&&docker restart traefik