From a710728e77a7d5e83965a24055b923f0b7bb059a Mon Sep 17 00:00:00 2001
From: Mauricio Siu <47042324+Siumauricio@users.noreply.github.com>
Date: Sun, 22 Dec 2024 01:51:05 -0600
Subject: [PATCH 1/2] feat: add support for custom command
---
.../dashboard/compose/advanced/add-command.tsx | 9 ++++++++-
packages/server/src/utils/builders/compose.ts | 12 ++++++------
2 files changed, 14 insertions(+), 7 deletions(-)
diff --git a/apps/dokploy/components/dashboard/compose/advanced/add-command.tsx b/apps/dokploy/components/dashboard/compose/advanced/add-command.tsx
index 44ce15c0..6d1b455f 100644
--- a/apps/dokploy/components/dashboard/compose/advanced/add-command.tsx
+++ b/apps/dokploy/components/dashboard/compose/advanced/add-command.tsx
@@ -1,3 +1,4 @@
+import { AlertBlock } from "@/components/shared/alert-block";
import { Button } from "@/components/ui/button";
import {
Card,
@@ -91,7 +92,7 @@ export const AddCommandCompose = ({ composeId }: Props) => {
Run Command
- Append a custom command to the compose file
+ Override a custom command to the compose file
@@ -101,6 +102,12 @@ export const AddCommandCompose = ({ composeId }: Props) => {
onSubmit={form.handleSubmit(onSubmit)}
className="grid w-full gap-4"
>
+
+ Modifying the default command may affect deployment stability,
+ impacting logs and monitoring. Proceed carefully and test
+ thoroughly. By default, the command starts with{" "}
+ docker.
+
{
export const createCommand = (compose: ComposeNested) => {
const { composeType, appName, sourceType } = compose;
+ if (compose.command) {
+ return `${sanitizeCommand(compose.command)}`;
+ }
+
const path =
sourceType === "raw" ? "docker-compose.yml" : compose.composePath;
let command = "";
@@ -154,12 +160,6 @@ export const createCommand = (compose: ComposeNested) => {
command = `stack deploy -c ${path} ${appName} --prune`;
}
- const customCommand = sanitizeCommand(compose.command);
-
- if (customCommand) {
- command = `${command} ${customCommand}`;
- }
-
return command;
};
From c0e9670daf1fb2799e3afa524d597204e3fcd620 Mon Sep 17 00:00:00 2001
From: Mauricio Siu <47042324+Siumauricio@users.noreply.github.com>
Date: Sun, 22 Dec 2024 01:53:30 -0600
Subject: [PATCH 2/2] refactor: delete log
---
packages/server/src/utils/builders/compose.ts | 1 -
1 file changed, 1 deletion(-)
diff --git a/packages/server/src/utils/builders/compose.ts b/packages/server/src/utils/builders/compose.ts
index 583c739b..40f8d6d5 100644
--- a/packages/server/src/utils/builders/compose.ts
+++ b/packages/server/src/utils/builders/compose.ts
@@ -49,7 +49,6 @@ Compose Type: ${composeType} ✅`;
const projectPath = join(COMPOSE_PATH, compose.appName, "code");
- console.log("Command:", ...command.split(" "));
await spawnAsync(
"docker",
[...command.split(" ")],