feat(mail): offload per-account Archive folders to Hetzner Storage Box #238
No reviewers
Labels
No labels
bug
enhancement
in-progress
needs-info
needs-triage
p0
ready-for-agent
ready-for-human
wontfix
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
Cloonar/nixos!238
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "lab/20260726-1358"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Closes #237.
The mail disk is running full. This gives every account archive folders stored on a Hetzner Storage Box instead of the local disk. Users archive manually via their client's archive action; quota semantics are unchanged because the user quota root spans all private namespaces.
What this does
CIFS automount of a Storage Box sub-account at
/mnt/mail-archive— same sops-credentials + systemd-automount pattern as the Immich originals mount on web-arm.noauto+ automount keeps dovecot startup independent of the Storage Box: if it's unreachable, only archive folders error; INBOX and delivery keep working.Two Dovecot namespaces on the mount, covering every mainstream client's default archive folder name:
Archive.— Apple Mail, Outlook, Windows Mail, Roundcube, K-9/Thunderbird AndroidArchives.— Thunderbird desktop (hardcodedArchives/<year>; TB ignores the RFC 6154\Archivespecial-use flag, so it can't be redirected server-side)Deliberately two real folder trees rather than a hidden
alias_fornamespace — folders clients CREATE but never see in LIST invite per-client quirks. Content splits by whichever name a client uses; both trees are on the Storage Box.INDEX(index/cache + fts-lucene) andCONTROL(uidlist, subscriptions) for both namespaces stay under/var/vmail, so IMAP metadata and locking never touch the network share — only message bodies do. Those local dirs also stay inside borg's paths.Backup of archived mail is via the Storage Box's automatic snapshots (like Immich), not borg — the mount is deliberately outside borg's paths.
⚠️ Required before merge (config cannot build without these)
u149513-sub13— if the actual name differs, update thedeviceline inhosts/mail/modules/mail-archive.nix.nix-shell -p sops --run 'sops hosts/mail/secrets.yaml'): sops-nix validates secret keys at eval time, so the mail config fails to build until this key exists.Note: the pre-commit dry-build could not run in this environment (no Nix installed), so these commits are not build-verified. Please run
./scripts/test-configuration mailafter adding the secret, before merging.Migration of existing archives (after deploy)
Accounts that already have
.Archive*/.Archives*folders under their Maildir keep working (shadowed by the new namespaces) but stay on local disk until moved:No chown needed — the mount forces uid/gid to vmail. UIDs change, so clients re-download the archive folders once; users may also need to re-subscribe to archive subfolders (subscriptions now live in each namespace's own CONTROL dir).
Pushed
6c7df22: namespace renamedArchive.→Archives.so Thunderbird's default archiving works out of the box. TB archives to "Archives/" and ignores the RFC 6154 \Archive special-use flag, so the singular name would have been silently bypassed (TB would have created a plain local-disk folder).Migration note: accounts where users already archived with Thunderbird have existing local
.Archives*maildirs — the runbook in the PR description applies to those the same way (.Archives→ namespace root,.Archives.2025→.2025). A leftover singular.Archive*tree (non-TB clients) is not shadowed by the namespace and can be moved into Archives/ via IMAP or the same rsync pattern.Clients that default to a different archive name (Apple Mail uses "Archive") need their archive folder pointed at "Archives" in account settings, or they'll archive to an ordinary local-disk folder. If that becomes a real problem we can add a hidden dovecot alias namespace
Archive.→Archives.later.Pushed
7b48dd0: second namespaceArchive.added alongsideArchives.so the default archive folder of Apple Mail / Outlook / Windows Mail / Roundcube / K-9 also lands on the Storage Box, not just Thunderbird's. PR description (incl. migration runbook) updated for the two per-name directories on the mount.View command line instructions
Checkout
From your project repository, check out a new branch and test the changes.Merge
Merge the changes and update on Forgejo.Warning: The "Autodetect manual merge" setting is not enabled for this repository, you will have to mark this pull request as manually merged afterwards.