Refactor application and compose deployment logic: remove unused buildApplication function, streamline command logging for deployment, and enhance static command generation for improved maintainability and clarity in the codebase.

This commit is contained in:
Mauricio Siu
2025-11-09 11:13:39 -06:00
parent d8ab7a59ff
commit b814bdc612
6 changed files with 38 additions and 114 deletions
@@ -7,7 +7,6 @@ import {
} from "@dokploy/server/db/schema";
import { getAdvancedStats } from "@dokploy/server/monitoring/utils";
import {
buildApplication,
getBuildCommand,
mechanizeDockerContainer,
} from "@dokploy/server/utils/builders";
@@ -187,8 +186,6 @@ export const deployApplication = async ({
command += await cloneBitbucketRepository(application);
} else if (application.sourceType === "git") {
command += await cloneGitRepository(application);
} else if (application.sourceType === "drop") {
await buildApplication(application, deployment.logPath);
} else if (application.sourceType === "docker") {
command += await buildRemoteDocker(application);
}
+16 -2
View File
@@ -232,8 +232,15 @@ export const deployCompose = async ({
command += getCreateComposeFileCommand(entity);
}
let commandWithLog = `(${command}) >> ${deployment.logPath} 2>&1`;
if (compose.serverId) {
await execAsyncRemote(compose.serverId, commandWithLog);
} else {
await execAsync(commandWithLog);
}
command += await getBuildComposeCommand(entity);
const commandWithLog = `(${command}) >> ${deployment.logPath} 2>&1`;
commandWithLog = `(${command}) >> ${deployment.logPath} 2>&1`;
if (compose.serverId) {
await execAsyncRemote(compose.serverId, commandWithLog);
} else {
@@ -293,8 +300,15 @@ export const rebuildCompose = async ({
if (compose.sourceType === "raw") {
command += getCreateComposeFileCommand(compose);
}
let commandWithLog = `(${command}) >> ${deployment.logPath} 2>&1`;
if (compose.serverId) {
await execAsyncRemote(compose.serverId, commandWithLog);
} else {
await execAsync(commandWithLog);
}
command += await getBuildComposeCommand(compose);
const commandWithLog = `(${command}) >> ${deployment.logPath} 2>&1`;
commandWithLog = `(${command}) >> ${deployment.logPath} 2>&1`;
if (compose.serverId) {
await execAsyncRemote(compose.serverId, commandWithLog);
} else {