fix: Envs

This commit is contained in:
DrMxrcy
2024-11-13 05:40:19 -05:00
parent 444302e7b9
commit 6866c3b116
2 changed files with 51 additions and 50 deletions

View File

@@ -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";

View File

@@ -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