The shared inbox
Crew and staff answer info@ together in FreeScout, at https://inbox.<domain>
(cyc-seattle/platform#182). stacks/inbox deploys it per environment. features/inbox.feature
gives the rules.
How mail flows
- In: info@ is a Google group, and FreeScout reads only a real mailbox. The Workspace user
inbox@cyccommunitysailing.orgis a member of the group, and FreeScout reads its mail over IMAP every minute, signing in to Google with OAuth. The MX records don’t change. - Out: replies go through the Workspace SMTP relay,
smtp-relay.gmail.com:587, which admits the cluster’s NAT address (manual-setup.md). They’re from info@, and threaded with what the sender wrote. - FreeScout fetches only unread mail, and marks it read. Nobody should open inbox@ in Gmail, or FreeScout skips what they read.
What stacks/inbox holds
- FreeScout, as a
WebService, from our own image (stacks/inbox/image): PHP-FPM, nginx, and FreeScout’s scheduler in one container, as www-data, on a read-only root filesystem. A deploy builds the image when its tag isn’t in the registry, and runs it by digest, as for the syncs. - Its database,
inbox, on the environment’s Cloud SQL instance. FreeScout supports PostgreSQL, though MySQL is its first choice, so check every module works on PostgreSQL before you install it. - Its disk, the PersistentVolumeClaim
inbox-data(10 GiB,standard-rwo), mounted at/data: attachments, sessions, installed modules, and the.envFreeScout edits. It’s protected, since the storage class deletes the disk with the claim. The Deployment stops the old pod before it starts a new one, because the disk attaches to one node at a time. - The app key, which encrypts each mailbox’s Google sign-in in the database, and the break-glass
admin’s password. Prod keeps both in Secret Manager too:
inbox-app-keyandinbox-admin-password. - FreeScout’s OIDC client, as outputs that
authentikregisters.
The image sets FreeScout’s own mail (notifications and invitations) to the relay on every start
(stacks/inbox/image/configure.php). Each mailbox’s connection is set in FreeScout’s admin, since it
signs in to Google as its own user.
Signing in
Everyone signs in through Authentik, with FreeScout’s paid OAuth & Social Login module. The
authentik stack registers the Inbox application, and binds it to the FreeScout Agent group.
Only its members and Authentik’s superusers get in. The group-policies hook fills it with everyone a
Directus group gives the FreeScout Agent policy (access.md),
so an admin lets someone in from the Data Studio, never in Authentik.
A first sign-in makes a FreeScout user with no mailboxes. An admin then puts them on each mailbox they answer, under the mailbox’s Permissions. FreeScout’s admins see every mailbox.
When Authentik is down, the break-glass admin signs in with a password: its email is
inbox:adminEmail, and its password is in inbox-admin-password.
Once Force OAuth Login is on, FreeScout shows no password form. The module keeps that switch as
OAUTHLOGIN_FORCE_OAUTH_LOGIN=1 in FreeScout’s .env, which the image links to /data/.env on the
inbox-data disk. If sign-in through Authentik breaks, turn the switch off from a workplace checkout,
then sign in at /login as the break-glass admin:
kubectl -n prod exec deploy/inbox -- sh -c "sed -i '/^OAUTHLOGIN_FORCE_OAUTH_LOGIN=/d' /data/.env && php artisan cache:clear"The load balancer checks /healthz, which nginx answers itself, because /login redirects to
Authentik while Force OAuth Login is on.
Modules
Paid modules are bought once for each instance: a licence covers one. Prod has:
- OAuth & Social Login, for signing in through Authentik
- API & Webhooks, for the contact form later
A module is installed from FreeScout’s admin with its licence key, onto the disk, so a restart keeps it. No command enters a licence. manual-setup.md has the steps.
Backups
- The
inboxdatabase is copied tocsc-backupstwice a day with every other prod database (backups.md). - The disk
inbox-dataholds the attachments and installed modules. The backups copy buckets, not disks, so it isn’t copied yet. - A restored database needs the same
inbox-app-key. Without it, someone reconnects each mailbox by hand.