From 6866c3b116922d07898c67a81f5b2760bdba2fdd Mon Sep 17 00:00:00 2001 From: DrMxrcy Date: Wed, 13 Nov 2024 05:40:19 -0500 Subject: [PATCH] fix: Envs --- apps/dokploy/templates/activepieces/index.ts | 4 +- .../templates/chatwoot/docker-compose.yml | 97 ++++++++++--------- 2 files changed, 51 insertions(+), 50 deletions(-) diff --git a/apps/dokploy/templates/activepieces/index.ts b/apps/dokploy/templates/activepieces/index.ts index b11df36d..575ee8cd 100644 --- a/apps/dokploy/templates/activepieces/index.ts +++ b/apps/dokploy/templates/activepieces/index.ts @@ -2,7 +2,6 @@ import { type DomainSchema, type Schema, type Template, - generateBase64, generateRandomDomain, } from "../utils"; @@ -15,7 +14,8 @@ export function generate(schema: Schema): Template { Math.floor(Math.random() * 16).toString(16)).join(''); const postgresPassword = Array.from({length: 32}, () => Math.floor(Math.random() * 16).toString(16)).join(''); - const redisPassword = generateBase64(32); + const redisPassword = Array.from({length: 32}, () => + Math.floor(Math.random() * 16).toString(16)).join(''); const postgresUser = "activepieces"; const postgresDb = "activepieces"; diff --git a/apps/dokploy/templates/chatwoot/docker-compose.yml b/apps/dokploy/templates/chatwoot/docker-compose.yml index 9d062437..e4b45d29 100644 --- a/apps/dokploy/templates/chatwoot/docker-compose.yml +++ b/apps/dokploy/templates/chatwoot/docker-compose.yml @@ -15,9 +15,9 @@ services: volumes: - postgres_data:/var/lib/postgresql/data environment: - - POSTGRES_DB=chatwoot_production - - POSTGRES_USER=postgres - - POSTGRES_PASSWORD=${POSTGRES_PASSWORD} + POSTGRES_DB: chatwoot_production + POSTGRES_USER: postgres + POSTGRES_PASSWORD: ${POSTGRES_PASSWORD} healthcheck: test: ["CMD-SHELL", "pg_isready -U postgres -h localhost -d chatwoot_production"] interval: 10s @@ -29,11 +29,11 @@ services: image: redis:alpine networks: - dokploy-network - command: ["sh", "-c", "redis-server --requirepass \"${REDIS_PASSWORD}\""] + command: redis-server --requirepass ${REDIS_PASSWORD} volumes: - redis_data:/data healthcheck: - test: ["CMD", "redis-cli", "ping"] + test: ["CMD", "redis-cli", "-a", "${REDIS_PASSWORD}", "ping"] interval: 10s timeout: 5s retries: 5 @@ -42,25 +42,26 @@ services: setup: <<: *base environment: - - NODE_ENV=production - - RAILS_ENV=production - - INSTALLATION_ENV=docker - - FRONTEND_URL=http://${CHATWOOT_HOST} - - SECRET_KEY_BASE=${SECRET_KEY_BASE} - - POSTGRES_HOST=postgres - - POSTGRES_USERNAME=postgres - - POSTGRES_PASSWORD=${POSTGRES_PASSWORD} - - POSTGRES_DATABASE=chatwoot_production - - REDIS_URL=redis://redis:6379 - - REDIS_PASSWORD=${REDIS_PASSWORD} - - ENABLE_ACCOUNT_SIGNUP=false - - FORCE_SSL=false - - RAILS_LOG_TO_STDOUT=true + NODE_ENV: production + RAILS_ENV: production + INSTALLATION_ENV: docker + FRONTEND_URL: http://${CHATWOOT_HOST} + SECRET_KEY_BASE: ${SECRET_KEY_BASE} + POSTGRES_HOST: postgres + POSTGRES_USER: postgres + POSTGRES_PASSWORD: ${POSTGRES_PASSWORD} + POSTGRES_DB: chatwoot_production + REDIS_URL: redis://redis:6379 + REDIS_PASSWORD: ${REDIS_PASSWORD} + ENABLE_ACCOUNT_SIGNUP: "false" + FORCE_SSL: "false" + RAILS_LOG_TO_STDOUT: "true" command: > sh -c " echo 'Waiting for postgres...' - while ! PGPASSWORD='${POSTGRES_PASSWORD}' psql -h postgres -U postgres -d chatwoot_production -c 'SELECT 1' > /dev/null 2>&1; do - sleep 1 + until PGPASSWORD=${POSTGRES_PASSWORD} psql -h postgres -U postgres -d chatwoot_production -c '\q' > /dev/null 2>&1; do + sleep 5 + echo 'Waiting for postgres...' done echo 'PostgreSQL is ready!' bundle exec rails db:chatwoot_prepare @@ -81,20 +82,20 @@ services: redis: condition: service_healthy environment: - - NODE_ENV=production - - RAILS_ENV=production - - INSTALLATION_ENV=docker - - FRONTEND_URL=http://${CHATWOOT_HOST} - - SECRET_KEY_BASE=${SECRET_KEY_BASE} - - POSTGRES_HOST=postgres - - POSTGRES_USERNAME=postgres - - POSTGRES_PASSWORD=${POSTGRES_PASSWORD} - - POSTGRES_DATABASE=chatwoot_production - - REDIS_URL=redis://redis:6379 - - REDIS_PASSWORD=${REDIS_PASSWORD} - - ENABLE_ACCOUNT_SIGNUP=false - - FORCE_SSL=false - - RAILS_LOG_TO_STDOUT=true + NODE_ENV: production + RAILS_ENV: production + INSTALLATION_ENV: docker + FRONTEND_URL: http://${CHATWOOT_HOST} + SECRET_KEY_BASE: ${SECRET_KEY_BASE} + POSTGRES_HOST: postgres + POSTGRES_USER: postgres + POSTGRES_PASSWORD: ${POSTGRES_PASSWORD} + POSTGRES_DB: chatwoot_production + REDIS_URL: redis://redis:6379 + REDIS_PASSWORD: ${REDIS_PASSWORD} + ENABLE_ACCOUNT_SIGNUP: "false" + FORCE_SSL: "false" + RAILS_LOG_TO_STDOUT: "true" entrypoint: docker/entrypoints/rails.sh command: ['bundle', 'exec', 'rails', 's', '-p', '3000', '-b', '0.0.0.0'] restart: always @@ -107,19 +108,19 @@ services: redis: condition: service_healthy environment: - - NODE_ENV=production - - RAILS_ENV=production - - INSTALLATION_ENV=docker - - FRONTEND_URL=http://${CHATWOOT_HOST} - - SECRET_KEY_BASE=${SECRET_KEY_BASE} - - POSTGRES_HOST=postgres - - POSTGRES_USERNAME=postgres - - POSTGRES_PASSWORD=${POSTGRES_PASSWORD} - - POSTGRES_DATABASE=chatwoot_production - - REDIS_URL=redis://redis:6379 - - REDIS_PASSWORD=${REDIS_PASSWORD} - - FORCE_SSL=false - - RAILS_LOG_TO_STDOUT=true + NODE_ENV: production + RAILS_ENV: production + INSTALLATION_ENV: docker + FRONTEND_URL: http://${CHATWOOT_HOST} + SECRET_KEY_BASE: ${SECRET_KEY_BASE} + POSTGRES_HOST: postgres + POSTGRES_USER: postgres + POSTGRES_PASSWORD: ${POSTGRES_PASSWORD} + POSTGRES_DB: chatwoot_production + REDIS_URL: redis://redis:6379 + REDIS_PASSWORD: ${REDIS_PASSWORD} + FORCE_SSL: "false" + RAILS_LOG_TO_STDOUT: "true" command: ['bundle', 'exec', 'sidekiq', '-C', 'config/sidekiq.yml'] restart: always