From 0ee5a6f13e0343343958cb8d10dcaedbd4536f05 Mon Sep 17 00:00:00 2001 From: Nicholas Penree Date: Mon, 23 Dec 2024 09:16:01 -0500 Subject: [PATCH 1/3] fix(certificates): ensure certificates are accessible by traefik --- packages/server/src/constants/index.ts | 26 +++++++------------------- 1 file changed, 7 insertions(+), 19 deletions(-) diff --git a/packages/server/src/constants/index.ts b/packages/server/src/constants/index.ts index f2f1a4d88..b6dfd2177 100644 --- a/packages/server/src/constants/index.ts +++ b/packages/server/src/constants/index.ts @@ -5,34 +5,22 @@ export const IS_CLOUD = process.env.IS_CLOUD === "true"; export const docker = new Docker(); export const paths = (isServer = false) => { - if (isServer) { - const BASE_PATH = "/etc/dokploy"; - return { - BASE_PATH, - MAIN_TRAEFIK_PATH: `${BASE_PATH}/traefik`, - DYNAMIC_TRAEFIK_PATH: `${BASE_PATH}/traefik/dynamic`, - LOGS_PATH: `${BASE_PATH}/logs`, - APPLICATIONS_PATH: `${BASE_PATH}/applications`, - COMPOSE_PATH: `${BASE_PATH}/compose`, - SSH_PATH: `${BASE_PATH}/ssh`, - CERTIFICATES_PATH: `${BASE_PATH}/certificates`, - MONITORING_PATH: `${BASE_PATH}/monitoring`, - REGISTRY_PATH: `${BASE_PATH}/registry`, - }; - } const BASE_PATH = - process.env.NODE_ENV === "production" + isServer || process.env.NODE_ENV === "production" ? "/etc/dokploy" : path.join(process.cwd(), ".docker"); + const MAIN_TRAEFIK_PATH = `${BASE_PATH}/traefik`; + const DYNAMIC_TRAEFIK_PATH = `${MAIN_TRAEFIK_PATH}/dynamic`; + return { BASE_PATH, - MAIN_TRAEFIK_PATH: `${BASE_PATH}/traefik`, - DYNAMIC_TRAEFIK_PATH: `${BASE_PATH}/traefik/dynamic`, + MAIN_TRAEFIK_PATH, + DYNAMIC_TRAEFIK_PATH, LOGS_PATH: `${BASE_PATH}/logs`, APPLICATIONS_PATH: `${BASE_PATH}/applications`, COMPOSE_PATH: `${BASE_PATH}/compose`, SSH_PATH: `${BASE_PATH}/ssh`, - CERTIFICATES_PATH: `${BASE_PATH}/certificates`, + CERTIFICATES_PATH: `${DYNAMIC_TRAEFIK_PATH}/certificates`, MONITORING_PATH: `${BASE_PATH}/monitoring`, REGISTRY_PATH: `${BASE_PATH}/registry`, }; From 9c5a61e42f920dd58f30be3c4318ec7d71e36195 Mon Sep 17 00:00:00 2001 From: Nicholas Penree Date: Mon, 23 Dec 2024 09:17:11 -0500 Subject: [PATCH 2/3] fix(certificates): show proper placeholder for private key format --- .../dashboard/settings/certificates/add-certificate.tsx | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/apps/dokploy/components/dashboard/settings/certificates/add-certificate.tsx b/apps/dokploy/components/dashboard/settings/certificates/add-certificate.tsx index 50b2dd909..173141235 100644 --- a/apps/dokploy/components/dashboard/settings/certificates/add-certificate.tsx +++ b/apps/dokploy/components/dashboard/settings/certificates/add-certificate.tsx @@ -45,6 +45,9 @@ import { z } from "zod"; const certificateDataHolder = "-----BEGIN CERTIFICATE-----\nMIIFRDCCAyygAwIBAgIUEPOR47ys6VDwMVB9tYoeEka83uQwDQYJKoZIhvcNAQELBQAwGTEXMBUGA1UEAwwObWktZG9taW5pby5jb20wHhcNMjQwMzExMDQyNzU3WhcN\n------END CERTIFICATE-----"; +const privateKeyDataHolder = + "-----BEGIN PRIVATE KEY-----\nMIIFRDCCAyygAwIBAgIUEPOR47ys6VDwMVB9tYoeEka83uQwDQYJKoZIhvcNAQELBQAwGTEXMBUGA1UEAwwObWktZG9taW5pby5jb20wHhcNMjQwMzExMDQyNzU3WhcN\n-----END PRIVATE KEY-----"; + const addCertificate = z.object({ name: z.string().min(1, "Name is required"), certificateData: z.string().min(1, "Certificate data is required"), @@ -154,7 +157,7 @@ export const AddCertificate = () => {