fix: ENV Testing

This commit is contained in:
DrMxrcy 2024-11-13 05:32:05 -05:00
parent 8157dd9eaa
commit 9b77573269
4 changed files with 31 additions and 48 deletions

View File

@ -18,21 +18,31 @@ services:
- AP_POSTGRES_USERNAME=${AP_POSTGRES_USERNAME}
- AP_POSTGRES_HOST=postgres
- AP_POSTGRES_PORT=5432
- AP_POSTGRES_USE_SSL=false
- AP_QUEUE_MODE=REDIS
- AP_REDIS_HOST=redis
- AP_REDIS_PORT=6379
- AP_REDIS_PASSWORD=${REDIS_PASSWORD}
- AP_REDIS_PASSWORD=${AP_REDIS_PASSWORD}
- AP_REDIS_DB=0
- AP_REDIS_USE_SSL=false
- AP_ENVIRONMENT=prod
- AP_FRONTEND_URL=https://${AP_HOST}
- AP_ENCRYPTION_KEY=${AP_ENCRYPTION_KEY}
- AP_JWT_SECRET=${AP_JWT_SECRET}
- AP_ENGINE_EXECUTABLE_PATH=dist/packages/engine/main.js
- AP_EXECUTION_MODE=UNSANDBOXED
- AP_FLOW_WORKER_CONCURRENCY=10
- AP_SCHEDULED_WORKER_CONCURRENCY=10
- AP_TELEMETRY_ENABLED=false
- AP_PIECES_SOURCE=DB
- AP_PIECES_SYNC_MODE=OFFICIAL_AUTO
- AP_WEBHOOK_TIMEOUT_SECONDS=30
- AP_TRIGGER_DEFAULT_POLL_INTERVAL=5
- AP_FLOW_TIMEOUT_SECONDS=600
- AP_TELEMETRY_ENABLED=true
- AP_TEMPLATES_SOURCE_URL=https://cloud.activepieces.com/api/v1/flow-templates
- AP_EXECUTION_DATA_RETENTION_DAYS=30
- AP_PROJECT_RATE_LIMITER_ENABLED=true
- AP_MAX_CONCURRENT_JOBS_PER_PROJECT=100
- AP_FILE_STORAGE_LOCATION=DB
postgres:
image: postgres:14.4
@ -53,13 +63,13 @@ services:
redis:
image: redis:7.0.7
command: redis-server --requirepass ${REDIS_PASSWORD}
command: redis-server --requirepass ${AP_REDIS_PASSWORD}
networks:
- dokploy-network
volumes:
- redis_data:/data
healthcheck:
test: ["CMD", "redis-cli", "-a", "${REDIS_PASSWORD}", "ping"]
test: ["CMD", "redis-cli", "-a", "${AP_REDIS_PASSWORD}", "ping"]
interval: 10s
timeout: 5s
retries: 5

View File

