mirror of
https://github.com/Dokploy/dokploy.git
synced 2026-06-29 19:15:22 +02:00
fix: resolve server from parent entity in deployment.readLogs (#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 #4687 Co-authored-by: Roo <roo@agent.com>
This commit is contained in:
@@ -243,7 +243,11 @@ export const deploymentRouter = createTRPCRouter({
|
||||
}
|
||||
|
||||
const command = `tail -n ${input.tail} "${deployment.logPath}" 2>/dev/null || echo ""`;
|
||||
const serverId = deployment.serverId || deployment.schedule?.serverId;
|
||||
const serverId =
|
||||
deployment.serverId ||
|
||||
deployment.schedule?.serverId ||
|
||||
deployment.application?.serverId ||
|
||||
deployment.compose?.serverId;
|
||||
if (serverId) {
|
||||
const { stdout } = await execAsyncRemote(serverId, command);
|
||||
return stdout;
|
||||
|
||||
@@ -84,6 +84,7 @@ export const findDeploymentById = async (deploymentId: string) => {
|
||||
where: eq(deployments.deploymentId, deploymentId),
|
||||
with: {
|
||||
application: true,
|
||||
compose: true,
|
||||
schedule: true,
|
||||
},
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user