Repository navigation
Conversation
For compose services with `deploy.replicas > 1`, Komodo lists each replica as its own service (`web-1`, `web-2`, ...). Stack log requests passed these names straight to `docker compose logs`, which silently returns nothing for unknown services, so the service Log tab was empty. - Add `compose_service` to `StackServiceNames`, set by Periphery on replica entries to the actual compose service name. - GetStackLog / SearchStackLog: a single replica request reads that replica's container log directly; otherwise replica names are mapped back to the compose service before calling `docker compose logs`. Stacks deployed before this change need a redeploy to record the mapping. Closes moghtech#1660 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Per-replica service entries already carry the replica number in their
`container_name` (eg `proj-web-1`), so the `^{name}-?[0-9]*$` pattern also
matched `proj-web-10`..`proj-web-19`, attaching the wrong container to `web-1`
for services with 10+ replicas. Match these entries exactly instead.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
SearchStackLog passed the bare compose service name to `docker service logs`,
while Swarm names stack services `{project}_{service}` (as GetStackLog already
handles), so searching Swarm stack logs always came back empty.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This branch has not been deployed
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
For compose services with
deploy.replicas > 1, the service Log tab is empty. Komodo lists each replica as its own service (web-1,web-2, ...) and passes those names straight todocker compose logs, which exits 0 with no output for names that aren't compose services. This PR maps replica entries back to the real compose service or container, and fixes two related bugs found along the way.Closes #1660.
Motivation
Periphery's
parse_compose_servicesexpands a replicated service into oneStackServiceNamesentry per replica:These entries are stored in
deployed_services/latest_servicesand returned byListStackServices, so the UI requests logs forservices: ["web-1"], and Core runs:Solution
fix: show logs for compose services with replicascompose_servicefield toStackServiceNames. Periphery sets it on per-replica entries to the actual compose service name (web). Other entries leave it asNone, and it isn't serialized for them.GetStackLog/SearchStackLog(Server mode):GetContainerLog/GetContainerLogSearchon that replica's exact container, so you see that replica's log.docker compose logs, so the stack-level Log tab shows all replicas combined.fix: match compose replica containers exactly: replica entries already include the replica number incontainer_name, so^proj-web-1-?[0-9]*$also matchedproj-web-10..proj-web-19. For services with 10+ replicas, that attached the wrong container toweb-1. Entries withcompose_serviceset are now matched exactly.fix: add project prefix when searching Swarm stack logs:SearchStackLogin Swarm mode passed the bare service name todocker service logs, without the{project}_prefix thatGetStackLogadds, so searching Swarm stack logs always returned nothing.The TS types (
client/core/ts/src/types.ts,ui/public/client/types.d.ts) were updated by hand to match typeshare output.Notes
compose_servicestored and need a redeploy to pick up the fix. A suffix-stripping fallback would be ambiguous with real services named likeweb-1, so I didn't add one.restart web-1→no such service: web-1). That's a behaviour change and should be its own issue/PR.Testing
cargo test -p komodo_core -p komodo_periphery: 4 new tests, all passing:replicas_record_compose_service: replica expansion setscompose_service, plain services don't.single_replica_resolves_container/replicas_map_to_compose_service: Core name resolution.container_match_regex: exact matching for replica entries (web-1no longer matchesweb-10).cargo checkandcargo fmt --checkare clean.docker compose logs/docker service logsbehaviour behind each fix with a 3-replica service (compose, and Swarm in docker-in-docker). Not yet tested end-to-end on a running Komodo instance.🤖 Generated with Claude Code