@ -9,18 +9,16 @@ import {
export function generate(schema: Schema): Template {
const mainDomain = generateRandomDomain(schema);
const apiKey = Array.from({length: 64}, () =>
Math.floor(Math.random() * 16).toString(16)).join('');
const postgresPassword = Array.from({length: 32}, () =>
const encryptionKey = Array.from({length: 16}, () =>
Math.floor(Math.random() * 16).toString(16)).join('');
const jwtSecret = Array.from({length: 32}, () =>
Math.floor(Math.random() * 16).toString(16)).join('');
const encryptionKey = Array.from({length: 16}, () =>
const postgresPassword = Array.from({length: 32}, () =>
Math.floor(Math.random() * 16).toString(16)).join('');
const redisPassword = generateBase64(32);
const postgresUser = "activepieces";
const postgresDb = "activepieces";
const redisPassword = generateBase64(24);
const domains: DomainSchema[] = [
{
@ -31,14 +29,14 @@ export function generate(schema: Schema): Template {
];
const envs = [
`AP_HOST=${mainDomain}`,
`AP_FRONTEND_URL=https://${mainDomain}`,
`AP_ENCRYPTION_KEY=${encryptionKey}`,
`AP_JWT_SECRET=${jwtSecret}`,
`AP_POSTGRES_DATABASE=${postgresDb}`,
`AP_POSTGRES_PASSWORD=${postgresPassword}`,
`AP_POSTGRES_USERNAME=${postgresUser}`,
`AP_HOST=${mainDomain}`,
`AP_API_KEY=${apiKey}`,
`AP_ENCRYPTION_KEY=${encryptionKey}`,
`AP_JWT_SECRET=${jwtSecret}`,
`REDIS_PASSWORD=${redisPassword}`,
`AP_REDIS_PASSWORD=${redisPassword}`,
];
return {

View File

@ -48,7 +48,7 @@ services:
- FRONTEND_URL=http://${CHATWOOT_HOST}
- SECRET_KEY_BASE=${SECRET_KEY_BASE}
- POSTGRES_HOST=postgres
- POSTGRES_USERNAME=${POSTGRES_USERNAME}
- POSTGRES_USERNAME=postgres
- POSTGRES_PASSWORD=${POSTGRES_PASSWORD}
- POSTGRES_DATABASE=chatwoot_production
- REDIS_URL=redis://redis:6379
@ -56,12 +56,9 @@ services:
- ENABLE_ACCOUNT_SIGNUP=false
- FORCE_SSL=false
- RAILS_LOG_TO_STDOUT=true
- LOG_LEVEL=info
- LOG_SIZE=500
- RAILS_MAX_THREADS=5
command: >
sh -c "
until PGPASSWORD=${POSTGRES_PASSWORD} psql -h postgres -U ${POSTGRES_USERNAME} -d chatwoot_production -c '\q'; do
until PGPASSWORD=${POSTGRES_PASSWORD} psql -h postgres -U postgres -d chatwoot_production -c '\q'; do
echo 'Waiting for postgres...'
sleep 5
done
@ -90,25 +87,14 @@ services:
- FRONTEND_URL=http://${CHATWOOT_HOST}
- SECRET_KEY_BASE=${SECRET_KEY_BASE}
- POSTGRES_HOST=postgres
- POSTGRES_USERNAME=${POSTGRES_USERNAME}
- POSTGRES_USERNAME=postgres
- POSTGRES_PASSWORD=${POSTGRES_PASSWORD}
- POSTGRES_DATABASE=chatwoot_production
- REDIS_URL=redis://redis:6379
- REDIS_PASSWORD=${REDIS_PASSWORD}
- ENABLE_ACCOUNT_SIGNUP=false
- MAILER_SENDER_EMAIL=Chatwoot <no-reply@${CHATWOOT_HOST}>
- FORCE_SSL=false
- RAILS_LOG_TO_STDOUT=true
- LOG_LEVEL=info
- LOG_SIZE=500
- RAILS_MAX_THREADS=5
- SMTP_DOMAIN=${CHATWOOT_HOST}
- SMTP_ADDRESS=${SMTP_ADDRESS}
- SMTP_PORT=${SMTP_PORT}
- SMTP_USERNAME=${SMTP_USERNAME}
- SMTP_PASSWORD=${SMTP_PASSWORD}
- SMTP_AUTHENTICATION=plain
- SMTP_ENABLE_STARTTLS_AUTO=true
entrypoint: docker/entrypoints/rails.sh
command: ['bundle', 'exec', 'rails', 's', '-p', '3000', '-b', '0.0.0.0']
restart: always
@ -127,24 +113,13 @@ services:
- FRONTEND_URL=http://${CHATWOOT_HOST}
- SECRET_KEY_BASE=${SECRET_KEY_BASE}
- POSTGRES_HOST=postgres
- POSTGRES_USERNAME=${POSTGRES_USERNAME}
- 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
- LOG_LEVEL=info
- LOG_SIZE=500
- RAILS_MAX_THREADS=5
- SMTP_DOMAIN=${CHATWOOT_HOST}
- SMTP_ADDRESS=${SMTP_ADDRESS}
- SMTP_PORT=${SMTP_PORT}
- SMTP_USERNAME=${SMTP_USERNAME}
- SMTP_PASSWORD=${SMTP_PASSWORD}
- SMTP_AUTHENTICATION=plain
- SMTP_ENABLE_STARTTLS_AUTO=true
- MAILER_SENDER_EMAIL=Chatwoot <no-reply@${CHATWOOT_HOST}>
command: ['bundle', 'exec', 'sidekiq', '-C', 'config/sidekiq.yml']
restart: always

View File

@ -27,11 +27,11 @@ export function generate(schema: Schema): Template {
const mounts: Template["mounts"] = [
{
filePath: "Caddyfile",
content: `{$BASE_URL} {
bind {$ADDRESS}
content: `:80 {
bind 0.0.0.0
reverse_proxy /ws/* http://lsp:3001
reverse_proxy /* http://windmill_server:8000
}`
}`,
},
];