fix: resolve server from parent entity in deployment.readLogs#4689
Open
elijahdev0 wants to merge 1 commit into
Open
fix: resolve server from parent entity in deployment.readLogs#4689elijahdev0 wants to merge 1 commit into
elijahdev0 wants to merge 1 commit into
Conversation
The readLogs endpoint only checked deployment.serverId and deployment.schedule?.serverId to determine where to read log files. For application and compose deployments on remote servers, serverId is not stored on the deployment record — the server is resolved from the parent entity (application.serverId, compose.serverId). This caused readLogs to fall through to local execAsync, which would silently fail (2>/dev/null) because the log file lives on the remote server, returning empty content. Fix by loading the compose relation in findDeploymentById and adding fallback resolution through application?.serverId and compose?.serverId. Fixes Dokploy#4687
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.
Problem
The
deployment.readLogsendpoint returns empty content for deployments on remote servers.Root cause: The handler only checks
deployment.serverIdanddeployment.schedule?.serverIdto determine where to read the log file. For application and compose deployments,serverIdis not stored on the deployment record — the server is resolved from the parent entity (application.serverId,compose.serverId).When
serverIdis null, the handler falls through to localexecAsync(command), which runstaillocally. But the log file lives on the remote server, so2>/dev/nullsuppresses the "file not found" error and returns"".Fix
composerelation infindDeploymentById(it already loadsapplicationandschedule)application?.serverIdandcompose?.serverIdin thereadLogshandlerReproduction
GET /api/deployment.readLogs?deploymentId=xxx&tail=100\n(empty)Fixes #4687