Merge pull request #746 from DrMxrcy/refactor/multiple-template-names

fix(templates): Multiple Templates Naming Schema
This commit is contained in:
Mauricio Siu
2024-11-26 22:21:47 -06:00
committed by GitHub
12 changed files with 90 additions and 73 deletions

View File

@@ -1,14 +1,13 @@
version: "3.8" version: "3.8"
services: services:
mysql: tickets-postgres:
image: mysql:8 image: mysql:8
restart: unless-stopped restart: unless-stopped
hostname: mysql
networks: networks:
- dokploy-network - dokploy-network
volumes: volumes:
- tickets-mysql:/var/lib/mysql - tickets-mysql-data:/var/lib/mysql
environment: environment:
MYSQL_DATABASE: ${MYSQL_DATABASE} MYSQL_DATABASE: ${MYSQL_DATABASE}
MYSQL_PASSWORD: ${MYSQL_PASSWORD} MYSQL_PASSWORD: ${MYSQL_PASSWORD}
@@ -20,23 +19,22 @@ services:
timeout: 5s timeout: 5s
retries: 5 retries: 5
bot: tickets-app:
image: eartharoid/discord-tickets:4.0.21 image: eartharoid/discord-tickets:4.0.21
depends_on: depends_on:
mysql: tickets-postgres:
condition: service_healthy condition: service_healthy
restart: unless-stopped restart: unless-stopped
hostname: bot
networks: networks:
- dokploy-network - dokploy-network
volumes: volumes:
- tickets-bot:/home/container/user - tickets-app-data:/home/container/user
- /etc/timezone:/etc/timezone:ro - /etc/timezone:/etc/timezone:ro
- /etc/localtime:/etc/localtime:ro - /etc/localtime:/etc/localtime:ro
tty: true tty: true
stdin_open: true stdin_open: true
environment: environment:
DB_CONNECTION_URL: mysql://${MYSQL_USER}:${MYSQL_PASSWORD}@mysql/${MYSQL_DATABASE} DB_CONNECTION_URL: mysql://${MYSQL_USER}:${MYSQL_PASSWORD}@tickets-postgres/${MYSQL_DATABASE}
DISCORD_SECRET: ${DISCORD_SECRET} DISCORD_SECRET: ${DISCORD_SECRET}
DISCORD_TOKEN: ${DISCORD_TOKEN} DISCORD_TOKEN: ${DISCORD_TOKEN}
ENCRYPTION_KEY: ${ENCRYPTION_KEY} ENCRYPTION_KEY: ${ENCRYPTION_KEY}
@@ -49,6 +47,10 @@ services:
PUBLISH_COMMANDS: "true" PUBLISH_COMMANDS: "true"
SUPER: ${SUPER_USERS} SUPER: ${SUPER_USERS}
networks:
dokploy-network:
external: true
volumes: volumes:
tickets-mysql: tickets-mysql-data:
tickets-bot: tickets-app-data:

View File

