From 156239633927eeada96070be25b32f97792e841c Mon Sep 17 00:00:00 2001 From: Nicholas Penree Date: Sat, 7 Dec 2024 19:37:59 -0500 Subject: [PATCH 1/3] feat: add Budibase template --- apps/dokploy/templates/templates.ts | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/apps/dokploy/templates/templates.ts b/apps/dokploy/templates/templates.ts index ef418d2b6..9b1855d26 100644 --- a/apps/dokploy/templates/templates.ts +++ b/apps/dokploy/templates/templates.ts @@ -107,6 +107,21 @@ export const templates: TemplateData[] = [ tags: ["database"], load: () => import("./baserow/index").then((m) => m.generate), }, + { + id: "budibase", + name: "Budibase", + version: "3.2.25", + description: + "Budibase is an open-source low-code platform that saves engineers 100s of hours building forms, portals, and approval apps, securely.", + logo: "budibase.svg", + links: { + github: "https://github.com/Budibase/budibase", + website: "https://budibase.com/", + docs: "https://docs.budibase.com/docs/", + }, + tags: ["database", "low-code", "nocode", "applications"], + load: () => import("./budibase/index").then((m) => m.generate), + }, { id: "ghost", name: "Ghost", From 6cf0ecf0165fd729034ad28b01542ca7f50fa751 Mon Sep 17 00:00:00 2001 From: Nicholas Penree Date: Sat, 7 Dec 2024 19:47:21 -0500 Subject: [PATCH 2/3] feat: add Budibase template --- apps/dokploy/public/templates/budibase.svg | 13 ++ .../templates/budibase/docker-compose.yml | 199 ++++++++++++++++++ apps/dokploy/templates/budibase/index.ts | 60 ++++++ 3 files changed, 272 insertions(+) create mode 100644 apps/dokploy/public/templates/budibase.svg create mode 100644 apps/dokploy/templates/budibase/docker-compose.yml create mode 100644 apps/dokploy/templates/budibase/index.ts diff --git a/apps/dokploy/public/templates/budibase.svg b/apps/dokploy/public/templates/budibase.svg new file mode 100644 index 000000000..26d09cc97 --- /dev/null +++ b/apps/dokploy/public/templates/budibase.svg @@ -0,0 +1,13 @@ + + + + + + + + + + + + + diff --git a/apps/dokploy/templates/budibase/docker-compose.yml b/apps/dokploy/templates/budibase/docker-compose.yml new file mode 100644 index 000000000..3f82de3e9 --- /dev/null +++ b/apps/dokploy/templates/budibase/docker-compose.yml @@ -0,0 +1,199 @@ +services: + apps: + image: budibase.docker.scarf.sh/budibase/apps:3.2.25 + restart: unless-stopped + networks: + - dokploy-network + environment: + SELF_HOSTED: 1 + LOG_LEVEL: info + PORT: 4002 + INTERNAL_API_KEY: ${BB_INTERNAL_API_KEY} + API_ENCRYPTION_KEY: ${BB_API_ENCRYPTION_KEY} + JWT_SECRET: ${BB_JWT_SECRET} + MINIO_ACCESS_KEY: ${BB_MINIO_ACCESS_KEY} + MINIO_SECRET_KEY: ${BB_MINIO_SECRET_KEY} + MINIO_URL: http://minio:9000 + REDIS_URL: redis:6379 + REDIS_PASSWORD: ${BB_REDIS_PASSWORD} + WORKER_URL: http://worker:4003 + COUCH_DB_USERNAME: budibase + COUCH_DB_PASSWORD: ${BB_COUCHDB_PASSWORD} + COUCH_DB_URL: http://budibase:${BB_COUCHDB_PASSWORD}@couchdb:5984 + BUDIBASE_ENVIRONMENT: ${BUDIBASE_ENVIRONMENT:-PRODUCTION} + ENABLE_ANALYTICS: ${ENABLE_ANALYTICS:-true} + BB_ADMIN_USER_EMAIL: '' + BB_ADMIN_USER_PASSWORD: '' + depends_on: + worker: + condition: service_healthy + redis: + condition: service_healthy + healthcheck: + test: + - CMD + - wget + - '--spider' + - '-qO-' + - 'http://localhost:4002/health' + interval: 15s + timeout: 15s + retries: 5 + start_period: 10s + worker: + image: budibase.docker.scarf.sh/budibase/worker:3.2.25 + restart: unless-stopped + networks: + - dokploy-network + environment: + SELF_HOSTED: 1 + LOG_LEVEL: info + PORT: 4003 + CLUSTER_PORT: 10000 + INTERNAL_API_KEY: ${BB_INTERNAL_API_KEY} + API_ENCRYPTION_KEY: ${BB_API_ENCRYPTION_KEY} + JWT_SECRET: ${BB_JWT_SECRET} + MINIO_ACCESS_KEY: ${BB_MINIO_ACCESS_KEY} + MINIO_SECRET_KEY: ${BB_MINIO_SECRET_KEY} + APPS_URL: http://apps:4002 + MINIO_URL: http://minio:9000 + REDIS_URL: redis:6379 + REDIS_PASSWORD: ${BB_REDIS_PASSWORD} + COUCH_DB_USERNAME: budibase + COUCH_DB_PASSWORD: ${BB_COUCHDB_PASSWORD} + COUCH_DB_URL: http://budibase:${BB_COUCHDB_PASSWORD}@couchdb:5984 + BUDIBASE_ENVIRONMENT: ${BUDIBASE_ENVIRONMENT:-PRODUCTION} + ENABLE_ANALYTICS: ${ENABLE_ANALYTICS:-true} + depends_on: + redis: + condition: service_healthy + minio: + condition: service_healthy + healthcheck: + test: + - CMD + - wget + - '--spider' + - '-qO-' + - 'http://localhost:4003/health' + interval: 15s + timeout: 15s + retries: 5 + start_period: 10s + minio: + image: minio/minio:RELEASE.2024-11-07T00-52-20Z + restart: unless-stopped + networks: + - dokploy-network + volumes: + - 'minio_data:/data' + environment: + MINIO_ROOT_USER: ${BB_MINIO_ACCESS_KEY} + MINIO_ROOT_PASSWORD: ${BB_MINIO_SECRET_KEY} + MINIO_BROWSER: off + command: 'server /data --console-address ":9001"' + healthcheck: + test: + - CMD + - curl + - '-f' + - 'http://localhost:9000/minio/health/live' + interval: 30s + timeout: 20s + retries: 3 + proxy: + image: budibase/proxy:3.2.25 + restart: unless-stopped + networks: + - dokploy-network + environment: + PROXY_RATE_LIMIT_WEBHOOKS_PER_SECOND: 10 + PROXY_RATE_LIMIT_API_PER_SECOND: 20 + APPS_UPSTREAM_URL: http://apps:4002 + WORKER_UPSTREAM_URL: http://worker:4003 + MINIO_UPSTREAM_URL: http://minio:9000 + COUCHDB_UPSTREAM_URL: http://couchdb:5984 + WATCHTOWER_UPSTREAM_URL: http://watchtower:8080 + RESOLVER: 127.0.0.11 + depends_on: + minio: + condition: service_healthy + worker: + condition: service_healthy + apps: + condition: service_healthy + couchdb: + condition: service_healthy + healthcheck: + test: + - CMD + - curl + - '-f' + - 'http://localhost:10000/' + interval: 15s + timeout: 15s + retries: 5 + start_period: 10s + couchdb: + image: budibase/couchdb:v3.3.3 + restart: unless-stopped + networks: + - dokploy-network + environment: + COUCHDB_USER: budibase + COUCHDB_PASSWORD: ${BB_COUCHDB_PASSWORD} + TARGETBUILD: docker-compose + healthcheck: + test: + - CMD + - curl + - '-f' + - 'http://localhost:5984/' + interval: 15s + timeout: 15s + retries: 5 + start_period: 10s + volumes: + - 'couchdb3_data:/opt/couchdb/data' + redis: + image: redis:7.2-alpine + networks: + - dokploy-network + restart: unless-stopped + command: 'redis-server --requirepass "${BB_REDIS_PASSWORD}"' + volumes: + - 'redis_data:/data' + healthcheck: + test: + - CMD + - redis-cli + - '-a' + - ${BB_REDIS_PASSWORD} + - ping + interval: 15s + timeout: 15s + retries: 5 + start_period: 10s + watchtower: + restart: unless-stopped + networks: + - dokploy-network + image: containrrr/watchtower:1.7.1 + volumes: + - '/var/run/docker.sock:/var/run/docker.sock' + command: '--debug --http-api-update bbapps bbworker bbproxy' + environment: + WATCHTOWER_HTTP_API: true + WATCHTOWER_HTTP_API_TOKEN: ${BB_WATCHTOWER_PASSWORD} + WATCHTOWER_CLEANUP: true + labels: + - com.centurylinklabs.watchtower.enable=false + +networks: + dokploy-network: + external: true + +volumes: + minio_data: + couchdb3_data: + redis_data: \ No newline at end of file diff --git a/apps/dokploy/templates/budibase/index.ts b/apps/dokploy/templates/budibase/index.ts new file mode 100644 index 000000000..9312b4f94 --- /dev/null +++ b/apps/dokploy/templates/budibase/index.ts @@ -0,0 +1,60 @@ +import { + type DomainSchema, + type Schema, + type Template, + generateRandomDomain, +} from "../utils"; + +export function generate(schema: Schema): Template { + const mainDomain = generateRandomDomain(schema); + + const apiKey = Array.from({ length: 32 }, () => + Math.floor(Math.random() * 16).toString(16), + ).join(""); + const encryptionKey = Array.from({ length: 32 }, () => + Math.floor(Math.random() * 16).toString(16), + ).join(""); + const jwtSecret = Array.from({ length: 32 }, () => + Math.floor(Math.random() * 16).toString(16), + ).join(""); + const couchDbPassword = Array.from({ length: 32 }, () => + Math.floor(Math.random() * 16).toString(16), + ).join(""); + const redisPassword = Array.from({ length: 32 }, () => + Math.floor(Math.random() * 16).toString(16), + ).join(""); + const minioAccessKey = Array.from({ length: 32 }, () => + Math.floor(Math.random() * 16).toString(16), + ).join(""); + const minioSecretKey = Array.from({ length: 32 }, () => + Math.floor(Math.random() * 16).toString(16), + ).join(""); + const watchtowerPassword = Array.from({ length: 32 }, () => + Math.floor(Math.random() * 16).toString(16), + ).join(""); + + const domains: DomainSchema[] = [ + { + host: mainDomain, + port: 10000, + serviceName: "proxy", + }, + ]; + + const envs = [ + `BB_HOST=${mainDomain}`, + `BB_INTERNAL_API_KEY=${apiKey}`, + `BB_API_ENCRYPTION_KEY=${encryptionKey}`, + `BB_JWT_SECRET=${jwtSecret}`, + `BB_COUCHDB_PASSWORD=${couchDbPassword}`, + `BB_REDIS_PASSWORD=${redisPassword}`, + `BB_WATCHTOWER_PASSWORD=${watchtowerPassword}`, + `BB_MINIO_ACCESS_KEY=${minioAccessKey}`, + `BB_MINIO_SECRET_KEY=${minioSecretKey}`, + ]; + + return { + domains, + envs, + }; +} From b8e41e970dff1414de1d367da0aee48c8517ac3a Mon Sep 17 00:00:00 2001 From: Mauricio Siu <47042324+Siumauricio@users.noreply.github.com> Date: Sun, 8 Dec 2024 00:54:39 -0600 Subject: [PATCH 3/3] refactor: add password key --- apps/dokploy/templates/budibase/index.ts | 33 +++++++----------------- 1 file changed, 9 insertions(+), 24 deletions(-) diff --git a/apps/dokploy/templates/budibase/index.ts b/apps/dokploy/templates/budibase/index.ts index 9312b4f94..50bdfdba7 100644 --- a/apps/dokploy/templates/budibase/index.ts +++ b/apps/dokploy/templates/budibase/index.ts @@ -2,36 +2,21 @@ import { type DomainSchema, type Schema, type Template, + generatePassword, generateRandomDomain, } from "../utils"; export function generate(schema: Schema): Template { const mainDomain = generateRandomDomain(schema); - const apiKey = Array.from({ length: 32 }, () => - Math.floor(Math.random() * 16).toString(16), - ).join(""); - const encryptionKey = Array.from({ length: 32 }, () => - Math.floor(Math.random() * 16).toString(16), - ).join(""); - const jwtSecret = Array.from({ length: 32 }, () => - Math.floor(Math.random() * 16).toString(16), - ).join(""); - const couchDbPassword = Array.from({ length: 32 }, () => - Math.floor(Math.random() * 16).toString(16), - ).join(""); - const redisPassword = Array.from({ length: 32 }, () => - Math.floor(Math.random() * 16).toString(16), - ).join(""); - const minioAccessKey = Array.from({ length: 32 }, () => - Math.floor(Math.random() * 16).toString(16), - ).join(""); - const minioSecretKey = Array.from({ length: 32 }, () => - Math.floor(Math.random() * 16).toString(16), - ).join(""); - const watchtowerPassword = Array.from({ length: 32 }, () => - Math.floor(Math.random() * 16).toString(16), - ).join(""); + const apiKey = generatePassword(32); + const encryptionKey = generatePassword(32); + const jwtSecret = generatePassword(32); + const couchDbPassword = generatePassword(32); + const redisPassword = generatePassword(32); + const minioAccessKey = generatePassword(32); + const minioSecretKey = generatePassword(32); + const watchtowerPassword = generatePassword(32); const domains: DomainSchema[] = [ {