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,59 +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 apiKey = generateBase64(64);
const postgresPassword = generatePassword();
const domains: DomainSchema[] = [
{
host: mainDomain,
port: 8080,
serviceName: "evolution-api",
},
];
const envs = [
`SERVER_URL=https://${mainDomain}`,
"AUTHENTICATION_TYPE=apikey",
`AUTHENTICATION_API_KEY=${apiKey}`,
"AUTHENTICATION_EXPOSE_IN_FETCH_INSTANCES=true",
"LANGUAGE=en",
"CONFIG_SESSION_PHONE_CLIENT=Evolution API",
"CONFIG_SESSION_PHONE_NAME=Chrome",
"TELEMETRY=false",
"TELEMETRY_URL=",
"POSTGRES_DATABASE=evolution",
"POSTGRES_USERNAME=postgresql",
`POSTGRES_PASSWORD=${postgresPassword}`,
"DATABASE_ENABLED=true",
"DATABASE_PROVIDER=postgresql",
`DATABASE_CONNECTION_URI=postgres://postgresql:${postgresPassword}@evolution-postgres:5432/evolution`,
"DATABASE_SAVE_DATA_INSTANCE=true",
"DATABASE_SAVE_DATA_NEW_MESSAGE=true",
"DATABASE_SAVE_MESSAGE_UPDATE=true",
"DATABASE_SAVE_DATA_CONTACTS=true",
"DATABASE_SAVE_DATA_CHATS=true",
"DATABASE_SAVE_DATA_LABELS=true",
"DATABASE_SAVE_DATA_HISTORIC=true",
"CACHE_REDIS_ENABLED=true",
"CACHE_REDIS_URI=redis://evolution-redis:6379",
"CACHE_REDIS_PREFIX_KEY=evolution",
"CACHE_REDIS_SAVE_INSTANCES=true",
];
return {
domains,
envs,
};
}

View File

@@ -0,0 +1,40 @@
variables:
main_domain: ${randomDomain}
api_key: ${generateBase64(64)}
postgres_password: ${generatePassword}
config:
domains:
- serviceName: evolution-api
port: 8080
host: ${main_domain}
env:
- SERVER_URL=https://${main_domain}
- AUTHENTICATION_TYPE=apikey
- AUTHENTICATION_API_KEY=${api_key}
- AUTHENTICATION_EXPOSE_IN_FETCH_INSTANCES=true
- LANGUAGE=en
- CONFIG_SESSION_PHONE_CLIENT=Evolution API
- CONFIG_SESSION_PHONE_NAME=Chrome
- TELEMETRY=false
- TELEMETRY_URL=
- POSTGRES_DATABASE=evolution
- POSTGRES_USERNAME=postgresql
- POSTGRES_PASSWORD=${postgres_password}
- DATABASE_ENABLED=true
- DATABASE_PROVIDER=postgresql
- DATABASE_CONNECTION_URI=postgres://postgresql:${postgres_password}@evolution-postgres:5432/evolution
- DATABASE_SAVE_DATA_INSTANCE=true
- DATABASE_SAVE_DATA_NEW_MESSAGE=true
- DATABASE_SAVE_MESSAGE_UPDATE=true
- DATABASE_SAVE_DATA_CONTACTS=true
- DATABASE_SAVE_DATA_CHATS=true
- DATABASE_SAVE_DATA_LABELS=true
- DATABASE_SAVE_DATA_HISTORIC=true
- CACHE_REDIS_ENABLED=true
- CACHE_REDIS_URI=redis://evolution-redis:6379
- CACHE_REDIS_PREFIX_KEY=evolution
- CACHE_REDIS_SAVE_INSTANCES=true
mounts: []