From 63568a4887fa6cb973e91770b1f779dfe7d92472 Mon Sep 17 00:00:00 2001 From: spacewaterbear Date: Mon, 3 Nov 2025 23:27:18 +0100 Subject: [PATCH 1/3] feat: display environnement in notification --- .../src/emails/emails/build-success.tsx | 5 ++++ packages/server/src/services/application.ts | 2 ++ packages/server/src/services/compose.ts | 2 ++ .../src/utils/notifications/build-success.ts | 25 +++++++++++++++++-- 4 files changed, 32 insertions(+), 2 deletions(-) diff --git a/packages/server/src/emails/emails/build-success.tsx b/packages/server/src/emails/emails/build-success.tsx index d9e500ab9..e5e1d1bb4 100644 --- a/packages/server/src/emails/emails/build-success.tsx +++ b/packages/server/src/emails/emails/build-success.tsx @@ -19,6 +19,7 @@ export type TemplateProps = { applicationType: string; buildLink: string; date: string; + environmentName: string; }; export const BuildSuccessEmail = ({ @@ -27,6 +28,7 @@ export const BuildSuccessEmail = ({ applicationType = "application", buildLink = "https://dokploy.com/projects/dokploy-test/applications/dokploy-test", date = "2023-05-01T00:00:00.000Z", + environmentName = "production", }: TemplateProps) => { const previewText = `Build success for ${applicationName}`; return ( @@ -74,6 +76,9 @@ export const BuildSuccessEmail = ({ Application Name: {applicationName} + + Environment: {environmentName} + Application Type: {applicationType} diff --git a/packages/server/src/services/application.ts b/packages/server/src/services/application.ts index 1891f9b6b..6b4f41fd8 100644 --- a/packages/server/src/services/application.ts +++ b/packages/server/src/services/application.ts @@ -237,6 +237,7 @@ export const deployApplication = async ({ buildLink, organizationId: application.environment.project.organizationId, domains: application.domains, + environmentName: application.environment.name, }); } catch (error) { await updateDeploymentStatus(deployment.deploymentId, "error"); @@ -373,6 +374,7 @@ export const deployRemoteApplication = async ({ buildLink, organizationId: application.environment.project.organizationId, domains: application.domains, + environmentName: application.environment.name, }); } catch (error) { const errorMessage = error instanceof Error ? error.message : String(error); diff --git a/packages/server/src/services/compose.ts b/packages/server/src/services/compose.ts index 1436c52cc..03c44e937 100644 --- a/packages/server/src/services/compose.ts +++ b/packages/server/src/services/compose.ts @@ -265,6 +265,7 @@ export const deployCompose = async ({ buildLink, organizationId: compose.environment.project.organizationId, domains: compose.domains, + environmentName: compose.environment.name, }); } catch (error) { await updateDeploymentStatus(deployment.deploymentId, "error"); @@ -397,6 +398,7 @@ export const deployRemoteCompose = async ({ buildLink, organizationId: compose.environment.project.organizationId, domains: compose.domains, + environmentName: compose.environment.name, }); } catch (error) { // @ts-ignore diff --git a/packages/server/src/utils/notifications/build-success.ts b/packages/server/src/utils/notifications/build-success.ts index a93b3d547..5b5d6f518 100644 --- a/packages/server/src/utils/notifications/build-success.ts +++ b/packages/server/src/utils/notifications/build-success.ts @@ -22,6 +22,7 @@ interface Props { buildLink: string; organizationId: string; domains: Domain[]; + environmentName: string; } export const sendBuildSuccessNotifications = async ({ @@ -31,6 +32,7 @@ export const sendBuildSuccessNotifications = async ({ buildLink, organizationId, domains, + environmentName, }: Props) => { const date = new Date(); const unixDate = ~~(Number(date) / 1000); @@ -62,6 +64,7 @@ export const sendBuildSuccessNotifications = async ({ applicationType, buildLink, date: date.toLocaleString(), + environmentName, }), ).catch(); await sendEmailNotification(email, "Build success for dokploy", template); @@ -72,7 +75,7 @@ export const sendBuildSuccessNotifications = async ({ `${discord.decoration ? decoration : ""} ${text}`.trim(); await sendDiscordNotification(discord, { - title: decorate(">", "`✅` Build Success"), + title: decorate(">", "`✅` Build Successes"), color: 0x57f287, fields: [ { @@ -85,6 +88,11 @@ export const sendBuildSuccessNotifications = async ({ value: applicationName, inline: true, }, + { + name: decorate("`🌍`", "Environment"), + value: environmentName, + inline: true, + }, { name: decorate("`❔`", "Type"), value: applicationType, @@ -125,6 +133,7 @@ export const sendBuildSuccessNotifications = async ({ decorate("✅", "Build Success"), `${decorate("🛠️", `Project: ${projectName}`)}` + `${decorate("⚙️", `Application: ${applicationName}`)}` + + `${decorate("🌍", `Environment: ${environmentName}`)}` + `${decorate("❔", `Type: ${applicationType}`)}` + `${decorate("🕒", `Date: ${date.toLocaleString()}`)}` + `${decorate("🔗", `Build details:\n${buildLink}`)}`, @@ -139,6 +148,7 @@ export const sendBuildSuccessNotifications = async ({ `view, Build details, ${buildLink}, clear=true;`, `🛠Project: ${projectName}\n` + `⚙️Application: ${applicationName}\n` + + `🌍Environment: ${environmentName}\n` + `❔Type: ${applicationType}\n` + `🕒Date: ${date.toLocaleString()}`, ); @@ -167,7 +177,7 @@ export const sendBuildSuccessNotifications = async ({ await sendTelegramNotification( telegram, - `✅ Build Success\n\nProject: ${projectName}\nApplication: ${applicationName}\nType: ${applicationType}\nDate: ${format(date, "PP")}\nTime: ${format(date, "pp")}`, + `✅ Build Success\n\nProject: ${projectName}\nApplication: ${applicationName}\nEnvironment: ${environmentName}\nType: ${applicationType}\nDate: ${format(date, "PP")}\nTime: ${format(date, "pp")}`, inlineButton, ); } @@ -191,6 +201,11 @@ export const sendBuildSuccessNotifications = async ({ value: applicationName, short: true, }, + { + title: "Environment", + value: environmentName, + short: true, + }, { title: "Type", value: applicationType, @@ -260,6 +275,12 @@ export const sendBuildSuccessNotifications = async ({ text_align: "left", text_size: "normal_v2", }, + { + tag: "markdown", + content: `**Environment:**\n${environmentName}`, + text_align: "left", + text_size: "normal_v2", + }, { tag: "markdown", content: `**Type:**\n${applicationType}`, From 7a0ff72f5146ea20140cef141a009da861aa9462 Mon Sep 17 00:00:00 2001 From: Mauricio Siu Date: Thu, 20 Nov 2025 08:43:24 -0600 Subject: [PATCH 2/3] fix: improve Docker command execution by including environment variable exports - Updated the Docker command execution to include environment variable exports directly in the command, enhancing the handling of environment variables during deployment. - Simplified the export command structure for better readability and efficiency. Fix https://github.com/Dokploy/dokploy/pull/3066#issuecomment-3558022350 --- packages/server/src/utils/builders/compose.ts | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/packages/server/src/utils/builders/compose.ts b/packages/server/src/utils/builders/compose.ts index d196cef04..fe5417ea5 100644 --- a/packages/server/src/utils/builders/compose.ts +++ b/packages/server/src/utils/builders/compose.ts @@ -53,9 +53,8 @@ Compose Type: ${composeType} ✅`; cd "${projectPath}"; - ${exportEnvCommand} ${compose.isolatedDeployment ? `docker network inspect ${compose.appName} >/dev/null 2>&1 || docker network create --attachable ${compose.appName}` : ""} - env -i PATH="$PATH" docker ${command.split(" ").join(" ")} 2>&1 || { echo "Error: ❌ Docker command failed"; exit 1; } + env -i PATH="$PATH" ${exportEnvCommand} docker ${command.split(" ").join(" ")} 2>&1 || { echo "Error: ❌ Docker command failed"; exit 1; } ${compose.isolatedDeployment ? `docker network connect ${compose.appName} $(docker ps --filter "name=dokploy-traefik" -q) >/dev/null 2>&1` : ""} echo "Docker Compose Deployed: ✅"; @@ -66,7 +65,6 @@ Compose Type: ${composeType} ✅`; `; return bashCommand; - // return await execAsyncRemote(compose.serverId, bashCommand); }; const sanitizeCommand = (command: string) => { @@ -138,8 +136,8 @@ const getExportEnvCommand = (compose: ComposeNested) => { compose.environment.project.env, ); const exports = Object.entries(envVars) - .map(([key, value]) => `export ${key}=${quote([value])}`) - .join("\n"); + .map(([key, value]) => `${key}=${quote([value])}`) + .join(" "); - return exports ? `\n# Export environment variables\n${exports}\n` : ""; + return exports ? `${exports}` : ""; }; From ad0e044740a9a89c20289ed3292be88831605fb1 Mon Sep 17 00:00:00 2001 From: Mauricio Siu Date: Thu, 20 Nov 2025 08:48:33 -0600 Subject: [PATCH 3/3] chore: bump version to v0.25.10 in package.json --- apps/dokploy/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/apps/dokploy/package.json b/apps/dokploy/package.json index 9f2229937..e52968b15 100644 --- a/apps/dokploy/package.json +++ b/apps/dokploy/package.json @@ -1,6 +1,6 @@ { "name": "dokploy", - "version": "v0.25.9", + "version": "v0.25.10", "private": true, "license": "Apache-2.0", "type": "module",