From 94ac4047253063c1e674c8a1193463f4c59e8ec8 Mon Sep 17 00:00:00 2001 From: Anthony Ettinger Date: Tue, 23 Jun 2026 16:16:25 +0000 Subject: [PATCH] =?UTF-8?q?fix(setup):=20rename=20MAIL=20toggle=20to=20MAI?= =?UTF-8?q?L=5FSTACK=20=E2=80=94=20it=20collided=20with=20the=20reserved?= =?UTF-8?q?=20$MAIL=20env=20var?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The mail Caddy route (mail.) and the entire §9e Mailu provisioning block were gated on $MAIL, but MAIL is a standard env var (the mail-spool path) that PAM's pam_mail sets for the sudo session the CI deploy runs under. So deploys saw MAIL=/var/mail/root (!= "1"), silently skipping: the mail. Caddy block (webmail went down with TLS handshake aborts), the AGENTBBS_MAIL_SMTP_* env upserts (incl. the new SMTP_SERVERNAME), AND it ran the else-branch which disabled the mail cert-refresh timer every deploy. Rename the toggle to MAIL_STACK (no collision) so all of it actually runs. Matches the intermittent 'mail block dropped after a deploy' seen before. Co-Authored-By: Claude Opus 4.8 --- setup.sh | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/setup.sh b/setup.sh index 57175db..7c63e25 100755 --- a/setup.sh +++ b/setup.sh @@ -53,7 +53,7 @@ ERGO_DATA="${ERGO_DATA:-/var/lib/ergo}" # Ergo state dir (ircd.db, tls/) FORGEJO="${FORGEJO:-1}" # set 0 to skip the AgentGit Forgejo backend (git.${DOMAIN#*.}) GIT_DOMAIN="${GIT_DOMAIN:-git.${DOMAIN#*.}}" # AgentGit host (default: git., e.g. git.profullstack.com) FORGEJO_VERSION="${FORGEJO_VERSION:-11.0.1}" # Forgejo release to install -MAIL="${MAIL:-1}" # set 0 to skip the co-located Mailu mail stack (mail.${DOMAIN#*.}) +MAIL_STACK="${MAIL_STACK:-1}" # set 0 to skip the co-located Mailu mail stack (mail.${DOMAIN#*.}). NOT named MAIL: that is a reserved env var (the mail-spool path, e.g. /var/mail/root) which PAM sets under sudo, so a CI deploy inherited MAIL=/var/mail/root and silently dropped the mail Caddy route + §9e provisioning. MAIL_DOMAIN="${MAIL_DOMAIN:-mail.${DOMAIN#*.}}" # mail host (default: mail., e.g. mail.profullstack.com) FORGEJO_HTTP_ADDR="${FORGEJO_HTTP_ADDR:-127.0.0.1:3000}" # Forgejo loopback HTTP (Caddy fronts it) FORGEJO_DATA="${FORGEJO_DATA:-/var/lib/forgejo}" # Forgejo state dir (repos, db) @@ -681,9 +681,9 @@ fi # Mail site (${MAIL_DOMAIN}): Caddy serving this host obtains the LE cert that # Mailu reuses for SMTP/IMAP TLS (deploy/mailu/refresh-certs.sh copies it). It # also fronts the loopback Roundcube webmail. Needs A record ${MAIL_DOMAIN} -> -# this host. Webmail is the only member-facing mail surface. Omitted when MAIL=0. +# this host. Webmail is the only member-facing mail surface. Omitted when MAIL_STACK=0. MAIL_SITE="" -if [ "$MAIL" = "1" ]; then +if [ "$MAIL_STACK" = "1" ]; then MAIL_SITE=" ${MAIL_DOMAIN} { encode zstd gzip @@ -1132,9 +1132,9 @@ fi # the mail ports; Caddy fronts the loopback webmail and supplies the TLS cert # (TLS_FLAVOR=mail). agentbbs reads/sends on behalf of EVERY verified member # (free + paid) — addresses are @${DOMAIN}, the server is ${MAIL_DOMAIN}. -# Full setup, DNS, and the gateway master user: docs/mail.md. Disable with MAIL=0. +# Full setup, DNS, and the gateway master user: docs/mail.md. Disable with MAIL_STACK=0. MAILU_DIR="${SRC_DIR}/deploy/mailu" -if [ "$MAIL" = "1" ]; then +if [ "$MAIL_STACK" = "1" ]; then log "configuring Mailu mail stack (server ${MAIL_DOMAIN}, addresses @${DOMAIN})" # Tell agentbbs how to reach the mailbox backend (master user/pass + the Mailu # API token are secrets the operator sets; see docs/mail.md).