Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion apps/dokploy/components/dashboard/docker/logs/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ const LOG_STYLES: Record<LogType, LogStyle> = {

export function parseLogs(logString: string): LogLine[] {
// Regex to match the log line format
// Exemple of return :
// Example of return :
// 1 2024-12-10T10:00:00.000Z The server is running on port 8080
// Should return :
// { timestamp: new Date("2024-12-10T10:00:00.000Z"),
Expand Down
2 changes: 1 addition & 1 deletion apps/dokploy/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "dokploy",
"version": "v0.17.4",
"version": "v0.17.5",
"private": true,
"license": "Apache-2.0",
"type": "module",
Expand Down
75 changes: 38 additions & 37 deletions packages/server/src/services/application.ts
Original file line number Diff line number Diff line change
Expand Up @@ -176,6 +176,7 @@ export const deployApplication = async ({
descriptionLog: string;
}) => {
const application = await findApplicationById(applicationId);

const buildLink = `${await getDokployUrl()}/dashboard/project/${application.projectId}/services/application/${application.applicationId}?tab=deployments`;
const deployment = await createDeployment({
applicationId: applicationId,
Expand All @@ -184,6 +185,12 @@ export const deployApplication = async ({
});

try {
const admin = await findAdminById(application.project.adminId);

if (admin.cleanupCacheApplications) {
await cleanupFullDocker(application?.serverId);
}

if (application.sourceType === "github") {
await cloneGithubRepository({
...application,
Expand Down Expand Up @@ -230,12 +237,6 @@ export const deployApplication = async ({
});

throw error;
} finally {
const admin = await findAdminById(application.project.adminId);

if (admin.cleanupCacheApplications) {
await cleanupFullDocker(application?.serverId);
}
}

return true;
Expand All @@ -251,13 +252,19 @@ export const rebuildApplication = async ({
descriptionLog: string;
}) => {
const application = await findApplicationById(applicationId);

const deployment = await createDeployment({
applicationId: applicationId,
title: titleLog,
description: descriptionLog,
});

try {
const admin = await findAdminById(application.project.adminId);

if (admin.cleanupCacheApplications) {
await cleanupFullDocker(application?.serverId);
}
if (application.sourceType === "github") {
await buildApplication(application, deployment.logPath);
} else if (application.sourceType === "gitlab") {
Expand All @@ -277,12 +284,6 @@ export const rebuildApplication = async ({
await updateDeploymentStatus(deployment.deploymentId, "error");
await updateApplicationStatus(applicationId, "error");
throw error;
} finally {
const admin = await findAdminById(application.project.adminId);

if (admin.cleanupCacheApplications) {
await cleanupFullDocker(application?.serverId);
}
}

return true;
Expand All @@ -298,6 +299,7 @@ export const deployRemoteApplication = async ({
descriptionLog: string;
}) => {
const application = await findApplicationById(applicationId);

const buildLink = `${await getDokployUrl()}/dashboard/project/${application.projectId}/services/application/${application.applicationId}?tab=deployments`;
const deployment = await createDeployment({
applicationId: applicationId,
Expand All @@ -307,6 +309,11 @@ export const deployRemoteApplication = async ({

try {
if (application.serverId) {
const admin = await findAdminById(application.project.adminId);

if (admin.cleanupCacheApplications) {
await cleanupFullDocker(application?.serverId);
}
let command = "set -e;";
if (application.sourceType === "github") {
command += await getGithubCloneCommand({
Expand Down Expand Up @@ -373,12 +380,6 @@ export const deployRemoteApplication = async ({
});

throw error;
} finally {
const admin = await findAdminById(application.project.adminId);

if (admin.cleanupCacheApplications) {
await cleanupFullDocker(application?.serverId);
}
}

return true;
Expand All @@ -396,6 +397,7 @@ export const deployPreviewApplication = async ({
previewDeploymentId: string;
}) => {
const application = await findApplicationById(applicationId);

const deployment = await createDeploymentPreview({
title: titleLog,
description: descriptionLog,
Expand Down Expand Up @@ -452,6 +454,12 @@ export const deployPreviewApplication = async ({
application.env = application.previewEnv;
application.buildArgs = application.previewBuildArgs;

const admin = await findAdminById(application.project.adminId);

if (admin.cleanupCacheOnPreviews) {
await cleanupFullDocker(application?.serverId);
}

if (application.sourceType === "github") {
await cloneGithubRepository({
...application,
Expand All @@ -461,7 +469,6 @@ export const deployPreviewApplication = async ({
});
await buildApplication(application, deployment.logPath);
}
// 4eef09efc46009187d668cf1c25f768d0bde4f91
const successComment = getIssueComment(
application.name,
"success",
Expand All @@ -486,12 +493,6 @@ export const deployPreviewApplication = async ({
previewStatus: "error",
});
throw error;
} finally {
const admin = await findAdminById(application.project.adminId);

if (admin.cleanupCacheOnPreviews) {
await cleanupFullDocker(application?.serverId);
}
}

return true;
Expand All @@ -509,6 +510,7 @@ export const deployRemotePreviewApplication = async ({
previewDeploymentId: string;
}) => {
const application = await findApplicationById(applicationId);

const deployment = await createDeploymentPreview({
title: titleLog,
description: descriptionLog,
Expand Down Expand Up @@ -566,6 +568,11 @@ export const deployRemotePreviewApplication = async ({
application.buildArgs = application.previewBuildArgs;

if (application.serverId) {
const admin = await findAdminById(application.project.adminId);

if (admin.cleanupCacheOnPreviews) {
await cleanupFullDocker(application?.serverId);
}
let command = "set -e;";
if (application.sourceType === "github") {
command += await getGithubCloneCommand({
Expand Down Expand Up @@ -604,12 +611,6 @@ export const deployRemotePreviewApplication = async ({
previewStatus: "error",
});
throw error;
} finally {
const admin = await findAdminById(application.project.adminId);

if (admin.cleanupCacheOnPreviews) {
await cleanupFullDocker(application?.serverId);
}
}

return true;
Expand All @@ -625,6 +626,7 @@ export const rebuildRemoteApplication = async ({
descriptionLog: string;
}) => {
const application = await findApplicationById(applicationId);

const deployment = await createDeployment({
applicationId: applicationId,
title: titleLog,
Expand All @@ -633,6 +635,11 @@ export const rebuildRemoteApplication = async ({

try {
if (application.serverId) {
const admin = await findAdminById(application.project.adminId);

if (admin.cleanupCacheApplications) {
await cleanupFullDocker(application?.serverId);
}
if (application.sourceType !== "docker") {
let command = "set -e;";
command += getBuildCommand(application, deployment.logPath);
Expand All @@ -657,12 +664,6 @@ export const rebuildRemoteApplication = async ({
await updateDeploymentStatus(deployment.deploymentId, "error");
await updateApplicationStatus(applicationId, "error");
throw error;
} finally {
const admin = await findAdminById(application.project.adminId);

if (admin.cleanupCacheApplications) {
await cleanupFullDocker(application?.serverId);
}
}

return true;
Expand Down
40 changes: 20 additions & 20 deletions packages/server/src/services/compose.ts
Original file line number Diff line number Diff line change
Expand Up @@ -206,6 +206,7 @@ export const deployCompose = async ({
descriptionLog: string;
}) => {
const compose = await findComposeById(composeId);

const buildLink = `${await getDokployUrl()}/dashboard/project/${
compose.projectId
}/services/compose/${compose.composeId}?tab=deployments`;
Expand All @@ -216,6 +217,10 @@ export const deployCompose = async ({
});

try {
const admin = await findAdminById(compose.project.adminId);
if (admin.cleanupCacheOnCompose) {
await cleanupFullDocker(compose?.serverId);
}
if (compose.sourceType === "github") {
await cloneGithubRepository({
...compose,
Expand Down Expand Up @@ -260,11 +265,6 @@ export const deployCompose = async ({
adminId: compose.project.adminId,
});
throw error;
} finally {
const admin = await findAdminById(compose.project.adminId);
if (admin.cleanupCacheOnCompose) {
await cleanupFullDocker(compose?.serverId);
}
}
};

Expand All @@ -278,13 +278,18 @@ export const rebuildCompose = async ({
descriptionLog: string;
}) => {
const compose = await findComposeById(composeId);

const deployment = await createDeploymentCompose({
composeId: composeId,
title: titleLog,
description: descriptionLog,
});

try {
const admin = await findAdminById(compose.project.adminId);
if (admin.cleanupCacheOnCompose) {
await cleanupFullDocker(compose?.serverId);
}
if (compose.serverId) {
await getBuildComposeCommand(compose, deployment.logPath);
} else {
Expand All @@ -301,11 +306,6 @@ export const rebuildCompose = async ({
composeStatus: "error",
});
throw error;
} finally {
const admin = await findAdminById(compose.project.adminId);
if (admin.cleanupCacheOnCompose) {
await cleanupFullDocker(compose?.serverId);
}
}

return true;
Expand All @@ -321,6 +321,7 @@ export const deployRemoteCompose = async ({
descriptionLog: string;
}) => {
const compose = await findComposeById(composeId);

const buildLink = `${await getDokployUrl()}/dashboard/project/${
compose.projectId
}/services/compose/${compose.composeId}?tab=deployments`;
Expand All @@ -331,6 +332,10 @@ export const deployRemoteCompose = async ({
});
try {
if (compose.serverId) {
const admin = await findAdminById(compose.project.adminId);
if (admin.cleanupCacheOnCompose) {
await cleanupFullDocker(compose?.serverId);
}
let command = "set -e;";

if (compose.sourceType === "github") {
Expand Down Expand Up @@ -404,11 +409,6 @@ export const deployRemoteCompose = async ({
adminId: compose.project.adminId,
});
throw error;
} finally {
const admin = await findAdminById(compose.project.adminId);
if (admin.cleanupCacheOnCompose) {
await cleanupFullDocker(compose?.serverId);
}
}
};

Expand All @@ -422,13 +422,18 @@ export const rebuildRemoteCompose = async ({
descriptionLog: string;
}) => {
const compose = await findComposeById(composeId);

const deployment = await createDeploymentCompose({
composeId: composeId,
title: titleLog,
description: descriptionLog,
});

try {
const admin = await findAdminById(compose.project.adminId);
if (admin.cleanupCacheOnCompose) {
await cleanupFullDocker(compose?.serverId);
}
if (compose.serverId) {
await getBuildComposeCommand(compose, deployment.logPath);
}
Expand All @@ -453,11 +458,6 @@ export const rebuildRemoteCompose = async ({
composeStatus: "error",
});
throw error;
} finally {
const admin = await findAdminById(compose.project.adminId);
if (admin.cleanupCacheOnCompose) {
await cleanupFullDocker(compose?.serverId);
}
}

return true;
Expand Down
Loading