Skip to content

agent: fix mail stack on Debian 13 (Dovecot 2.4 pgsql syntax, postfix inaccurate state) - #509

Merged
cmyers-mieweb merged 1 commit into
mainfrom
cmyers_mail-fix-dovecot24-postfix-status
Nov 10, 2026
Merged

cmyers-mieweb merged 1 commit into
mainfrom
cmyers_mail-fix-dovecot24-postfix-status

Conversation

@cmyers-mieweb

Copy link
Copy Markdown
Collaborator

Two deployment bugs found bringing up the first real mail host: #384

  • dovecot.conf.ejs rendered libpq key/values (dbname/user/password) directly inside the pgsql block, which Dovecot 2.4 rejects ('Unknown setting: dbname' — pgsql only has pgsql_parameters). Nest them in parameters { }; mysql keeps its native per-key settings. doveconf -n refused the config at every apply, so the managed dovecot config was never installed.

  • The check-in reported postfix state from the postfix@- instance. That matches Debian <= 12 (postfix.service is a RemainAfterExit wrapper), but Debian 13 runs master directly in postfix.service and leaves postfix@- inactive, so a healthy MTA showed as 'postfix: inactive' on the Agents page. Report the instance state when it says anything meaningful, and fall back to postfix.service only when it has a running main process (SubState=running), which still excludes the old wrapper's active (exited).

ManagedService.statusUnit is replaced by an optional status() override (postfix was its only user); system.ts gains getServiceSubState.

… status unit)

Two deployment bugs found bringing up the first real mail host:

- dovecot.conf.ejs rendered libpq key/values (dbname/user/password)
  directly inside the pgsql block, which Dovecot 2.4 rejects
  ('Unknown setting: dbname' — pgsql only has pgsql_parameters). Nest
  them in parameters { }; mysql keeps its native per-key settings.
  doveconf -n refused the config at every apply, so the managed dovecot
  config was never installed.

- The check-in reported postfix state from the postfix@- instance.
  That matches Debian <= 12 (postfix.service is a RemainAfterExit
  wrapper), but Debian 13 runs master directly in postfix.service and
  leaves postfix@- inactive, so a healthy MTA showed as 'postfix:
  inactive' on the Agents page. Report the instance state when it says
  anything meaningful, and fall back to postfix.service only when it
  has a running main process (SubState=running), which still excludes
  the old wrapper's active (exited).

ManagedService.statusUnit is replaced by an optional status() override
(postfix was its only user); system.ts gains getServiceSubState.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔵 Needs a closer look

The deployment fixes require on-host validation with Dovecot 2.4 and both Postfix systemd layouts because existing tests do not confirm parser acceptance or actual D-Bus service states.

No open issues 🎉

What changed in this PR

Fixes Debian 13 mail deployment and status reporting in the agent while preserving support for older Debian Postfix layouts.

Changes:

  • Nests PostgreSQL connection settings under Dovecot 2.4’s parameters block while retaining MySQL syntax.
  • Adds a service-status override so Postfix reporting can distinguish a running daemon from an exited wrapper.
  • Adds regression tests for Dovecot SQL configuration and Postfix status selection.
File Description
agent/​test/​postfix-status.test.js Tests Postfix status selection across Debian service layouts.
agent/​test/​mail-template.test.js Tests PostgreSQL parameter nesting and unchanged MySQL syntax.
agent/​templates/​mail/​dovecot.conf.ejs Corrects PostgreSQL configuration syntax for Dovecot 2.4.
agent/​src/​system.ts Shares systemd property lookup and adds SubState retrieval.
agent/​src/​mail.ts Selects Postfix status using instance state and main-service running state.
agent/​src/​index.ts Uses service-specific status overrides during check-in.
agent/​src/​apply.ts Replaces statusUnit with an optional status callback.

Review effort: Balanced

@cmyers-mieweb
cmyers-mieweb merged commit 9356491 into main Nov 10, 2026
9 checks passed
@cmyers-mieweb
cmyers-mieweb deleted the cmyers_mail-fix-dovecot24-postfix-status branch November 10, 2026 16:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants