feat(tamanu/start): probe started services and add --logs#436
Open
passcod wants to merge 3 commits into
Open
Conversation
Move the HTTP readiness-probe helpers (http_client, parse_duration, probe_until_ready, probe_url, probe_once) out of restart.rs into a new probe.rs, and extract the probe-URL construction (container IP for systemd, pm2 PORT for pm2) into a shared instance_probe_url. restart's probe_instance now calls into the shared module; no behaviour change. Co-authored-by: Claude <noreply@anthropic.com>
After bringing services up, probe the behind-caddy HTTP services (API, frontend, patient portal) for readiness within a single one-minute budget (--probe-timeout). The supervisor reporting a unit active isn't the same as the container accepting connections, so this catches services that started but never came up — start now bails (naming the failing service) instead of silently reporting success. --no-probe-http skips the check. Add --logs to stream the tamanu service logs (journalctl -f on systemd, pm2 logs on pm2) for the duration of the start/probe work. The follower is held in a Drop guard so it's torn down on both success and bail. Co-authored-by: Claude <noreply@anthropic.com>
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.
🤖
tamanu startpreviously returned as soon as the supervisor reported the units active — but an active unit isn't the same as the container accepting connections, so a service could be "started" yet not actually serving. This makesstartverify readiness using the same HTTP probes therestartcommand already had, and adds a--logsoption to watch startup.First commit extracts the probe primitives (
http_client,probe_until_ready,probe_url,probe_once,parse_duration, and the probe-URL construction) out ofrestart.rsinto a sharedprobemodule, withrestartdelegating to it — no behaviour change.Second commit adds to
start:--probe-timeout, default 1m). If any fails to respond in time,startbails with an error naming the service.--no-probe-httpskips the check.--logsstreams the tamanu service logs (journalctl on systemd, pm2 logs on Windows) for the duration of the start, torn down via a Drop guard when the command returns (on success or bail).The instance-selection logic is a pure helper covered by unit tests; the Windows build was cross-checked.