Migrate mail service from Docker to native Mailpit binary#61
Merged
munezaclovis merged 5 commits intomainfrom Apr 15, 2026
Merged
Migrate mail service from Docker to native Mailpit binary#61munezaclovis merged 5 commits intomainfrom
munezaclovis merged 5 commits intomainfrom
Conversation
Mirrors the Mago pattern: .tar.gz download + ExtractTarGz + chmod. Wired into InstallBinary via a new mailpit case. Not added to Tools() because Mailpit is a backing service, not a CLI tool.
Mailpit registers itself as "mail" in the binary registry. Uses the HTTP ReadyCheck variant pointing at /livez — the first user of the HTTP probe since RustFS uses TCP. EnvVars keys/values are pinned against the current Docker Mail service so linked projects do not need .env rewrites after the migration. Also deduplicates Available() so "mail" is not double-counted while both Docker registry and binaryRegistry carry the key during migration (Task 4 will remove the Docker side).
The Mailpit BinaryService registered itself as "mail" in Task 3; the Docker Mail struct is removed along with its tests. The Docker registry map no longer contains mail. No other code changes needed because the service:* command dispatcher (from the rustfs plan) already routes "mail" to the binary path via resolveKind.
Mirrors the rustfs E2E: service:add, stop, start, destroy. Uses curl on /livez rather than nc, exercising the HTTP ReadyCheck path for the first time in CI.
…mments - destroy.go + remove.go: stop swallowing errors on os.Remove, LoadVersions, vs.Save, and SignalDaemon (destroy.go only — remove.go already logged it); surface them via ui.Subtle so stale versions-manifest state or left-behind binaries are visible to the user instead of silent. - TestMailpit_Args_PinsBindAddresses: new test pinning --smtp :1025 and --listen :8025 to catch port/Args drift against Port / ConsolePort / the EnvVars golden map. - mailpit.go: doc comment explaining the deliberate Mailpit→"mail" naming mismatch (preserves the old Docker service key); removed "Task 1" reference and added a note on /livez; documented init() self-registration. - service.go: rephrased Available() dedup comment without transient "during migration" language.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
mailservice (axllent/mailpit:latestcontainer) with the upstream Mailpit binary, supervised by the pv daemon via theBinaryServiceinfrastructure built for RustFS."mail", SMTP/HTTP ports 1025/8025,WebRoute{mail, 8025}, and theMAIL_*env var keys/values — linked Laravel projects keep working with zero.envrewrites (pinned via golden test)./livezready-probe branch ofBinaryService.ReadyCheckfor the first time (rustfs uses TCP), closing the remaining untested code path in the supervisor wiring.Five commits:
binaries.Mailpitdescriptor +installMailpit(tar.gz download + extract + chmod).Mailpitstruct implementingBinaryService, registered as"mail".Mailstruct + its tests;"mail"is now binary-only.add→/livez→:1025→stop→start→destroy) wired into CI as Phase 21.destroy.go/remove.go, pin bind addresses in the Args test, polish comments.Test plan
go build ./.../go vet ./.../go test ./...(28 packages passing locally)scripts/e2e/mail-binary.shexercises:service:add mail, binary present + executable,daemon-status.jsonlistsmailpit, HTTP/livez200, TCP 1025 reachable,service:stopstops it,service:startrestarts it,service:destroyremoves binary + data dir.mailentry →resolveKinderrors with the "run pv uninstall && pv setup to reset" remedy (no silent auto-migration).pv service:add mail—.envkeys unchanged, SMTP listens on 1025.Known deferred work (not regressions from this PR — all pre-existing from rustfs)
Pre-existing callsites that only consult the Docker registry and silently mishandle any registered binary service. Mail now inherits these gaps:
cmd/setup.go— mail disappears from the wizard checkbox list and is not installed by the post-wizard loop.internal/commands/service/env.go—pv service:env mailprints "Skipping unknown service" / errors out.cmd/doctor.go— reports a healthy mail as "unknown service type — registry may be out of date".These are best closed in a dedicated follow-up PR that introduces a
services.LookupAny(name)helper, so the fix lands in one place rather than four.Also deferred: tightening
ReadyCheckinto a proper sum type (TCPReady/HTTPReadyconstructors), addingTestBuildSupervisorProcess_Mailpit, and extending the E2E to assert linked-project.envinjection.