Updates
Updating code does not require new secrets or a new database. Back up D1 first.
Dashboard
- On your GitHub fork, Sync fork → Update branch
- Cloudflare builds the connected branch
- Open
https://your-site/api/init/your-existing-init_secretto apply schema upgrades - Check login, inbox, and sending
Keep admin, secrets, D1, and KV in Cloudflare Settings. Do not put them back in GitHub.
CLI
After the first successful deploy, save your config as gitignored mail-worker/wrangler.local.toml:
sh
cd mail-view
npm install
npm run build
cd ../mail-worker
npm ci
npm run deploy:localIf you still use wrangler.toml, confirm it still has the original resource IDs, then npm run deploy.
Backup
- D1: dashboard backup / Time Travel, or Wrangler export
- Attachments: back up R2 / S3 / KV separately
- Secrets: keep
jwt_secret,init_secret, andtwo_factor_keyin a password manager. Changingtwo_factor_keybreaks existing authenticator data - Rollback: pick a known-good version in Worker Deployments. Rolling back code does not roll back the database