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,54 +0,0 @@
import {
type DomainSchema,
type Schema,
type Template,
generatePassword,
generateRandomDomain,
} from "../utils";
export function generate(schema: Schema): Template {
const password = generatePassword();
const mainDomain = generateRandomDomain(schema);
const publicDbPort = ((min: number, max: number) => {
return Math.round(Math.random() * (max - min) + min);
})(32769, 65534);
const domains: DomainSchema[] = [
{
host: mainDomain,
port: 3000,
serviceName: "teable",
},
];
const envs = [
`TEABLE_HOST=${mainDomain}`,
`TEABLE_DB_PORT=${publicDbPort}`,
"TIMEZONE=UTC",
"# Postgres",
"POSTGRES_HOST=teable-db",
"POSTGRES_PORT=5432",
"POSTGRES_DB=teable",
"POSTGRES_USER=teable",
`POSTGRES_PASSWORD=${password}`,
"# App",
"PUBLIC_ORIGIN=https://${TEABLE_HOST}",
"PRISMA_DATABASE_URL=postgresql://${POSTGRES_USER}:${POSTGRES_PASSWORD}@${POSTGRES_HOST}:${POSTGRES_PORT}/${POSTGRES_DB}",
"PUBLIC_DATABASE_PROXY=${TEABLE_HOST}:${TEABLE_DB_PORT}",
"# Need to support sending emails to enable the following configurations",
"# You need to modify the configuration according to the actual situation, otherwise it will not be able to send emails correctly.",
"#BACKEND_MAIL_HOST=smtp.teable.io",
"#BACKEND_MAIL_PORT=465",
"#BACKEND_MAIL_SECURE=true",
"#BACKEND_MAIL_SENDER=noreply.teable.io",
"#BACKEND_MAIL_SENDER_NAME=Teable",
"#BACKEND_MAIL_AUTH_USER=username",
"#BACKEND_MAIL_AUTH_PASS=password",
];
return {
envs,
domains,
};
}

View File

@@ -0,0 +1,36 @@
variables:
main_domain: ${randomDomain}
db_password: ${generatePassword()}
public_db_port: ${Math.round(Math.random() * (65534 - 32769) + 32769)}
config:
domains:
- serviceName: teable
port: 3000
host: ${main_domain}
env:
TEABLE_HOST: ${main_domain}
TEABLE_DB_PORT: ${public_db_port}
TIMEZONE: "UTC"
# Postgres
POSTGRES_HOST: "teable-db"
POSTGRES_PORT: "5432"
POSTGRES_DB: "teable"
POSTGRES_USER: "teable"
POSTGRES_PASSWORD: ${db_password}
# App
PUBLIC_ORIGIN: https://${main_domain}
PRISMA_DATABASE_URL: postgresql://teable:${db_password}@teable-db:5432/teable
PUBLIC_DATABASE_PROXY: ${main_domain}:${public_db_port}
# Need to support sending emails to enable the following configurations
# You need to modify the configuration according to the actual situation, otherwise it will not be able to send emails correctly.
#BACKEND_MAIL_HOST: "smtp.teable.io"
#BACKEND_MAIL_PORT: "465"
#BACKEND_MAIL_SECURE: "true"
#BACKEND_MAIL_SENDER: "noreply.teable.io"
#BACKEND_MAIL_SENDER_NAME: "Teable"
#BACKEND_MAIL_AUTH_USER: "username"
#BACKEND_MAIL_AUTH_PASS: "password"
mounts: []