Skip to content

Commit b4e2d27

Browse files
elijahdev0Roo
andauthored
fix: resolve server from parent entity in deployment.readLogs (Dokploy#4689)
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 Co-authored-by: Roo <[email protected]>
1 parent 24b02f5 commit b4e2d27

2 files changed

Lines changed: 6 additions & 1 deletion

File tree

‎apps/dokploy/server/api/routers/deployment.ts‎

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -243,7 +243,11 @@ export const deploymentRouter = createTRPCRouter({
243243
}
244244

245245
const command = `tail -n ${input.tail} "${deployment.logPath}" 2>/dev/null || echo ""`;
246-
const serverId = deployment.serverId || deployment.schedule?.serverId;
246+
const serverId =
247+
deployment.serverId ||
248+
deployment.schedule?.serverId ||
249+
deployment.application?.serverId ||
250+
deployment.compose?.serverId;
247251
if (serverId) {
248252
const { stdout } = await execAsyncRemote(serverId, command);
249253
return stdout;

‎packages/server/src/services/deployment.ts‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,7 @@ export const findDeploymentById = async (deploymentId: string) => {
8484
where: eq(deployments.deploymentId, deploymentId),
8585
with: {
8686
application: true,
87+
compose: true,
8788
schedule: true,
8889
},
8990
});

0 commit comments

Comments
 (0)