@@ -13,7 +13,6 @@ export function generate(schema: Schema): Template {
const mysqlUser = "tickets"; const mysqlUser = "tickets";
const mysqlDatabase = "tickets"; const mysqlDatabase = "tickets";
// Generate encryption key in the format they use
const encryptionKey = Array.from({ length: 48 }, () => const encryptionKey = Array.from({ length: 48 }, () =>
Math.floor(Math.random() * 16).toString(16), Math.floor(Math.random() * 16).toString(16),
).join(""); ).join("");
@@ -22,7 +21,7 @@ export function generate(schema: Schema): Template {
{ {
host: mainDomain, host: mainDomain,
port: 8169, port: 8169,
serviceName: "bot", serviceName: "tickets-app",
}, },
]; ];
@@ -33,7 +32,6 @@ export function generate(schema: Schema): Template {
`MYSQL_ROOT_PASSWORD=${mysqlRootPassword}`, `MYSQL_ROOT_PASSWORD=${mysqlRootPassword}`,
`MYSQL_USER=${mysqlUser}`, `MYSQL_USER=${mysqlUser}`,
`ENCRYPTION_KEY=${encryptionKey}`, `ENCRYPTION_KEY=${encryptionKey}`,
// These need to be set by the user through the UI
"# Follow the guide at: https://discordtickets.app/self-hosting/installation/docker/#creating-the-discord-application", "# Follow the guide at: https://discordtickets.app/self-hosting/installation/docker/#creating-the-discord-application",
"DISCORD_SECRET=", "DISCORD_SECRET=",
"DISCORD_TOKEN=", "DISCORD_TOKEN=",

View File

@@ -1,12 +1,12 @@
version: "3.8" version: "3.8"
services: services:
invoiceshelf_db: invoiceshelf-postgres:
image: postgres:15 image: postgres:15
networks: networks:
- dokploy-network - dokploy-network
volumes: volumes:
- postgres_data:/var/lib/postgresql/data - invoiceshelf-postgres-data:/var/lib/postgresql/data
environment: environment:
- POSTGRES_PASSWORD=${DB_PASSWORD} - POSTGRES_PASSWORD=${DB_PASSWORD}
- POSTGRES_USER=${DB_USERNAME} - POSTGRES_USER=${DB_USERNAME}
@@ -17,13 +17,13 @@ services:
timeout: 5s timeout: 5s
retries: 5 retries: 5
invoiceshelf: invoiceshelf-app:
image: invoiceshelf/invoiceshelf:latest image: invoiceshelf/invoiceshelf:latest
networks: networks:
- dokploy-network - dokploy-network
volumes: volumes:
- app_data:/data - invoiceshelf-app-data:/data
- app_conf:/conf - invoiceshelf-app-conf:/conf
environment: environment:
- PHP_TZ=UTC - PHP_TZ=UTC
- TIMEZONE=UTC - TIMEZONE=UTC
@@ -32,7 +32,7 @@ services:
- APP_DEBUG=false - APP_DEBUG=false
- APP_URL=http://${INVOICESHELF_HOST} - APP_URL=http://${INVOICESHELF_HOST}
- DB_CONNECTION=pgsql - DB_CONNECTION=pgsql
- DB_HOST=invoiceshelf_db - DB_HOST=invoiceshelf-postgres
- DB_PORT=5432 - DB_PORT=5432
- DB_DATABASE=${DB_DATABASE} - DB_DATABASE=${DB_DATABASE}
- DB_USERNAME=${DB_USERNAME} - DB_USERNAME=${DB_USERNAME}
@@ -46,10 +46,14 @@ services:
- SANCTUM_STATEFUL_DOMAINS=${INVOICESHELF_HOST} - SANCTUM_STATEFUL_DOMAINS=${INVOICESHELF_HOST}
- STARTUP_DELAY=10 - STARTUP_DELAY=10
depends_on: depends_on:
invoiceshelf_db: invoiceshelf-postgres:
condition: service_healthy condition: service_healthy
networks:
dokploy-network:
external: true
volumes: volumes:
postgres_data: invoiceshelf-postgres-data:
app_data: invoiceshelf-app-data:
app_conf: invoiceshelf-app-conf:

View File

@@ -16,7 +16,7 @@ export function generate(schema: Schema): Template {
{ {
host: mainDomain, host: mainDomain,
port: 80, port: 80,
serviceName: "invoiceshelf", serviceName: "invoiceshelf-app",
}, },
]; ];

View File

@@ -1,13 +1,13 @@
version: "3.8" version: "3.8"
services: services:
peppermint_postgres: peppermint-postgres:
image: postgres:latest image: postgres:latest
restart: always restart: always
networks: networks:
- dokploy-network - dokploy-network
volumes: volumes:
- pgdata:/var/lib/postgresql/data - peppermint-postgres-data:/var/lib/postgresql/data
environment: environment:
POSTGRES_USER: peppermint POSTGRES_USER: peppermint
POSTGRES_PASSWORD: ${POSTGRES_PASSWORD} POSTGRES_PASSWORD: ${POSTGRES_PASSWORD}
@@ -18,19 +18,23 @@ services:
timeout: 5s timeout: 5s
retries: 5 retries: 5
peppermint: peppermint-app:
image: pepperlabs/peppermint:latest image: pepperlabs/peppermint:latest
restart: always restart: always
networks: networks:
- dokploy-network - dokploy-network
depends_on: depends_on:
peppermint_postgres: peppermint-postgres:
condition: service_healthy condition: service_healthy
environment: environment:
DB_USERNAME: "peppermint" DB_USERNAME: "peppermint"
DB_PASSWORD: ${POSTGRES_PASSWORD} DB_PASSWORD: ${POSTGRES_PASSWORD}
DB_HOST: "peppermint_postgres" DB_HOST: "peppermint-postgres"
SECRET: ${SECRET} SECRET: ${SECRET}
networks:
dokploy-network:
external: true
volumes: volumes:
pgdata: peppermint-postgres-data:

View File

