feat: migrate templates

This commit is contained in:
Mauricio Siu
2025-03-09 20:40:08 -06:00
parent fbbb4f46f3
commit 2956016dd3
215 changed files with 2533 additions and 4921 deletions

View File

@@ -1,46 +0,0 @@
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: "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",
];
return {
domains,
envs,
};
}

View File

@@ -0,0 +1,30 @@
variables:
main_domain: ${randomDomain}
secret_key_base: ${generateBase64(64)}
postgres_password: ${generatePassword}
config:
domains:
- serviceName: chatwoot-rails
port: 3000
host: ${main_domain}
env:
- FRONTEND_URL=http://${main_domain}
- SECRET_KEY_BASE=${secret_key_base}
- 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=${postgres_password}
- REDIS_URL=redis://chatwoot-redis:6379
- ENABLE_ACCOUNT_SIGNUP=false
- ACTIVE_STORAGE_SERVICE=local
mounts: []