Skip to content

fix: resolve traefik container dynamically in access-log cleanup (swarm mode)#4646

Open
Siumauricio wants to merge 1 commit into
canaryfrom
claude/suspicious-feynman-a8aaf1
Open

fix: resolve traefik container dynamically in access-log cleanup (swarm mode)#4646
Siumauricio wants to merge 1 commit into
canaryfrom
claude/suspicious-feynman-a8aaf1

Conversation

@Siumauricio

Copy link
Copy Markdown
Contributor

What is this PR about?

The nightly access-log-cleanup job in packages/server/src/utils/access-log/handler.ts hardcoded dokploy-traefik as the container name when sending SIGUSR1. In Docker Swarm mode Traefik runs as a service task named dokploy-traefik.1.<task-id>, so docker exec dokploy-traefik kill -USR1 1 fails every night with No such container. The log file gets rotated (tail ... > .tmp && mv, which changes the inode) but Traefik never receives the signal to reopen it, so the on-disk access.log stays frozen at 1000 lines while real traffic logs accumulate in a deleted file handle.

This is a supported deployment mode — writeTraefikSetup still branches to initializeTraefikService (swarm service) and checkTraefikHealth explicitly handles both standalone and swarm Traefik.

The fix resolves the running container id dynamically with docker ps -q --filter "name=dokploy-traefik" --filter "status=running", the same pattern already used in compose.ts and settings.ts. It works for both standalone (dokploy-traefik) and swarm (dokploy-traefik.1.<task-id>) deployments, and skips gracefully if no running container is found.

Issues related (if applicable)

closes #4620

The nightly access-log-cleanup job hardcoded "dokploy-traefik" as the
container name when sending SIGUSR1. In Docker Swarm mode Traefik runs as
a service task named "dokploy-traefik.1.<task-id>", so `docker exec
dokploy-traefik` fails every night with "No such container". The log file
is rotated (inode changes) but Traefik never reopens it, leaving the
on-disk access.log frozen while real logs go to a deleted file handle.

Resolve the running container id dynamically with `docker ps --filter`,
matching the pattern already used elsewhere in the codebase, so it works
for both standalone and swarm deployments. Skip gracefully if no running
container is found.

Closes #4620
@dosubot dosubot Bot added size:S This PR changes 10-29 lines, ignoring generated files. bug Something isn't working labels Jun 16, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working size:S This PR changes 10-29 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Bug: access-log-cleanup fails nightly in Docker Swarm — hardcoded container name 'dokploy-traefik' doesn't match swarm task name

1 participant