From 1650f5ca797d30f7ffa26cdfd14a70128737b3a3 Mon Sep 17 00:00:00 2001 From: Nicholas Penree Date: Sat, 7 Dec 2024 21:26:36 -0500 Subject: [PATCH] feat: add draw.io template --- apps/dokploy/public/templates/drawio.svg | 17 +++++ .../templates/drawio/docker-compose.yml | 62 +++++++++++++++++++ apps/dokploy/templates/drawio/index.ts | 31 ++++++++++ apps/dokploy/templates/templates.ts | 15 +++++ 4 files changed, 125 insertions(+) create mode 100644 apps/dokploy/public/templates/drawio.svg create mode 100644 apps/dokploy/templates/drawio/docker-compose.yml create mode 100644 apps/dokploy/templates/drawio/index.ts diff --git a/apps/dokploy/public/templates/drawio.svg b/apps/dokploy/public/templates/drawio.svg new file mode 100644 index 00000000..07909528 --- /dev/null +++ b/apps/dokploy/public/templates/drawio.svg @@ -0,0 +1,17 @@ + + + + + + + + + + + + \ No newline at end of file diff --git a/apps/dokploy/templates/drawio/docker-compose.yml b/apps/dokploy/templates/drawio/docker-compose.yml new file mode 100644 index 00000000..6bd16767 --- /dev/null +++ b/apps/dokploy/templates/drawio/docker-compose.yml @@ -0,0 +1,62 @@ +version: '3' +services: + plantuml-server: + image: plantuml/plantuml-server + expose: + - "8080" + networks: + - dokploy-network + volumes: + - fonts_volume:/usr/share/fonts/drawio + image-export: + image: jgraph/export-server + expose: + - "8000" + networks: + - dokploy-network + volumes: + - fonts_volume:/usr/share/fonts/drawio + environment: + - DRAWIO_BASE_URL=${DRAWIO_BASE_URL} + drawio: + image: jgraph/drawio:24.7.17 + ports: + - "8080" + links: + - plantuml-server:plantuml-server + - image-export:image-export + depends_on: + - plantuml-server + - image-export + networks: + - dokploy-network + environment: + RAWIO_SELF_CONTAINED: 1 + DRAWIO_USE_HTTP: 1 + PLANTUML_URL: http://plantuml-server:8080/ + EXPORT_URL: http://image-export:8000/ + DRAWIO_BASE_URL: ${DRAWIO_BASE_URL} + DRAWIO_SERVER_URL: ${DRAWIO_SERVER_URL} + DRAWIO_CSP_HEADER: ${DRAWIO_CSP_HEADER} + DRAWIO_VIEWER_URL: ${DRAWIO_VIEWER_URL} + DRAWIO_LIGHTBOX_URL: ${DRAWIO_LIGHTBOX_URL} + DRAWIO_CONFIG: ${DRAWIO_CONFIG} + DRAWIO_GOOGLE_CLIENT_ID: ${DRAWIO_GOOGLE_CLIENT_ID} + DRAWIO_GOOGLE_APP_ID: ${DRAWIO_GOOGLE_APP_ID} + DRAWIO_GOOGLE_CLIENT_SECRET: ${DRAWIO_GOOGLE_CLIENT_SECRET} + DRAWIO_GOOGLE_VIEWER_CLIENT_ID: ${DRAWIO_GOOGLE_VIEWER_CLIENT_ID} + DRAWIO_GOOGLE_VIEWER_APP_ID: ${DRAWIO_GOOGLE_VIEWER_APP_ID} + DRAWIO_GOOGLE_VIEWER_CLIENT_SECRET: ${DRAWIO_GOOGLE_VIEWER_CLIENT_SECRET} + DRAWIO_MSGRAPH_CLIENT_ID: ${DRAWIO_MSGRAPH_CLIENT_ID} + DRAWIO_MSGRAPH_CLIENT_SECRET: ${DRAWIO_MSGRAPH_CLIENT_SECRET} + DRAWIO_MSGRAPH_TENANT_ID: ${DRAWIO_MSGRAPH_TENANT_ID} + DRAWIO_GITLAB_ID: ${DRAWIO_GITLAB_ID} + DRAWIO_GITLAB_SECRET: ${DRAWIO_GITLAB_SECRET} + DRAWIO_GITLAB_URL: ${DRAWIO_GITLAB_URL} + DRAWIO_CLOUD_CONVERT_APIKEY: ${DRAWIO_CLOUD_CONVERT_APIKEY} +networks: + dokploy-network: + external: true + +volumes: + fonts_volume: \ No newline at end of file diff --git a/apps/dokploy/templates/drawio/index.ts b/apps/dokploy/templates/drawio/index.ts new file mode 100644 index 00000000..e3c57c5a --- /dev/null +++ b/apps/dokploy/templates/drawio/index.ts @@ -0,0 +1,31 @@ +import { + type DomainSchema, + type Schema, + type Template, + generateBase64, + generateRandomDomain, +} from "../utils"; + +export function generate(schema: Schema): Template { + const mainDomain = generateRandomDomain(schema); + const secretKeyBase = generateBase64(64); + + const domains: DomainSchema[] = [ + { + host: mainDomain, + port: 8080, + serviceName: "drawio", + }, + ]; + + const envs = [ + `DRAWIO_HOST=${mainDomain}`, + `DRAWIO_BASE_URL=https://${mainDomain}`, + `DRAWIO_SERVER_URL=https://${mainDomain}/`, + ]; + + return { + envs, + domains, + }; +} diff --git a/apps/dokploy/templates/templates.ts b/apps/dokploy/templates/templates.ts index ef418d2b..5b03ff30 100644 --- a/apps/dokploy/templates/templates.ts +++ b/apps/dokploy/templates/templates.ts @@ -987,4 +987,19 @@ export const templates: TemplateData[] = [ tags: ["event-driven", "applications"], load: () => import("./triggerdotdev/index").then((m) => m.generate), }, + { + id: "drawio", + name: "draw.io", + version: "24.7.17", + description: + "draw.io is a configurable diagramming/whiteboarding visualization application.", + logo: "drawio.svg", + links: { + github: "https://github.com/jgraph/drawio", + website: "https://draw.io/", + docs: "https://www.drawio.com/doc/", + }, + tags: ["drawing", "diagrams"], + load: () => import("./drawio/index").then((m) => m.generate), + }, ];