@@ -8,27 +8,24 @@ import {
} from "../utils"; } from "../utils";
export function generate(schema: Schema): Template { export function generate(schema: Schema): Template {
// Generate domains and secrets
const mainDomain = generateRandomDomain(schema); const mainDomain = generateRandomDomain(schema);
const apiDomain = generateRandomDomain(schema); const apiDomain = generateRandomDomain(schema);
const postgresPassword = generatePassword(); const postgresPassword = generatePassword();
const secret = generateBase64(32); const secret = generateBase64(32);
// Configure domain routing
const domains: DomainSchema[] = [ const domains: DomainSchema[] = [
{ {
host: mainDomain, host: mainDomain,
port: 3000, port: 3000,
serviceName: "peppermint", serviceName: "peppermint-app",
}, },
{ {
host: apiDomain, host: apiDomain,
port: 5003, port: 5003,
serviceName: "peppermint", serviceName: "peppermint-app",
}, },
]; ];
// Set environment variables
const envs = [ const envs = [
`MAIN_DOMAIN=${mainDomain}`, `MAIN_DOMAIN=${mainDomain}`,
`API_DOMAIN=${apiDomain}`, `API_DOMAIN=${apiDomain}`,

View File

@@ -1,7 +1,7 @@
version: "3.8" version: "3.8"
services: services:
postiz: postiz-app:
image: ghcr.io/gitroomhq/postiz-app:latest image: ghcr.io/gitroomhq/postiz-app:latest
restart: always restart: always
networks: networks:
@@ -37,7 +37,7 @@ services:
POSTGRES_USER: ${DB_USER} POSTGRES_USER: ${DB_USER}
POSTGRES_DB: ${DB_NAME} POSTGRES_DB: ${DB_NAME}
volumes: volumes:
- postgres-volume:/var/lib/postgresql/data - postiz-postgres-data:/var/lib/postgresql/data
healthcheck: healthcheck:
test: pg_isready -U ${DB_USER} -d ${DB_NAME} test: pg_isready -U ${DB_USER} -d ${DB_NAME}
interval: 10s interval: 10s
@@ -57,8 +57,12 @@ services:
volumes: volumes:
- postiz-redis-data:/data - postiz-redis-data:/data
networks:
dokploy-network:
external: true
volumes: volumes:
postgres-volume: postiz-postgres-data:
postiz-redis-data: postiz-redis-data:
postiz-config: postiz-config:
postiz-uploads: postiz-uploads:

View File

@@ -18,7 +18,7 @@ export function generate(schema: Schema): Template {
{ {
host: mainDomain, host: mainDomain,
port: 5000, port: 5000,
serviceName: "postiz", serviceName: "postiz-app",
}, },
]; ];

View File

@@ -1,26 +1,26 @@
version: "3.8" version: "3.8"
services: services:
slash: slash-app:
image: yourselfhosted/slash:latest image: yourselfhosted/slash:latest
networks: networks:
- dokploy-network - dokploy-network
volumes: volumes:
- slash_data:/var/opt/slash - slash-app-data:/var/opt/slash
environment: environment:
- SLASH_DRIVER=postgres - SLASH_DRIVER=postgres
- SLASH_DSN=postgresql://${DB_USER}:${DB_PASSWORD}@db:5432/${DB_NAME}?sslmode=disable - SLASH_DSN=postgresql://${DB_USER}:${DB_PASSWORD}@slash-postgres:5432/${DB_NAME}?sslmode=disable
depends_on: depends_on:
db: slash-postgres:
condition: service_healthy condition: service_healthy
restart: unless-stopped restart: unless-stopped
db: slash-postgres:
image: postgres:16-alpine image: postgres:16-alpine
networks: networks:
- dokploy-network - dokploy-network
volumes: volumes:
- postgres_data:/var/lib/postgresql/data - slash-postgres-data:/var/lib/postgresql/data
environment: environment:
- POSTGRES_USER=${DB_USER} - POSTGRES_USER=${DB_USER}
- POSTGRES_PASSWORD=${DB_PASSWORD} - POSTGRES_PASSWORD=${DB_PASSWORD}
@@ -32,6 +32,10 @@ services:
retries: 5 retries: 5
restart: unless-stopped restart: unless-stopped
networks:
dokploy-network:
external: true
volumes: volumes:
slash_data: slash-app-data:
postgres_data: slash-postgres-data:

View File

@@ -16,7 +16,7 @@ export function generate(schema: Schema): Template {
{ {
host: mainDomain, host: mainDomain,
port: 5231, port: 5231,
serviceName: "slash", serviceName: "slash-app",
}, },
]; ];

View File

@@ -1,12 +1,12 @@
version: "3.8" version: "3.8"
services: services:
db: windmill-postgres:
image: postgres:16 image: postgres:16
shm_size: 1g shm_size: 1g
restart: unless-stopped restart: unless-stopped
volumes: volumes:
- db_data:/var/lib/postgresql/data - windmill-postgres-data:/var/lib/postgresql/data
networks: networks:
- dokploy-network - dokploy-network
environment: environment:
@@ -18,7 +18,7 @@ services:
timeout: 5s timeout: 5s
retries: 5 retries: 5
windmill_server: windmill-server:
image: ghcr.io/windmill-labs/windmill:main image: ghcr.io/windmill-labs/windmill:main
networks: networks:
- dokploy-network - dokploy-network
@@ -28,12 +28,12 @@ services:
- MODE=server - MODE=server
- BASE_URL=http://${WINDMILL_HOST} - BASE_URL=http://${WINDMILL_HOST}
depends_on: depends_on:
db: windmill-postgres:
condition: service_healthy condition: service_healthy
volumes: volumes:
- worker_logs:/tmp/windmill/logs - windmill-worker-logs:/tmp/windmill/logs
windmill_worker: windmill-worker:
image: ghcr.io/windmill-labs/windmill:main image: ghcr.io/windmill-labs/windmill:main
deploy: deploy:
replicas: 3 replicas: 3
@@ -49,14 +49,14 @@ services:
- MODE=worker - MODE=worker
- WORKER_GROUP=default - WORKER_GROUP=default
depends_on: depends_on:
db: windmill-postgres:
condition: service_healthy condition: service_healthy
volumes: volumes:
- /var/run/docker.sock:/var/run/docker.sock - /var/run/docker.sock:/var/run/docker.sock
- worker_dependency_cache:/tmp/windmill/cache - windmill-worker-cache:/tmp/windmill/cache
- worker_logs:/tmp/windmill/logs - windmill-worker-logs:/tmp/windmill/logs
windmill_worker_native: windmill-worker-native:
image: ghcr.io/windmill-labs/windmill:main image: ghcr.io/windmill-labs/windmill:main
deploy: deploy:
replicas: 1 replicas: 1
@@ -74,20 +74,20 @@ services:
- NUM_WORKERS=8 - NUM_WORKERS=8
- SLEEP_QUEUE=200 - SLEEP_QUEUE=200
depends_on: depends_on:
db: windmill-postgres:
condition: service_healthy condition: service_healthy
volumes: volumes:
- worker_logs:/tmp/windmill/logs - windmill-worker-logs:/tmp/windmill/logs
lsp: windmill-lsp:
image: ghcr.io/windmill-labs/windmill-lsp:latest image: ghcr.io/windmill-labs/windmill-lsp:latest
restart: unless-stopped restart: unless-stopped
networks: networks:
- dokploy-network - dokploy-network
volumes: volumes:
- lsp_cache:/root/.cache - windmill-lsp-cache:/root/.cache
caddy: windmill-caddy:
image: ghcr.io/windmill-labs/caddy-l4:latest image: ghcr.io/windmill-labs/caddy-l4:latest
restart: unless-stopped restart: unless-stopped
networks: networks:
@@ -97,11 +97,15 @@ services:
environment: environment:
- BASE_URL=":80" - BASE_URL=":80"
depends_on: depends_on:
- windmill_server - windmill-server
- lsp - windmill-lsp
networks:
dokploy-network:
external: true
volumes: volumes:
db_data: windmill-postgres-data:
worker_dependency_cache: windmill-worker-cache:
worker_logs: windmill-worker-logs:
lsp_cache: windmill-lsp-cache:

View File

@@ -14,14 +14,14 @@ export function generate(schema: Schema): Template {
{ {
host: mainDomain, host: mainDomain,
port: 80, port: 80,
serviceName: "caddy", serviceName: "windmill-caddy",
}, },
]; ];
const envs = [ const envs = [
`WINDMILL_HOST=${mainDomain}`, `WINDMILL_HOST=${mainDomain}`,
`POSTGRES_PASSWORD=${postgresPassword}`, `POSTGRES_PASSWORD=${postgresPassword}`,
`DATABASE_URL=postgres://postgres:${postgresPassword}@db/windmill?sslmode=disable`, `DATABASE_URL=postgres://postgres:${postgresPassword}@windmill-postgres/windmill?sslmode=disable`,
]; ];
const mounts: Template["mounts"] = [ const mounts: Template["mounts"] = [
@@ -29,8 +29,8 @@ export function generate(schema: Schema): Template {
filePath: "Caddyfile", filePath: "Caddyfile",
content: `:80 { content: `:80 {
bind 0.0.0.0 bind 0.0.0.0
reverse_proxy /ws/* http://lsp:3001 reverse_proxy /ws/* http://windmill-lsp:3001
reverse_proxy /* http://windmill_server:8000 reverse_proxy /* http://windmill-server:8000
}`, }`,
}, },
]; ];