From 4330d7bd99f07b88ccf81d1d4a8a64a13907f710 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ji=C5=99=C3=AD=20Vrba?= Date: Mon, 9 Mar 2026 09:25:41 +0100 Subject: [PATCH 01/18] feat(deployments): Add option to copy webhook url by clicking on it --- .../deployments/show-deployments.tsx | 831 +++++++++--------- 1 file changed, 423 insertions(+), 408 deletions(-) diff --git a/apps/dokploy/components/dashboard/application/deployments/show-deployments.tsx b/apps/dokploy/components/dashboard/application/deployments/show-deployments.tsx index 61841e294..0cc096f5c 100644 --- a/apps/dokploy/components/dashboard/application/deployments/show-deployments.tsx +++ b/apps/dokploy/components/dashboard/application/deployments/show-deployments.tsx @@ -1,12 +1,12 @@ import { - ChevronDown, - ChevronUp, - Clock, - Loader2, - RefreshCcw, - RocketIcon, - Settings, - Trash2, + ChevronDown, + ChevronUp, + Clock, Copy, + Loader2, + RefreshCcw, + RocketIcon, + Settings, + Trash2, } from "lucide-react"; import React, { useEffect, useMemo, useState } from "react"; import { toast } from "sonner"; @@ -17,11 +17,11 @@ import { StatusTooltip } from "@/components/shared/status-tooltip"; import { Badge } from "@/components/ui/badge"; import { Button } from "@/components/ui/button"; import { - Card, - CardContent, - CardDescription, - CardHeader, - CardTitle, + Card, + CardContent, + CardDescription, + CardHeader, + CardTitle, } from "@/components/ui/card"; import { api, type RouterOutputs } from "@/utils/api"; import { ShowRollbackSettings } from "../rollbacks/show-rollback-settings"; @@ -30,441 +30,456 @@ import { ClearDeployments } from "./clear-deployments"; import { KillBuild } from "./kill-build"; import { RefreshToken } from "./refresh-token"; import { ShowDeployment } from "./show-deployment"; +import copy from "copy-to-clipboard"; interface Props { - id: string; - type: - | "application" - | "compose" - | "schedule" - | "server" - | "backup" - | "previewDeployment" - | "volumeBackup"; - refreshToken?: string; - serverId?: string; + id: string; + type: + | "application" + | "compose" + | "schedule" + | "server" + | "backup" + | "previewDeployment" + | "volumeBackup"; + refreshToken?: string; + serverId?: string; } export const formatDuration = (seconds: number) => { - if (seconds < 60) return `${seconds}s`; - const minutes = Math.floor(seconds / 60); - const remainingSeconds = seconds % 60; - return `${minutes}m ${remainingSeconds}s`; + if (seconds < 60) return `${seconds}s`; + const minutes = Math.floor(seconds / 60); + const remainingSeconds = seconds % 60; + return `${minutes}m ${remainingSeconds}s`; }; export const ShowDeployments = ({ - id, - type, - refreshToken, - serverId, + id, + type, + refreshToken, + serverId, }: Props) => { - const [activeLog, setActiveLog] = useState< - RouterOutputs["deployment"]["all"][number] | null - >(null); - const { data: deployments, isPending: isLoadingDeployments } = - api.deployment.allByType.useQuery( - { - id, - type, - }, - { - enabled: !!id, - refetchInterval: 1000, - }, - ); + const [activeLog, setActiveLog] = useState< + RouterOutputs["deployment"]["all"][number] | null + >(null); + const { data: deployments, isPending: isLoadingDeployments } = + api.deployment.allByType.useQuery( + { + id, + type, + }, + { + enabled: !!id, + refetchInterval: 1000, + }, + ); - const { data: isCloud } = api.settings.isCloud.useQuery(); + const { data: isCloud } = api.settings.isCloud.useQuery(); - const { mutateAsync: rollback, isPending: isRollingBack } = - api.rollback.rollback.useMutation(); - const { mutateAsync: killProcess, isPending: isKillingProcess } = - api.deployment.killProcess.useMutation(); - const { mutateAsync: removeDeployment, isPending: isRemovingDeployment } = - api.deployment.removeDeployment.useMutation(); + const { mutateAsync: rollback, isPending: isRollingBack } = + api.rollback.rollback.useMutation(); + const { mutateAsync: killProcess, isPending: isKillingProcess } = + api.deployment.killProcess.useMutation(); + const { mutateAsync: removeDeployment, isPending: isRemovingDeployment } = + api.deployment.removeDeployment.useMutation(); - // Cancel deployment mutations - const { - mutateAsync: cancelApplicationDeployment, - isPending: isCancellingApp, - } = api.application.cancelDeployment.useMutation(); - const { - mutateAsync: cancelComposeDeployment, - isPending: isCancellingCompose, - } = api.compose.cancelDeployment.useMutation(); + // Cancel deployment mutations + const { + mutateAsync: cancelApplicationDeployment, + isPending: isCancellingApp, + } = api.application.cancelDeployment.useMutation(); + const { + mutateAsync: cancelComposeDeployment, + isPending: isCancellingCompose, + } = api.compose.cancelDeployment.useMutation(); - const [url, setUrl] = React.useState(""); - const [expandedDescriptions, setExpandedDescriptions] = useState>( - new Set(), - ); + const [url, setUrl] = React.useState(""); + const [expandedDescriptions, setExpandedDescriptions] = useState>( + new Set(), + ); - const MAX_DESCRIPTION_LENGTH = 200; + const MAX_DESCRIPTION_LENGTH = 200; - const truncateDescription = (description: string): string => { - if (description.length <= MAX_DESCRIPTION_LENGTH) { - return description; - } - const truncated = description.slice(0, MAX_DESCRIPTION_LENGTH); - const lastSpace = truncated.lastIndexOf(" "); - if (lastSpace > MAX_DESCRIPTION_LENGTH - 20 && lastSpace > 0) { - return `${truncated.slice(0, lastSpace)}...`; - } - return `${truncated}...`; - }; + const truncateDescription = (description: string): string => { + if (description.length <= MAX_DESCRIPTION_LENGTH) { + return description; + } + const truncated = description.slice(0, MAX_DESCRIPTION_LENGTH); + const lastSpace = truncated.lastIndexOf(" "); + if (lastSpace > MAX_DESCRIPTION_LENGTH - 20 && lastSpace > 0) { + return `${truncated.slice(0, lastSpace)}...`; + } + return `${truncated}...`; + }; - // Check for stuck deployment (more than 9 minutes) - only for the most recent deployment - const stuckDeployment = useMemo(() => { - if (!isCloud || !deployments || deployments.length === 0) return null; + // Check for stuck deployment (more than 9 minutes) - only for the most recent deployment + const stuckDeployment = useMemo(() => { + if (!isCloud || !deployments || deployments.length === 0) return null; - const now = Date.now(); - const NINE_MINUTES = 10 * 60 * 1000; // 9 minutes in milliseconds + const now = Date.now(); + const NINE_MINUTES = 10 * 60 * 1000; // 9 minutes in milliseconds - // Get the most recent deployment (first in the list since they're sorted by date) - const mostRecentDeployment = deployments[0]; + // Get the most recent deployment (first in the list since they're sorted by date) + const mostRecentDeployment = deployments[0]; - if ( - !mostRecentDeployment || - mostRecentDeployment.status !== "running" || - !mostRecentDeployment.startedAt - ) { - return null; - } + if ( + !mostRecentDeployment || + mostRecentDeployment.status !== "running" || + !mostRecentDeployment.startedAt + ) { + return null; + } - const startTime = new Date(mostRecentDeployment.startedAt).getTime(); - const elapsed = now - startTime; + const startTime = new Date(mostRecentDeployment.startedAt).getTime(); + const elapsed = now - startTime; - return elapsed > NINE_MINUTES ? mostRecentDeployment : null; - }, [isCloud, deployments]); - useEffect(() => { - setUrl(document.location.origin); - }, []); + return elapsed > NINE_MINUTES ? mostRecentDeployment : null; + }, [isCloud, deployments]); + useEffect(() => { + setUrl(document.location.origin); + }, []); - return ( - - -
- Deployments - - See the last 10 deployments for this {type} - -
-
- {(type === "application" || type === "compose") && ( - - )} - {(type === "application" || type === "compose") && ( - - )} - {(type === "application" || type === "compose") && ( - - )} - {type === "application" && ( - - - - )} -
-
- - {stuckDeployment && (type === "application" || type === "compose") && ( - -
-
-
- Build appears to be stuck -
-

- Hey! Looks like the build has been running for more than 10 - minutes. Would you like to cancel this deployment? -

-
- -
-
- )} - {refreshToken && ( -
+ return ( + + +
+ Deployments + + See the last 10 deployments for this {type} + +
+
+ {(type === "application" || type === "compose") && ( + + )} + {(type === "application" || type === "compose") && ( + + )} + {(type === "application" || type === "compose") && ( + + )} + {type === "application" && ( + + + + )} +
+
+ + {stuckDeployment && (type === "application" || type === "compose") && ( + +
+
+
+ Build appears to be stuck +
+

+ Hey! Looks like the build has been running for more than 10 + minutes. Would you like to cancel this deployment? +

+
+ +
+
+ )} + {refreshToken && ( +
If you want to re-deploy this application use this URL in the config of your git provider or docker -
- Webhook URL: -
- - {`${url}/api/deploy${ - type === "compose" ? "/compose" : "" - }/${refreshToken}`} - - {(type === "application" || type === "compose") && ( - - )} -
-
-
- )} +
+ Webhook URL: +
+ { + copy(`${url}/api/deploy${type === "compose" ? "/compose" : ""}/${refreshToken}`); + toast.success("Copied to clipboard."); + }} + > + {`${url}/api/deploy${ + type === "compose" ? "/compose" : "" + }/${refreshToken}`} + + + {(type === "application" || type === "compose") && ( + + )} +
+
+
+ )} - {isLoadingDeployments ? ( -
- - + {isLoadingDeployments ? ( +
+ + Loading deployments... -
- ) : deployments?.length === 0 ? ( -
- - +
+ ) : deployments?.length === 0 ? ( +
+ + No deployments found -
- ) : ( -
- {deployments?.map((deployment, index) => { - const titleText = deployment?.title?.trim() || ""; - const needsTruncation = titleText.length > MAX_DESCRIPTION_LENGTH; - const isExpanded = expandedDescriptions.has( - deployment.deploymentId, - ); - const canDelete = - deployment.status === "done" || deployment.status === "error"; +
+ ) : ( +
+ {deployments?.map((deployment, index) => { + const titleText = deployment?.title?.trim() || ""; + const needsTruncation = titleText.length > MAX_DESCRIPTION_LENGTH; + const isExpanded = expandedDescriptions.has( + deployment.deploymentId, + ); + const canDelete = + deployment.status === "done" || deployment.status === "error"; - return ( -
-
- + return ( +
+
+ {index + 1}. {deployment.status} - + -
- +
+ {isExpanded || !needsTruncation - ? titleText - : truncateDescription(titleText)} + ? titleText + : truncateDescription(titleText)} - {needsTruncation && ( - - )} - {/* Hash (from description) - shown in compact form */} - {deployment.description?.trim() && ( - + {needsTruncation && ( + + )} + {/* Hash (from description) - shown in compact form */} + {deployment.description?.trim() && ( + {deployment.description} - )} -
-
-
-
- - {deployment.startedAt && deployment.finishedAt && ( - - - {formatDuration( - Math.floor( - (new Date(deployment.finishedAt).getTime() - - new Date(deployment.startedAt).getTime()) / - 1000, - ), - )} - - )} -
+ )} +
+
+
+
+ + {deployment.startedAt && deployment.finishedAt && ( + + + {formatDuration( + Math.floor( + (new Date(deployment.finishedAt).getTime() - + new Date(deployment.startedAt).getTime()) / + 1000, + ), + )} + + )} +
-
- {deployment.pid && deployment.status === "running" && ( - { - await killProcess({ - deploymentId: deployment.deploymentId, - }) - .then(() => { - toast.success("Process killed successfully"); - }) - .catch(() => { - toast.error("Error killing process"); - }); - }} - > - - - )} - +
+ {deployment.pid && deployment.status === "running" && ( + { + await killProcess({ + deploymentId: deployment.deploymentId, + }) + .then(() => { + toast.success("Process killed successfully"); + }) + .catch(() => { + toast.error("Error killing process"); + }); + }} + > + + + )} + - {canDelete && ( - { - try { - await removeDeployment({ - deploymentId: deployment.deploymentId, - }); - toast.success("Deployment deleted successfully"); - } catch (error) { - toast.error("Error deleting deployment"); - } - }} - > - - - )} + {canDelete && ( + { + try { + await removeDeployment({ + deploymentId: deployment.deploymentId, + }); + toast.success("Deployment deleted successfully"); + } catch (error) { + toast.error("Error deleting deployment"); + } + }} + > + + + )} - {deployment?.rollback && - deployment.status === "done" && - type === "application" && ( - -

- Are you sure you want to rollback to this - deployment? -

- - Please wait a few seconds while the image is - pulled from the registry. Your application - should be running shortly. - -
- } - type="default" - onClick={async () => { - await rollback({ - rollbackId: deployment.rollback.rollbackId, - }) - .then(() => { - toast.success( - "Rollback initiated successfully", - ); - }) - .catch(() => { - toast.error("Error initiating rollback"); - }); - }} - > - - - )} -
-
-
- ); - })} -
- )} - setActiveLog(null)} - logPath={activeLog?.logPath || ""} - errorMessage={activeLog?.errorMessage || ""} - /> - - - ); + {deployment?.rollback && + deployment.status === "done" && + type === "application" && ( + +

+ Are you sure you want to rollback to this + deployment? +

+ + Please wait a few seconds while the image is + pulled from the registry. Your application + should be running shortly. + +
+ } + type="default" + onClick={async () => { + await rollback({ + rollbackId: deployment.rollback.rollbackId, + }) + .then(() => { + toast.success( + "Rollback initiated successfully", + ); + }) + .catch(() => { + toast.error("Error initiating rollback"); + }); + }} + > + + + )} +
+
+ + ); + })} + + )} + setActiveLog(null)} + logPath={activeLog?.logPath || ""} + errorMessage={activeLog?.errorMessage || ""} + /> +
+
+ ); }; From d8c7c1eaf44779b37bca3452b19c0dfed352ea9d Mon Sep 17 00:00:00 2001 From: "autofix-ci[bot]" <114827586+autofix-ci[bot]@users.noreply.github.com> Date: Mon, 9 Mar 2026 08:28:35 +0000 Subject: [PATCH 02/18] [autofix.ci] apply automated fixes --- .../deployments/show-deployments.tsx | 841 +++++++++--------- 1 file changed, 419 insertions(+), 422 deletions(-) diff --git a/apps/dokploy/components/dashboard/application/deployments/show-deployments.tsx b/apps/dokploy/components/dashboard/application/deployments/show-deployments.tsx index 0cc096f5c..fe17697ff 100644 --- a/apps/dokploy/components/dashboard/application/deployments/show-deployments.tsx +++ b/apps/dokploy/components/dashboard/application/deployments/show-deployments.tsx @@ -1,12 +1,13 @@ import { - ChevronDown, - ChevronUp, - Clock, Copy, - Loader2, - RefreshCcw, - RocketIcon, - Settings, - Trash2, + ChevronDown, + ChevronUp, + Clock, + Copy, + Loader2, + RefreshCcw, + RocketIcon, + Settings, + Trash2, } from "lucide-react"; import React, { useEffect, useMemo, useState } from "react"; import { toast } from "sonner"; @@ -17,11 +18,11 @@ import { StatusTooltip } from "@/components/shared/status-tooltip"; import { Badge } from "@/components/ui/badge"; import { Button } from "@/components/ui/button"; import { - Card, - CardContent, - CardDescription, - CardHeader, - CardTitle, + Card, + CardContent, + CardDescription, + CardHeader, + CardTitle, } from "@/components/ui/card"; import { api, type RouterOutputs } from "@/utils/api"; import { ShowRollbackSettings } from "../rollbacks/show-rollback-settings"; @@ -33,453 +34,449 @@ import { ShowDeployment } from "./show-deployment"; import copy from "copy-to-clipboard"; interface Props { - id: string; - type: - | "application" - | "compose" - | "schedule" - | "server" - | "backup" - | "previewDeployment" - | "volumeBackup"; - refreshToken?: string; - serverId?: string; + id: string; + type: + | "application" + | "compose" + | "schedule" + | "server" + | "backup" + | "previewDeployment" + | "volumeBackup"; + refreshToken?: string; + serverId?: string; } export const formatDuration = (seconds: number) => { - if (seconds < 60) return `${seconds}s`; - const minutes = Math.floor(seconds / 60); - const remainingSeconds = seconds % 60; - return `${minutes}m ${remainingSeconds}s`; + if (seconds < 60) return `${seconds}s`; + const minutes = Math.floor(seconds / 60); + const remainingSeconds = seconds % 60; + return `${minutes}m ${remainingSeconds}s`; }; export const ShowDeployments = ({ - id, - type, - refreshToken, - serverId, + id, + type, + refreshToken, + serverId, }: Props) => { - const [activeLog, setActiveLog] = useState< - RouterOutputs["deployment"]["all"][number] | null - >(null); - const { data: deployments, isPending: isLoadingDeployments } = - api.deployment.allByType.useQuery( - { - id, - type, - }, - { - enabled: !!id, - refetchInterval: 1000, - }, - ); + const [activeLog, setActiveLog] = useState< + RouterOutputs["deployment"]["all"][number] | null + >(null); + const { data: deployments, isPending: isLoadingDeployments } = + api.deployment.allByType.useQuery( + { + id, + type, + }, + { + enabled: !!id, + refetchInterval: 1000, + }, + ); - const { data: isCloud } = api.settings.isCloud.useQuery(); + const { data: isCloud } = api.settings.isCloud.useQuery(); - const { mutateAsync: rollback, isPending: isRollingBack } = - api.rollback.rollback.useMutation(); - const { mutateAsync: killProcess, isPending: isKillingProcess } = - api.deployment.killProcess.useMutation(); - const { mutateAsync: removeDeployment, isPending: isRemovingDeployment } = - api.deployment.removeDeployment.useMutation(); + const { mutateAsync: rollback, isPending: isRollingBack } = + api.rollback.rollback.useMutation(); + const { mutateAsync: killProcess, isPending: isKillingProcess } = + api.deployment.killProcess.useMutation(); + const { mutateAsync: removeDeployment, isPending: isRemovingDeployment } = + api.deployment.removeDeployment.useMutation(); - // Cancel deployment mutations - const { - mutateAsync: cancelApplicationDeployment, - isPending: isCancellingApp, - } = api.application.cancelDeployment.useMutation(); - const { - mutateAsync: cancelComposeDeployment, - isPending: isCancellingCompose, - } = api.compose.cancelDeployment.useMutation(); + // Cancel deployment mutations + const { + mutateAsync: cancelApplicationDeployment, + isPending: isCancellingApp, + } = api.application.cancelDeployment.useMutation(); + const { + mutateAsync: cancelComposeDeployment, + isPending: isCancellingCompose, + } = api.compose.cancelDeployment.useMutation(); - const [url, setUrl] = React.useState(""); - const [expandedDescriptions, setExpandedDescriptions] = useState>( - new Set(), - ); + const [url, setUrl] = React.useState(""); + const [expandedDescriptions, setExpandedDescriptions] = useState>( + new Set(), + ); - const MAX_DESCRIPTION_LENGTH = 200; + const MAX_DESCRIPTION_LENGTH = 200; - const truncateDescription = (description: string): string => { - if (description.length <= MAX_DESCRIPTION_LENGTH) { - return description; - } - const truncated = description.slice(0, MAX_DESCRIPTION_LENGTH); - const lastSpace = truncated.lastIndexOf(" "); - if (lastSpace > MAX_DESCRIPTION_LENGTH - 20 && lastSpace > 0) { - return `${truncated.slice(0, lastSpace)}...`; - } - return `${truncated}...`; - }; + const truncateDescription = (description: string): string => { + if (description.length <= MAX_DESCRIPTION_LENGTH) { + return description; + } + const truncated = description.slice(0, MAX_DESCRIPTION_LENGTH); + const lastSpace = truncated.lastIndexOf(" "); + if (lastSpace > MAX_DESCRIPTION_LENGTH - 20 && lastSpace > 0) { + return `${truncated.slice(0, lastSpace)}...`; + } + return `${truncated}...`; + }; - // Check for stuck deployment (more than 9 minutes) - only for the most recent deployment - const stuckDeployment = useMemo(() => { - if (!isCloud || !deployments || deployments.length === 0) return null; + // Check for stuck deployment (more than 9 minutes) - only for the most recent deployment + const stuckDeployment = useMemo(() => { + if (!isCloud || !deployments || deployments.length === 0) return null; - const now = Date.now(); - const NINE_MINUTES = 10 * 60 * 1000; // 9 minutes in milliseconds + const now = Date.now(); + const NINE_MINUTES = 10 * 60 * 1000; // 9 minutes in milliseconds - // Get the most recent deployment (first in the list since they're sorted by date) - const mostRecentDeployment = deployments[0]; + // Get the most recent deployment (first in the list since they're sorted by date) + const mostRecentDeployment = deployments[0]; - if ( - !mostRecentDeployment || - mostRecentDeployment.status !== "running" || - !mostRecentDeployment.startedAt - ) { - return null; - } + if ( + !mostRecentDeployment || + mostRecentDeployment.status !== "running" || + !mostRecentDeployment.startedAt + ) { + return null; + } - const startTime = new Date(mostRecentDeployment.startedAt).getTime(); - const elapsed = now - startTime; + const startTime = new Date(mostRecentDeployment.startedAt).getTime(); + const elapsed = now - startTime; - return elapsed > NINE_MINUTES ? mostRecentDeployment : null; - }, [isCloud, deployments]); - useEffect(() => { - setUrl(document.location.origin); - }, []); + return elapsed > NINE_MINUTES ? mostRecentDeployment : null; + }, [isCloud, deployments]); + useEffect(() => { + setUrl(document.location.origin); + }, []); - return ( - - -
- Deployments - - See the last 10 deployments for this {type} - -
-
- {(type === "application" || type === "compose") && ( - - )} - {(type === "application" || type === "compose") && ( - - )} - {(type === "application" || type === "compose") && ( - - )} - {type === "application" && ( - - - - )} -
-
- - {stuckDeployment && (type === "application" || type === "compose") && ( - -
-
-
- Build appears to be stuck -
-

- Hey! Looks like the build has been running for more than 10 - minutes. Would you like to cancel this deployment? -

-
- -
-
- )} - {refreshToken && ( -
+ return ( + + +
+ Deployments + + See the last 10 deployments for this {type} + +
+
+ {(type === "application" || type === "compose") && ( + + )} + {(type === "application" || type === "compose") && ( + + )} + {(type === "application" || type === "compose") && ( + + )} + {type === "application" && ( + + + + )} +
+
+ + {stuckDeployment && (type === "application" || type === "compose") && ( + +
+
+
+ Build appears to be stuck +
+

+ Hey! Looks like the build has been running for more than 10 + minutes. Would you like to cancel this deployment? +

+
+ +
+
+ )} + {refreshToken && ( +
If you want to re-deploy this application use this URL in the config of your git provider or docker -
- Webhook URL: -
- { - copy(`${url}/api/deploy${type === "compose" ? "/compose" : ""}/${refreshToken}`); - toast.success("Copied to clipboard."); - }} - > - {`${url}/api/deploy${ - type === "compose" ? "/compose" : "" - }/${refreshToken}`} - - - {(type === "application" || type === "compose") && ( - - )} -
-
-
- )} +
+ Webhook URL: +
+ { + copy( + `${url}/api/deploy${type === "compose" ? "/compose" : ""}/${refreshToken}`, + ); + toast.success("Copied to clipboard."); + }} + > + {`${url}/api/deploy${ + type === "compose" ? "/compose" : "" + }/${refreshToken}`} + + + {(type === "application" || type === "compose") && ( + + )} +
+
+
+ )} - {isLoadingDeployments ? ( -
- - + {isLoadingDeployments ? ( +
+ + Loading deployments... -
- ) : deployments?.length === 0 ? ( -
- - +
+ ) : deployments?.length === 0 ? ( +
+ + No deployments found -
- ) : ( -
- {deployments?.map((deployment, index) => { - const titleText = deployment?.title?.trim() || ""; - const needsTruncation = titleText.length > MAX_DESCRIPTION_LENGTH; - const isExpanded = expandedDescriptions.has( - deployment.deploymentId, - ); - const canDelete = - deployment.status === "done" || deployment.status === "error"; +
+ ) : ( +
+ {deployments?.map((deployment, index) => { + const titleText = deployment?.title?.trim() || ""; + const needsTruncation = titleText.length > MAX_DESCRIPTION_LENGTH; + const isExpanded = expandedDescriptions.has( + deployment.deploymentId, + ); + const canDelete = + deployment.status === "done" || deployment.status === "error"; - return ( -
-
- + return ( +
+
+ {index + 1}. {deployment.status} - + -
- +
+ {isExpanded || !needsTruncation - ? titleText - : truncateDescription(titleText)} + ? titleText + : truncateDescription(titleText)} - {needsTruncation && ( - - )} - {/* Hash (from description) - shown in compact form */} - {deployment.description?.trim() && ( - + {needsTruncation && ( + + )} + {/* Hash (from description) - shown in compact form */} + {deployment.description?.trim() && ( + {deployment.description} - )} -
-
-
-
- - {deployment.startedAt && deployment.finishedAt && ( - - - {formatDuration( - Math.floor( - (new Date(deployment.finishedAt).getTime() - - new Date(deployment.startedAt).getTime()) / - 1000, - ), - )} - - )} -
+ )} +
+
+
+
+ + {deployment.startedAt && deployment.finishedAt && ( + + + {formatDuration( + Math.floor( + (new Date(deployment.finishedAt).getTime() - + new Date(deployment.startedAt).getTime()) / + 1000, + ), + )} + + )} +
-
- {deployment.pid && deployment.status === "running" && ( - { - await killProcess({ - deploymentId: deployment.deploymentId, - }) - .then(() => { - toast.success("Process killed successfully"); - }) - .catch(() => { - toast.error("Error killing process"); - }); - }} - > - - - )} - +
+ {deployment.pid && deployment.status === "running" && ( + { + await killProcess({ + deploymentId: deployment.deploymentId, + }) + .then(() => { + toast.success("Process killed successfully"); + }) + .catch(() => { + toast.error("Error killing process"); + }); + }} + > + + + )} + - {canDelete && ( - { - try { - await removeDeployment({ - deploymentId: deployment.deploymentId, - }); - toast.success("Deployment deleted successfully"); - } catch (error) { - toast.error("Error deleting deployment"); - } - }} - > - - - )} + {canDelete && ( + { + try { + await removeDeployment({ + deploymentId: deployment.deploymentId, + }); + toast.success("Deployment deleted successfully"); + } catch (error) { + toast.error("Error deleting deployment"); + } + }} + > + + + )} - {deployment?.rollback && - deployment.status === "done" && - type === "application" && ( - -

- Are you sure you want to rollback to this - deployment? -

- - Please wait a few seconds while the image is - pulled from the registry. Your application - should be running shortly. - -
- } - type="default" - onClick={async () => { - await rollback({ - rollbackId: deployment.rollback.rollbackId, - }) - .then(() => { - toast.success( - "Rollback initiated successfully", - ); - }) - .catch(() => { - toast.error("Error initiating rollback"); - }); - }} - > - - - )} -
-
-
- ); - })} -
- )} - setActiveLog(null)} - logPath={activeLog?.logPath || ""} - errorMessage={activeLog?.errorMessage || ""} - /> - - - ); + {deployment?.rollback && + deployment.status === "done" && + type === "application" && ( + +

+ Are you sure you want to rollback to this + deployment? +

+ + Please wait a few seconds while the image is + pulled from the registry. Your application + should be running shortly. + +
+ } + type="default" + onClick={async () => { + await rollback({ + rollbackId: deployment.rollback.rollbackId, + }) + .then(() => { + toast.success( + "Rollback initiated successfully", + ); + }) + .catch(() => { + toast.error("Error initiating rollback"); + }); + }} + > + + + )} +
+
+ + ); + })} + + )} + setActiveLog(null)} + logPath={activeLog?.logPath || ""} + errorMessage={activeLog?.errorMessage || ""} + /> +
+
+ ); }; From f1d4543d5e4d0dedd4290fa7c45bf55e257f792b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ji=C5=99=C3=AD=20Vrba?= Date: Mon, 9 Mar 2026 09:33:30 +0100 Subject: [PATCH 03/18] Code review fixes --- .../dashboard/application/deployments/show-deployments.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/apps/dokploy/components/dashboard/application/deployments/show-deployments.tsx b/apps/dokploy/components/dashboard/application/deployments/show-deployments.tsx index fe17697ff..67f1c0e87 100644 --- a/apps/dokploy/components/dashboard/application/deployments/show-deployments.tsx +++ b/apps/dokploy/components/dashboard/application/deployments/show-deployments.tsx @@ -227,7 +227,7 @@ export const ShowDeployments = ({ Webhook URL:
{ copy( From b9ca6ea9dbf89fab0d607cb7a4a2a2f0c6541f38 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ji=C5=99=C3=AD=20Vrba?= Date: Mon, 9 Mar 2026 09:38:00 +0100 Subject: [PATCH 04/18] Code review fixes --- .../dashboard/application/deployments/show-deployments.tsx | 2 ++ 1 file changed, 2 insertions(+) diff --git a/apps/dokploy/components/dashboard/application/deployments/show-deployments.tsx b/apps/dokploy/components/dashboard/application/deployments/show-deployments.tsx index 67f1c0e87..f82c9589b 100644 --- a/apps/dokploy/components/dashboard/application/deployments/show-deployments.tsx +++ b/apps/dokploy/components/dashboard/application/deployments/show-deployments.tsx @@ -227,6 +227,8 @@ export const ShowDeployments = ({ Webhook URL:
{ From 3e4a1b92ebbc69e0b999e890fe511fb3a83bdcd4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ji=C5=99=C3=AD=20Vrba?= Date: Mon, 9 Mar 2026 09:48:37 +0100 Subject: [PATCH 05/18] Code review fixes --- .../deployments/show-deployments.tsx | 24 ++++++++++++------- 1 file changed, 16 insertions(+), 8 deletions(-) diff --git a/apps/dokploy/components/dashboard/application/deployments/show-deployments.tsx b/apps/dokploy/components/dashboard/application/deployments/show-deployments.tsx index f82c9589b..6de8c1cb0 100644 --- a/apps/dokploy/components/dashboard/application/deployments/show-deployments.tsx +++ b/apps/dokploy/components/dashboard/application/deployments/show-deployments.tsx @@ -11,6 +11,7 @@ import { } from "lucide-react"; import React, { useEffect, useMemo, useState } from "react"; import { toast } from "sonner"; +import copy from "copy-to-clipboard"; import { AlertBlock } from "@/components/shared/alert-block"; import { DateTooltip } from "@/components/shared/date-tooltip"; import { DialogAction } from "@/components/shared/dialog-action"; @@ -31,7 +32,6 @@ import { ClearDeployments } from "./clear-deployments"; import { KillBuild } from "./kill-build"; import { RefreshToken } from "./refresh-token"; import { ShowDeployment } from "./show-deployment"; -import copy from "copy-to-clipboard"; interface Props { id: string; @@ -99,6 +99,11 @@ export const ShowDeployments = ({ new Set(), ); + const webhookUrl = useMemo( + () => `${url}/api/deploy${type === "compose" ? "/compose" : ""}/${refreshToken}`, + [url, refreshToken, type] + ); + const MAX_DESCRIPTION_LENGTH = 200; const truncateDescription = (description: string): string => { @@ -231,17 +236,20 @@ export const ShowDeployments = ({ tabIndex={0} className="p-2 rounded-md ml-1 mr-1 hover:border-primary hover:text-primary-foreground hover:bg-primary hover:cursor-pointer whitespace-normal break-all" variant="outline" + onKeyDown={(event) => { + if (event.key === "Enter" || event.key === " ") { + event.preventDefault(); + copy(webhookUrl); + toast.success("Copied to clipboard."); + } + }} onClick={() => { - copy( - `${url}/api/deploy${type === "compose" ? "/compose" : ""}/${refreshToken}`, - ); + copy(webhookUrl); toast.success("Copied to clipboard."); }} > - {`${url}/api/deploy${ - type === "compose" ? "/compose" : "" - }/${refreshToken}`} - + {webhookUrl} + {(type === "application" || type === "compose") && ( From 6866e2b63abc2bbeaf68231a1348c34b386666cc Mon Sep 17 00:00:00 2001 From: "autofix-ci[bot]" <114827586+autofix-ci[bot]@users.noreply.github.com> Date: Mon, 9 Mar 2026 08:49:06 +0000 Subject: [PATCH 06/18] [autofix.ci] apply automated fixes --- .../dashboard/application/deployments/show-deployments.tsx | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/apps/dokploy/components/dashboard/application/deployments/show-deployments.tsx b/apps/dokploy/components/dashboard/application/deployments/show-deployments.tsx index 6de8c1cb0..c50cd1607 100644 --- a/apps/dokploy/components/dashboard/application/deployments/show-deployments.tsx +++ b/apps/dokploy/components/dashboard/application/deployments/show-deployments.tsx @@ -100,8 +100,9 @@ export const ShowDeployments = ({ ); const webhookUrl = useMemo( - () => `${url}/api/deploy${type === "compose" ? "/compose" : ""}/${refreshToken}`, - [url, refreshToken, type] + () => + `${url}/api/deploy${type === "compose" ? "/compose" : ""}/${refreshToken}`, + [url, refreshToken, type], ); const MAX_DESCRIPTION_LENGTH = 200; From de201d0b0af2056a995fc3c3b0fb4ac814a336b2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ji=C5=99=C3=AD=20Vrba?= Date: Mon, 9 Mar 2026 09:59:36 +0100 Subject: [PATCH 07/18] Add aria-label to webhook URL badge --- .../dashboard/application/deployments/show-deployments.tsx | 1 + 1 file changed, 1 insertion(+) diff --git a/apps/dokploy/components/dashboard/application/deployments/show-deployments.tsx b/apps/dokploy/components/dashboard/application/deployments/show-deployments.tsx index c50cd1607..3cecef1ec 100644 --- a/apps/dokploy/components/dashboard/application/deployments/show-deployments.tsx +++ b/apps/dokploy/components/dashboard/application/deployments/show-deployments.tsx @@ -235,6 +235,7 @@ export const ShowDeployments = ({ { From b84bc9b7c6a4603b7f3364fb357e2da29b890ad9 Mon Sep 17 00:00:00 2001 From: Mauricio Siu Date: Tue, 10 Mar 2026 00:27:58 -0600 Subject: [PATCH 08/18] feat: implement whitelabeling features including settings, preview, and provider components --- .../server/update-server-config.test.ts | 15 + .../impersonation/impersonation-bar.tsx | 7 +- .../components/layouts/onboarding-layout.tsx | 20 +- apps/dokploy/components/layouts/side.tsx | 76 +- .../whitelabeling/whitelabeling-preview.tsx | 85 + .../whitelabeling/whitelabeling-provider.tsx | 93 + .../whitelabeling/whitelabeling-settings.tsx | 536 ++ .../dokploy/components/shared/code-editor.tsx | 5 +- apps/dokploy/drizzle/0148_strong_karma.sql | 1 + apps/dokploy/drizzle/0149_omniscient_bug.sql | 1 + apps/dokploy/drizzle/meta/0148_snapshot.json | 7467 +++++++++++++++++ apps/dokploy/drizzle/meta/0149_snapshot.json | 7467 +++++++++++++++++ apps/dokploy/drizzle/meta/_journal.json | 14 + apps/dokploy/package.json | 15 +- apps/dokploy/pages/_app.tsx | 2 + apps/dokploy/pages/_error.tsx | 56 +- .../environment/[environmentId].tsx | 6 +- .../services/application/[applicationId].tsx | 6 +- .../services/compose/[composeId].tsx | 5 +- .../services/mariadb/[mariadbId].tsx | 5 +- .../services/mongo/[mongoId].tsx | 6 +- .../services/mysql/[mysqlId].tsx | 5 +- .../services/postgres/[postgresId].tsx | 6 +- .../services/redis/[redisId].tsx | 6 +- .../dashboard/settings/whitelabeling.tsx | 81 + apps/dokploy/pages/index.tsx | 11 +- apps/dokploy/pages/invitation.tsx | 17 +- apps/dokploy/pages/register.tsx | 17 +- apps/dokploy/pages/reset-password.tsx | 11 +- apps/dokploy/pages/send-reset-password.tsx | 12 +- apps/dokploy/server/api/root.ts | 2 + .../api/routers/proprietary/whitelabeling.ts | 88 + apps/dokploy/server/api/routers/user.ts | 5 +- apps/dokploy/utils/hooks/use-whitelabeling.ts | 13 + .../src/db/schema/web-server-settings.ts | 61 +- pnpm-lock.yaml | 23 + 36 files changed, 16148 insertions(+), 98 deletions(-) create mode 100644 apps/dokploy/components/proprietary/whitelabeling/whitelabeling-preview.tsx create mode 100644 apps/dokploy/components/proprietary/whitelabeling/whitelabeling-provider.tsx create mode 100644 apps/dokploy/components/proprietary/whitelabeling/whitelabeling-settings.tsx create mode 100644 apps/dokploy/drizzle/0148_strong_karma.sql create mode 100644 apps/dokploy/drizzle/0149_omniscient_bug.sql create mode 100644 apps/dokploy/drizzle/meta/0148_snapshot.json create mode 100644 apps/dokploy/drizzle/meta/0149_snapshot.json create mode 100644 apps/dokploy/pages/dashboard/settings/whitelabeling.tsx create mode 100644 apps/dokploy/server/api/routers/proprietary/whitelabeling.ts create mode 100644 apps/dokploy/utils/hooks/use-whitelabeling.ts diff --git a/apps/dokploy/__test__/traefik/server/update-server-config.test.ts b/apps/dokploy/__test__/traefik/server/update-server-config.test.ts index b422279ca..eb99242c3 100644 --- a/apps/dokploy/__test__/traefik/server/update-server-config.test.ts +++ b/apps/dokploy/__test__/traefik/server/update-server-config.test.ts @@ -48,6 +48,21 @@ const baseSettings: WebServerSettings = { urlCallback: "", }, }, + whitelabelingConfig: { + appName: null, + appDescription: null, + logoUrl: null, + faviconUrl: null, + primaryColor: null, + customCss: null, + loginLogoUrl: null, + supportUrl: null, + docsUrl: null, + errorPageTitle: null, + errorPageDescription: null, + metaTitle: null, + footerText: null, + }, cleanupCacheApplications: false, cleanupCacheOnCompose: false, cleanupCacheOnPreviews: false, diff --git a/apps/dokploy/components/dashboard/impersonation/impersonation-bar.tsx b/apps/dokploy/components/dashboard/impersonation/impersonation-bar.tsx index f77983996..02f7f59f1 100644 --- a/apps/dokploy/components/dashboard/impersonation/impersonation-bar.tsx +++ b/apps/dokploy/components/dashboard/impersonation/impersonation-bar.tsx @@ -45,10 +45,12 @@ import { import { authClient } from "@/lib/auth-client"; import { cn } from "@/lib/utils"; import { api } from "@/utils/api"; +import { useWhitelabelingPublic } from "@/utils/hooks/use-whitelabeling"; type User = typeof authClient.$Infer.Session.user; export const ImpersonationBar = () => { + const { config: whitelabeling } = useWhitelabelingPublic(); const [users, setUsers] = useState([]); const [selectedUser, setSelectedUser] = useState(null); const [isImpersonating, setIsImpersonating] = useState(false); @@ -180,7 +182,10 @@ export const ImpersonationBar = () => { )} >
- + {!isImpersonating ? (
diff --git a/apps/dokploy/components/layouts/onboarding-layout.tsx b/apps/dokploy/components/layouts/onboarding-layout.tsx index fff5413e0..c76c920fd 100644 --- a/apps/dokploy/components/layouts/onboarding-layout.tsx +++ b/apps/dokploy/components/layouts/onboarding-layout.tsx @@ -1,6 +1,7 @@ import Link from "next/link"; import type React from "react"; import { cn } from "@/lib/utils"; +import { useWhitelabelingPublic } from "@/utils/hooks/use-whitelabeling"; import { GithubIcon } from "../icons/data-tools-icons"; import { Logo } from "../shared/logo"; import { Button } from "../ui/button"; @@ -9,23 +10,28 @@ interface Props { children: React.ReactNode; } export const OnboardingLayout = ({ children }: Props) => { + const { config: whitelabeling } = useWhitelabelingPublic(); + const appName = whitelabeling?.appName || "Dokploy"; + const appDescription = + whitelabeling?.appDescription || + "\u201CThe Open Source alternative to Netlify, Vercel, Heroku.\u201D"; + const logoUrl = + whitelabeling?.loginLogoUrl || whitelabeling?.logoUrl || undefined; + return (
- - Dokploy + + {appName}
-

- “The Open Source alternative to Netlify, Vercel, - Heroku.” -

+

{appDescription}

diff --git a/apps/dokploy/components/layouts/side.tsx b/apps/dokploy/components/layouts/side.tsx index 6dea37f5b..487e5e2ee 100644 --- a/apps/dokploy/components/layouts/side.tsx +++ b/apps/dokploy/components/layouts/side.tsx @@ -23,6 +23,7 @@ import { Loader2, LogIn, type LucideIcon, + Palette, Package, PieChart, Rocket, @@ -422,6 +423,15 @@ const MENU: Menu = { isEnabled: ({ auth }) => !!(auth?.role === "owner" || auth?.role === "admin"), }, + { + isSingle: true, + title: "Whitelabeling", + url: "/dashboard/settings/whitelabeling", + icon: Palette, + // Only enabled for owners in non-cloud environments (enterprise) + isEnabled: ({ auth, isCloud }) => + !!(auth?.role === "owner" && !isCloud), + }, ], help: [ @@ -445,38 +455,33 @@ const MENU: Menu = { function createMenuForAuthUser(opts: { auth?: AuthQueryOutput; isCloud: boolean; + whitelabeling?: { + docsUrl?: string | null; + supportUrl?: string | null; + } | null; }): Menu { + const filterEnabled = boolean }>(items: readonly T[]): T[] => + items.filter((item) => + !item.isEnabled + ? true + : item.isEnabled({ auth: opts.auth, isCloud: opts.isCloud }), + ) as T[]; + + // Apply whitelabeling URL overrides to help items + const helpItems = filterEnabled(MENU.help).map((item) => { + if (opts.whitelabeling?.docsUrl && item.name === "Documentation") { + return { ...item, url: opts.whitelabeling.docsUrl }; + } + if (opts.whitelabeling?.supportUrl && item.name === "Support") { + return { ...item, url: opts.whitelabeling.supportUrl }; + } + return item; + }); + return { - // Filter the home items based on the user's role and permissions - // Calls the `isEnabled` function if it exists to determine if the item should be displayed - home: MENU.home.filter((item) => - !item.isEnabled - ? true - : item.isEnabled({ - auth: opts.auth, - isCloud: opts.isCloud, - }), - ), - // Filter the settings items based on the user's role and permissions - // Calls the `isEnabled` function if it exists to determine if the item should be displayed - settings: MENU.settings.filter((item) => - !item.isEnabled - ? true - : item.isEnabled({ - auth: opts.auth, - isCloud: opts.isCloud, - }), - ), - // Filter the help items based on the user's role and permissions - // Calls the `isEnabled` function if it exists to determine if the item should be displayed - help: MENU.help.filter((item) => - !item.isEnabled - ? true - : item.isEnabled({ - auth: opts.auth, - isCloud: opts.isCloud, - }), - ), + home: filterEnabled(MENU.home), + settings: filterEnabled(MENU.settings), + help: helpItems, }; } @@ -885,6 +890,10 @@ export default function Page({ children }: Props) { const pathname = usePathname(); const { data: auth } = api.user.get.useQuery(); const { data: dokployVersion } = api.settings.getDokployVersion.useQuery(); + const { data: whitelabeling } = api.whitelabeling.getPublic.useQuery( + undefined, + { staleTime: 5 * 60 * 1000, refetchOnWindowFocus: false }, + ); const includesProjects = pathname?.includes("/dashboard/project"); const { data: isCloud } = api.settings.isCloud.useQuery(); @@ -893,7 +902,7 @@ export default function Page({ children }: Props) { home: filteredHome, settings: filteredSettings, help, - } = createMenuForAuthUser({ auth, isCloud: !!isCloud }); + } = createMenuForAuthUser({ auth, isCloud: !!isCloud, whitelabeling }); const activeItem = findActiveNavItem( [...filteredHome, ...filteredSettings], @@ -1141,6 +1150,11 @@ export default function Page({ children }: Props) { + {whitelabeling?.footerText && ( +
+ {whitelabeling.footerText} +
+ )} {dokployVersion && ( <>
diff --git a/apps/dokploy/components/proprietary/whitelabeling/whitelabeling-preview.tsx b/apps/dokploy/components/proprietary/whitelabeling/whitelabeling-preview.tsx new file mode 100644 index 000000000..f87268400 --- /dev/null +++ b/apps/dokploy/components/proprietary/whitelabeling/whitelabeling-preview.tsx @@ -0,0 +1,85 @@ +"use client"; + +import { + Card, + CardContent, + CardDescription, + CardHeader, + CardTitle, +} from "@/components/ui/card"; + +interface WhitelabelingPreviewProps { + config: { + appName?: string; + logoUrl?: string; + primaryColor?: string; + footerText?: string; + }; +} + +export function WhitelabelingPreview({ config }: WhitelabelingPreviewProps) { + const appName = config.appName || "Dokploy"; + const primaryColor = config.primaryColor || "hsl(var(--primary))"; + + return ( + + + Live Preview + + A quick preview of how your branding changes will look. + + + +
+ {/* Simulated sidebar header */} +
+ {config.logoUrl ? ( + Preview Logo + ) : ( +
+ {appName.charAt(0).toUpperCase()} +
+ )} + {appName} +
+ + {/* Simulated content area */} +
+
+
+
+
+
+
+ Button +
+
+ Secondary +
+
+
+ + {/* Simulated footer */} + {config.footerText && ( +
+ {config.footerText} +
+ )} +
+ + + ); +} diff --git a/apps/dokploy/components/proprietary/whitelabeling/whitelabeling-provider.tsx b/apps/dokploy/components/proprietary/whitelabeling/whitelabeling-provider.tsx new file mode 100644 index 000000000..651998cbf --- /dev/null +++ b/apps/dokploy/components/proprietary/whitelabeling/whitelabeling-provider.tsx @@ -0,0 +1,93 @@ +"use client"; + +import Head from "next/head"; +import { api } from "@/utils/api"; + +export function WhitelabelingProvider() { + const { data: config } = api.whitelabeling.getPublic.useQuery(undefined, { + staleTime: 5 * 60 * 1000, + refetchOnWindowFocus: false, + }); + + if (!config) return null; + + return ( + <> + + {config.metaTitle && {config.metaTitle}} + {config.faviconUrl && } + + + {(config.customCss || config.primaryColor) && ( +