From ac033cea22a1a9a904b1f09c751b5534022bc14b Mon Sep 17 00:00:00 2001 From: DrMxrcy Date: Tue, 19 Nov 2024 03:06:54 -0500 Subject: [PATCH 1/4] Add: Chatwoot --- apps/dokploy/public/templates/chatwoot.svg | 3 + .../templates/chatwoot/docker-compose.yml | 76 +++++++++++++++++++ apps/dokploy/templates/chatwoot/index.ts | 46 +++++++++++ apps/dokploy/templates/templates.ts | 14 ++++ 4 files changed, 139 insertions(+) create mode 100644 apps/dokploy/public/templates/chatwoot.svg create mode 100644 apps/dokploy/templates/chatwoot/docker-compose.yml create mode 100644 apps/dokploy/templates/chatwoot/index.ts diff --git a/apps/dokploy/public/templates/chatwoot.svg b/apps/dokploy/public/templates/chatwoot.svg new file mode 100644 index 000000000..56c9a7b8f --- /dev/null +++ b/apps/dokploy/public/templates/chatwoot.svg @@ -0,0 +1,3 @@ + + + \ No newline at end of file diff --git a/apps/dokploy/templates/chatwoot/docker-compose.yml b/apps/dokploy/templates/chatwoot/docker-compose.yml new file mode 100644 index 000000000..1b84b6184 --- /dev/null +++ b/apps/dokploy/templates/chatwoot/docker-compose.yml @@ -0,0 +1,76 @@ +version: '3' + +x-base-config: &base-config + image: chatwoot/chatwoot:v3.14.1 + volumes: + - chatwoot_storage:/app/storage + networks: + - dokploy-network + environment: + - FRONTEND_URL=${FRONTEND_URL} + - SECRET_KEY_BASE=${SECRET_KEY_BASE} + - RAILS_ENV=${RAILS_ENV} + - NODE_ENV=${NODE_ENV} + - INSTALLATION_ENV=${INSTALLATION_ENV} + - RAILS_LOG_TO_STDOUT=${RAILS_LOG_TO_STDOUT} + - LOG_LEVEL=${LOG_LEVEL} + - DEFAULT_LOCALE=${DEFAULT_LOCALE} + - POSTGRES_HOST=${POSTGRES_HOST} + - POSTGRES_PORT=${POSTGRES_PORT} + - POSTGRES_DATABASE=${POSTGRES_DATABASE} + - POSTGRES_USERNAME=${POSTGRES_USERNAME} + - POSTGRES_PASSWORD=${POSTGRES_PASSWORD} + - REDIS_URL=${REDIS_URL} + - ENABLE_ACCOUNT_SIGNUP=${ENABLE_ACCOUNT_SIGNUP} + - ACTIVE_STORAGE_SERVICE=${ACTIVE_STORAGE_SERVICE} + +services: + rails: + <<: *base-config + depends_on: + postgres: + condition: service_started + redis: + condition: service_started + entrypoint: docker/entrypoints/rails.sh + command: ['bundle', 'exec', 'sh', '-c', 'rails db:chatwoot_prepare && rails s -p 3000 -b 0.0.0.0'] + restart: always + + sidekiq: + <<: *base-config + depends_on: + postgres: + condition: service_started + redis: + condition: service_started + command: ['bundle', 'exec', 'sidekiq', '-C', 'config/sidekiq.yml'] + restart: always + + postgres: + image: postgres:12 + restart: always + volumes: + - postgres_data:/var/lib/postgresql/data + networks: + - dokploy-network + environment: + - POSTGRES_DB=${POSTGRES_DATABASE} + - POSTGRES_USER=${POSTGRES_USERNAME} + - POSTGRES_PASSWORD=${POSTGRES_PASSWORD} + + redis: + image: redis:alpine + restart: always + volumes: + - redis_data:/data + networks: + - dokploy-network + +networks: + dokploy-network: + external: true + +volumes: + chatwoot_storage: + postgres_data: + redis_data: \ No newline at end of file diff --git a/apps/dokploy/templates/chatwoot/index.ts b/apps/dokploy/templates/chatwoot/index.ts new file mode 100644 index 000000000..8e57702fd --- /dev/null +++ b/apps/dokploy/templates/chatwoot/index.ts @@ -0,0 +1,46 @@ +import { + type DomainSchema, + type Schema, + type Template, + generateBase64, + generatePassword, + generateRandomDomain, +} from "../utils"; + +export function generate(schema: Schema): Template { + const mainDomain = generateRandomDomain(schema); + const secretKeyBase = generateBase64(64); + const postgresPassword = generatePassword(); + + const domains: DomainSchema[] = [ + { + host: mainDomain, + port: 3000, + serviceName: "rails", + }, + ]; + + const envs = [ + `FRONTEND_URL=http://${mainDomain}`, + `SECRET_KEY_BASE=${secretKeyBase}`, + `RAILS_ENV=production`, + `NODE_ENV=production`, + `INSTALLATION_ENV=docker`, + `RAILS_LOG_TO_STDOUT=true`, + `LOG_LEVEL=info`, + `DEFAULT_LOCALE=en`, + `POSTGRES_HOST=postgres`, + `POSTGRES_PORT=5432`, + `POSTGRES_DATABASE=chatwoot`, + `POSTGRES_USERNAME=postgres`, + `POSTGRES_PASSWORD=${postgresPassword}`, + `REDIS_URL=redis://redis:6379`, + `ENABLE_ACCOUNT_SIGNUP=false`, + `ACTIVE_STORAGE_SERVICE=local`, + ]; + + return { + domains, + envs, + }; +} \ No newline at end of file diff --git a/apps/dokploy/templates/templates.ts b/apps/dokploy/templates/templates.ts index d0b29fc66..bc496c27b 100644 --- a/apps/dokploy/templates/templates.ts +++ b/apps/dokploy/templates/templates.ts @@ -837,4 +837,18 @@ export const templates: TemplateData[] = [ tags: ["3d", "rendering", "animation"], load: () => import("./blender/index").then((m) => m.generate), }, + { + id: "chatwoot", + name: "Chatwoot", + version: "v3.14.1", + description: "Open-source customer engagement platform that provides a shared inbox for teams, live chat, and omnichannel support.", + logo: "chatwoot.svg", + links: { + github: "https://github.com/chatwoot/chatwoot", + website: "https://www.chatwoot.com", + docs: "https://www.chatwoot.com/docs", + }, + tags: ["support", "chat", "customer-service"], + load: () => import("./chatwoot/index").then((m) => m.generate), + }, ]; From 3698e8a827614758b02d53f808b46264e392d015 Mon Sep 17 00:00:00 2001 From: DrMxrcy Date: Tue, 19 Nov 2024 11:19:33 -0500 Subject: [PATCH 2/4] Fix Chatwoot Schema --- .../templates/chatwoot/docker-compose.yml | 28 +++++++++---------- apps/dokploy/templates/chatwoot/index.ts | 6 ++-- 2 files changed, 17 insertions(+), 17 deletions(-) diff --git a/apps/dokploy/templates/chatwoot/docker-compose.yml b/apps/dokploy/templates/chatwoot/docker-compose.yml index 1b84b6184..8b762e36e 100644 --- a/apps/dokploy/templates/chatwoot/docker-compose.yml +++ b/apps/dokploy/templates/chatwoot/docker-compose.yml @@ -3,7 +3,7 @@ version: '3' x-base-config: &base-config image: chatwoot/chatwoot:v3.14.1 volumes: - - chatwoot_storage:/app/storage + - chatwoot-storage:/app/storage networks: - dokploy-network environment: @@ -25,32 +25,32 @@ x-base-config: &base-config - ACTIVE_STORAGE_SERVICE=${ACTIVE_STORAGE_SERVICE} services: - rails: + chatwoot-rails: <<: *base-config depends_on: - postgres: + chatwoot-postgres: condition: service_started - redis: + chatwoot-redis: condition: service_started entrypoint: docker/entrypoints/rails.sh command: ['bundle', 'exec', 'sh', '-c', 'rails db:chatwoot_prepare && rails s -p 3000 -b 0.0.0.0'] restart: always - sidekiq: + chatwoot-sidekiq: <<: *base-config depends_on: - postgres: + chatwoot-postgres: condition: service_started - redis: + chatwoot-redis: condition: service_started command: ['bundle', 'exec', 'sidekiq', '-C', 'config/sidekiq.yml'] restart: always - postgres: + chatwoot-postgres: image: postgres:12 restart: always volumes: - - postgres_data:/var/lib/postgresql/data + - chatwoot-postgres-data:/var/lib/postgresql/data networks: - dokploy-network environment: @@ -58,11 +58,11 @@ services: - POSTGRES_USER=${POSTGRES_USERNAME} - POSTGRES_PASSWORD=${POSTGRES_PASSWORD} - redis: + chatwoot-redis: image: redis:alpine restart: always volumes: - - redis_data:/data + - chatwoot-redis-data:/data networks: - dokploy-network @@ -71,6 +71,6 @@ networks: external: true volumes: - chatwoot_storage: - postgres_data: - redis_data: \ No newline at end of file + chatwoot-storage: + chatwoot-postgres-data: + chatwoot-redis-data: \ No newline at end of file diff --git a/apps/dokploy/templates/chatwoot/index.ts b/apps/dokploy/templates/chatwoot/index.ts index 8e57702fd..dfd751d4c 100644 --- a/apps/dokploy/templates/chatwoot/index.ts +++ b/apps/dokploy/templates/chatwoot/index.ts @@ -16,7 +16,7 @@ export function generate(schema: Schema): Template { { host: mainDomain, port: 3000, - serviceName: "rails", + serviceName: "chatwoot-rails", }, ]; @@ -29,12 +29,12 @@ export function generate(schema: Schema): Template { `RAILS_LOG_TO_STDOUT=true`, `LOG_LEVEL=info`, `DEFAULT_LOCALE=en`, - `POSTGRES_HOST=postgres`, + `POSTGRES_HOST=chatwoot-postgres`, `POSTGRES_PORT=5432`, `POSTGRES_DATABASE=chatwoot`, `POSTGRES_USERNAME=postgres`, `POSTGRES_PASSWORD=${postgresPassword}`, - `REDIS_URL=redis://redis:6379`, + `REDIS_URL=redis://chatwoot-redis:6379`, `ENABLE_ACCOUNT_SIGNUP=false`, `ACTIVE_STORAGE_SERVICE=local`, ]; From 5cbdc8fad98fe8437d097475d5c987315e84eaa6 Mon Sep 17 00:00:00 2001 From: DrMxrcy Date: Tue, 19 Nov 2024 11:56:23 -0500 Subject: [PATCH 3/4] Fix: Linting issues --- apps/dokploy/templates/chatwoot/index.ts | 78 ++++++++++++------------ apps/dokploy/templates/templates.ts | 3 +- 2 files changed, 41 insertions(+), 40 deletions(-) diff --git a/apps/dokploy/templates/chatwoot/index.ts b/apps/dokploy/templates/chatwoot/index.ts index dfd751d4c..d6abe6e74 100644 --- a/apps/dokploy/templates/chatwoot/index.ts +++ b/apps/dokploy/templates/chatwoot/index.ts @@ -1,46 +1,46 @@ import { - type DomainSchema, - type Schema, - type Template, - generateBase64, - generatePassword, - generateRandomDomain, + type DomainSchema, + type Schema, + type Template, + generateBase64, + generatePassword, + generateRandomDomain, } from "../utils"; export function generate(schema: Schema): Template { - const mainDomain = generateRandomDomain(schema); - const secretKeyBase = generateBase64(64); - const postgresPassword = generatePassword(); + const mainDomain = generateRandomDomain(schema); + const secretKeyBase = generateBase64(64); + const postgresPassword = generatePassword(); - const domains: DomainSchema[] = [ - { - host: mainDomain, - port: 3000, - serviceName: "chatwoot-rails", - }, - ]; + const domains: DomainSchema[] = [ + { + host: mainDomain, + port: 3000, + serviceName: "chatwoot-rails", + }, + ]; - const envs = [ - `FRONTEND_URL=http://${mainDomain}`, - `SECRET_KEY_BASE=${secretKeyBase}`, - `RAILS_ENV=production`, - `NODE_ENV=production`, - `INSTALLATION_ENV=docker`, - `RAILS_LOG_TO_STDOUT=true`, - `LOG_LEVEL=info`, - `DEFAULT_LOCALE=en`, - `POSTGRES_HOST=chatwoot-postgres`, - `POSTGRES_PORT=5432`, - `POSTGRES_DATABASE=chatwoot`, - `POSTGRES_USERNAME=postgres`, - `POSTGRES_PASSWORD=${postgresPassword}`, - `REDIS_URL=redis://chatwoot-redis:6379`, - `ENABLE_ACCOUNT_SIGNUP=false`, - `ACTIVE_STORAGE_SERVICE=local`, - ]; + const envs = [ + `FRONTEND_URL=http://${mainDomain}`, + `SECRET_KEY_BASE=${secretKeyBase}`, + "RAILS_ENV=production", + "NODE_ENV=production", + "INSTALLATION_ENV=docker", + "RAILS_LOG_TO_STDOUT=true", + "LOG_LEVEL=info", + "DEFAULT_LOCALE=en", + "POSTGRES_HOST=chatwoot-postgres", + "POSTGRES_PORT=5432", + "POSTGRES_DATABASE=chatwoot", + "POSTGRES_USERNAME=postgres", + `POSTGRES_PASSWORD=${postgresPassword}`, + "REDIS_URL=redis://chatwoot-redis:6379", + "ENABLE_ACCOUNT_SIGNUP=false", + "ACTIVE_STORAGE_SERVICE=local", + ]; - return { - domains, - envs, - }; -} \ No newline at end of file + return { + domains, + envs, + }; +} diff --git a/apps/dokploy/templates/templates.ts b/apps/dokploy/templates/templates.ts index bc496c27b..ec3b03548 100644 --- a/apps/dokploy/templates/templates.ts +++ b/apps/dokploy/templates/templates.ts @@ -841,7 +841,8 @@ export const templates: TemplateData[] = [ id: "chatwoot", name: "Chatwoot", version: "v3.14.1", - description: "Open-source customer engagement platform that provides a shared inbox for teams, live chat, and omnichannel support.", + description: + "Open-source customer engagement platform that provides a shared inbox for teams, live chat, and omnichannel support.", logo: "chatwoot.svg", links: { github: "https://github.com/chatwoot/chatwoot", From 32b3a7645720d16afa383deab98b23023f3bfe0c Mon Sep 17 00:00:00 2001 From: DrMxrcy Date: Tue, 19 Nov 2024 12:30:36 -0500 Subject: [PATCH 4/4] fix: Lint Issues --- apps/dokploy/templates/chatwoot/index.ts | 76 ++++++++++++------------ 1 file changed, 38 insertions(+), 38 deletions(-) diff --git a/apps/dokploy/templates/chatwoot/index.ts b/apps/dokploy/templates/chatwoot/index.ts index d6abe6e74..9c5e44c6b 100644 --- a/apps/dokploy/templates/chatwoot/index.ts +++ b/apps/dokploy/templates/chatwoot/index.ts @@ -1,46 +1,46 @@ import { - type DomainSchema, - type Schema, - type Template, - generateBase64, - generatePassword, - generateRandomDomain, + type DomainSchema, + type Schema, + type Template, + generateBase64, + generatePassword, + generateRandomDomain, } from "../utils"; export function generate(schema: Schema): Template { - const mainDomain = generateRandomDomain(schema); - const secretKeyBase = generateBase64(64); - const postgresPassword = generatePassword(); + const mainDomain = generateRandomDomain(schema); + const secretKeyBase = generateBase64(64); + const postgresPassword = generatePassword(); - const domains: DomainSchema[] = [ - { - host: mainDomain, - port: 3000, - serviceName: "chatwoot-rails", - }, - ]; + const domains: DomainSchema[] = [ + { + host: mainDomain, + port: 3000, + serviceName: "chatwoot-rails", + }, + ]; - const envs = [ - `FRONTEND_URL=http://${mainDomain}`, - `SECRET_KEY_BASE=${secretKeyBase}`, - "RAILS_ENV=production", - "NODE_ENV=production", - "INSTALLATION_ENV=docker", - "RAILS_LOG_TO_STDOUT=true", - "LOG_LEVEL=info", - "DEFAULT_LOCALE=en", - "POSTGRES_HOST=chatwoot-postgres", - "POSTGRES_PORT=5432", - "POSTGRES_DATABASE=chatwoot", - "POSTGRES_USERNAME=postgres", - `POSTGRES_PASSWORD=${postgresPassword}`, - "REDIS_URL=redis://chatwoot-redis:6379", - "ENABLE_ACCOUNT_SIGNUP=false", - "ACTIVE_STORAGE_SERVICE=local", - ]; + const envs = [ + `FRONTEND_URL=http://${mainDomain}`, + `SECRET_KEY_BASE=${secretKeyBase}`, + "RAILS_ENV=production", + "NODE_ENV=production", + "INSTALLATION_ENV=docker", + "RAILS_LOG_TO_STDOUT=true", + "LOG_LEVEL=info", + "DEFAULT_LOCALE=en", + "POSTGRES_HOST=chatwoot-postgres", + "POSTGRES_PORT=5432", + "POSTGRES_DATABASE=chatwoot", + "POSTGRES_USERNAME=postgres", + `POSTGRES_PASSWORD=${postgresPassword}`, + "REDIS_URL=redis://chatwoot-redis:6379", + "ENABLE_ACCOUNT_SIGNUP=false", + "ACTIVE_STORAGE_SERVICE=local", + ]; - return { - domains, - envs, - }; + return { + domains, + envs, + }; }