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,44 +0,0 @@
import {
type DomainSchema,
type Schema,
type Template,
generateRandomDomain,
} from "../utils";
export function generate(schema: Schema): Template {
const mainDomain = generateRandomDomain(schema);
const apiKey = Array.from({ length: 32 }, () =>
Math.floor(Math.random() * 16).toString(16),
).join("");
const encryptionKey = Array.from({ length: 32 }, () =>
Math.floor(Math.random() * 16).toString(16),
).join("");
const jwtSecret = Array.from({ length: 32 }, () =>
Math.floor(Math.random() * 16).toString(16),
).join("");
const postgresPassword = Array.from({ length: 32 }, () =>
Math.floor(Math.random() * 16).toString(16),
).join("");
const domains: DomainSchema[] = [
{
host: mainDomain,
port: 80,
serviceName: "activepieces",
},
];
const envs = [
`AP_HOST=${mainDomain}`,
`AP_API_KEY=${apiKey}`,
`AP_ENCRYPTION_KEY=${encryptionKey}`,
`AP_JWT_SECRET=${jwtSecret}`,
`AP_POSTGRES_PASSWORD=${postgresPassword}`,
];
return {
domains,
envs,
};
}

View File

@@ -0,0 +1,21 @@
variables:
main_domain: ${randomDomain}
api_key: ${generatePassword(32)}
encryption_key: ${generatePassword(32)}
jwt_secret: ${generatePassword(32)}
postgres_password: ${generatePassword(32)}
config:
domains:
- serviceName: activepieces
port: 80
host: ${main_domain}
env:
- AP_HOST=${main_domain}
- AP_API_KEY=${api_key}
- AP_ENCRYPTION_KEY=${encryption_key}
- AP_JWT_SECRET=${jwt_secret}
- AP_POSTGRES_PASSWORD=${postgres_password}
mounts: []