Skip to content

Add an SMTP health check for Docker and Coolify - #2

Merged
Skeyelab merged 1 commit into
mainfrom
healthcheck
Oct 16, 2026
Merged

Skeyelab merged 1 commit into
mainfrom
healthcheck

Conversation

@Skeyelab

Copy link
Copy Markdown
Member

Coolify showed the bridge as running:unknown because it has no health check. Coolify's default check is HTTP, which can't test an SMTP server. Its command check rejects quotes, semicolons and parentheses, so an inline python -c one-liner fails validation (422).

This adds python -m bridge.healthcheck:

  • connects to 127.0.0.1:$SMTP_PORT (default 2525) and sends NOOP
  • exits 0 when the server answers 250, and 1 on any connection or SMTP error
  • never logs in and never sends mail

The Dockerfile declares it as the image's HEALTHCHECK (every 30s, 10s timeout, 3 retries, 10s start period). The README has a short "Health check" section.

Tested:

  • 4 new tests: passes against a running bridge, fails with nothing listening, main reads SMTP_PORT, defaults to 2525. The full suite passes (66).
  • Built the image and ran it locally: Docker reported healthy, and docker exec … python -m bridge.healthcheck exited 0.

After merge and a manual Coolify deploy, set the Coolify app's health check to type cmd, command python -m bridge.healthcheck. Don't set it before deploying: the current image doesn't have the module, so the check would fail.

`python -m bridge.healthcheck` connects to the bridge's own SMTP port on
loopback and sends NOOP, exiting 0 when the server answers. It never
logs in or sends mail. The image declares it as its HEALTHCHECK, and it
works as a Coolify command check, where an inline python -c one-liner
is rejected and the default HTTP check can't test an SMTP server.

Assisted-by: Claude Code:claude-opus-5-5
@Skeyelab
Skeyelab merged commit ee025ba into main Oct 16, 2026
2 checks passed
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.

1 participant