Skip to content

Add Community Engine ingress target - #2

Merged
bettertogether-bts-robot merged 3 commits into
mainfrom
feat/ce-ingress-contract
Jul 3, 2026
Merged

bettertogether-bts-robot merged 3 commits into
mainfrom
feat/ce-ingress-contract

Conversation

@bettertogether-bts-robot

Copy link
Copy Markdown
Collaborator

Summary

  • Adds CeMailReceiver, speaking Community Engine's ActionMailbox-based ingress contract (raw RFC822 body, message/rfc822 content type, HTTP Basic Auth) instead of Discourse's own form-encoded /admin/email/handle_mail contract
  • Selected via MAIL_RECEIVER_TARGET=ce, reusing the existing DISCOURSE_API_KEY/DISCOURSE_API_USERNAME/DISCOURSE_MAIL_ENDPOINT env vars (semantics repurposed for the ce target) so boot's validation logic doesn't need to change — see README for the exact mapping
  • Renames the gem to bts_mail_receiver and drops the RubyGems publish CI job, since this fork isn't meant to publish under the upstream discourse_mail_receiver gem name

Context

This is a BTS-owned fork of discourse/mail-receiver, used to receive inbound mail for both existing Discourse instances (unchanged behavior, default target) and Community Engine (new). The Discourse-target code path is untouched.

Test plan

  • bundle exec rspec — 20 examples, 0 failures (16 existing + 4 new)
  • bundle exec rubocop — no offenses
  • bundle exec stree check — all files match expected format
  • CI green on this PR

Adds a CeMailReceiver class that speaks CE's ActionMailbox-based
ingress contract (raw RFC822 body, message/rfc822 content type, HTTP
Basic Auth) instead of Discourse's own form-encoded
/admin/email/handle_mail contract.

Selected via MAIL_RECEIVER_TARGET=ce, reusing the existing
DISCOURSE_API_KEY/DISCOURSE_API_USERNAME/DISCOURSE_MAIL_ENDPOINT env
vars (semantics repurposed for the ce target) so boot's validation
logic doesn't need to change.

Also: rename the gemspec/gem name to bts_mail_receiver and drop the
RubyGems publish CI job, since this fork isn't meant to publish under
the upstream discourse_mail_receiver gem name.
ci.yml still referenced discourse_mail_receiver.gemspec after the
prior commit renamed it to bts_mail_receiver.gemspec. Also reformats
ce_mail_receiver.rb to match syntax_tree's expected style.
Redesigns the CE ingress target to support true multi-domain routing
within a single container, rather than one target per container.

- boot: CE_MAIL_DOMAINS (subset of MAIL_DOMAIN) routes those domains
  to a new "ce" Postfix pipe transport instead of "discourse".
  Discourse/CE credential validation now only runs conditionally,
  based on whether any domain actually routes to that target.
- Dockerfile: defines the "ce" pipe transport, passing --target=ce to
  receive-mail (Discourse's existing transport is untouched).
- receive-mail: selects the receiver class per-invocation from a
  --target=<name> flag (set per-transport, defaults to "discourse"
  for existing deployments that never pass it) instead of a
  container-wide env var.
- CeMailReceiver: uses independently-named CE_API_KEY/CE_API_USERNAME/
  CE_MAIL_ENDPOINT instead of reusing DISCOURSE_* names, since both
  targets' credentials can now coexist in the same container's env.
  Bypasses MailReceiverBase's validating constructor (which hardcodes
  DISCOURSE_* requirements) rather than modifying it, to avoid
  touching the base class's existing upstream test contract.

This lets a single do-3 instance serve both bayofislands.newfoundlandlabrador.online
(Discourse) and communityengine.app (CE) without needing a second IP.
@bettertogether-bts-robot
bettertogether-bts-robot merged commit 9f9c642 into main Jul 3, 2026
1 check passed
@bettertogether-bts-robot
bettertogether-bts-robot deleted the feat/ce-ingress-contract branch July 3, 2026 22:11
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