fix: resolve traefik container dynamically in access-log cleanup (swarm mode)#4646
Open
Siumauricio wants to merge 1 commit into
Open
fix: resolve traefik container dynamically in access-log cleanup (swarm mode)#4646Siumauricio wants to merge 1 commit into
Siumauricio wants to merge 1 commit into
Conversation
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
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.
What is this PR about?
The nightly
access-log-cleanupjob inpackages/server/src/utils/access-log/handler.tshardcodeddokploy-traefikas the container name when sendingSIGUSR1. In Docker Swarm mode Traefik runs as a service task nameddokploy-traefik.1.<task-id>, sodocker exec dokploy-traefik kill -USR1 1fails every night withNo 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-diskaccess.logstays frozen at 1000 lines while real traffic logs accumulate in a deleted file handle.This is a supported deployment mode —
writeTraefikSetupstill branches toinitializeTraefikService(swarm service) andcheckTraefikHealthexplicitly 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 incompose.tsandsettings.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