mirror of
https://github.com/Dokploy/dokploy
synced 2025-06-26 18:27:59 +00:00
add trigger template
This commit is contained in:
2
apps/dokploy/public/templates/trigger.svg
Normal file
2
apps/dokploy/public/templates/trigger.svg
Normal file
File diff suppressed because one or more lines are too long
|
After Width: | Height: | Size: 7.2 KiB |
File diff suppressed because it is too large
Load Diff
107
apps/dokploy/templates/trigger/docker-compose.yml
Normal file
107
apps/dokploy/templates/trigger/docker-compose.yml
Normal file
@@ -0,0 +1,107 @@
|
|||||||
|
x-webapp-env: &webapp-env
|
||||||
|
LOGIN_ORIGIN: &trigger-url ${TRIGGER_PROTOCOL:-http}://${TRIGGER_DOMAIN:-localhost:3040}
|
||||||
|
APP_ORIGIN: *trigger-url
|
||||||
|
DEV_OTEL_EXPORTER_OTLP_ENDPOINT: &trigger-otel ${TRIGGER_PROTOCOL:-http}://${TRIGGER_DOMAIN:-localhost:3040}/otel
|
||||||
|
ELECTRIC_ORIGIN: http://electric:3000
|
||||||
|
|
||||||
|
x-worker-env: &worker-env
|
||||||
|
PLATFORM_HOST: webapp
|
||||||
|
PLATFORM_WS_PORT: 3030
|
||||||
|
SECURE_CONNECTION: "false"
|
||||||
|
OTEL_EXPORTER_OTLP_ENDPOINT: *trigger-otel
|
||||||
|
|
||||||
|
volumes:
|
||||||
|
postgres-data:
|
||||||
|
redis-data:
|
||||||
|
|
||||||
|
networks:
|
||||||
|
webapp:
|
||||||
|
|
||||||
|
services:
|
||||||
|
webapp:
|
||||||
|
image: ghcr.io/triggerdotdev/trigger.dev:${TRIGGER_IMAGE_TAG:-v3}
|
||||||
|
restart: ${RESTART_POLICY:-unless-stopped}
|
||||||
|
env_file:
|
||||||
|
- .env
|
||||||
|
environment:
|
||||||
|
<<: *webapp-env
|
||||||
|
ports:
|
||||||
|
- ${WEBAPP_PUBLISH_IP:-127.0.0.1}:3040:3030
|
||||||
|
depends_on:
|
||||||
|
- postgres
|
||||||
|
- redis
|
||||||
|
networks:
|
||||||
|
- webapp
|
||||||
|
|
||||||
|
postgres:
|
||||||
|
image: postgres:${POSTGRES_IMAGE_TAG:-16}
|
||||||
|
restart: ${RESTART_POLICY:-unless-stopped}
|
||||||
|
volumes:
|
||||||
|
- postgres-data:/var/lib/postgresql/data/
|
||||||
|
env_file:
|
||||||
|
- .env
|
||||||
|
networks:
|
||||||
|
- webapp
|
||||||
|
ports:
|
||||||
|
- ${DOCKER_PUBLISH_IP:-127.0.0.1}:5433:5432
|
||||||
|
command:
|
||||||
|
- -c
|
||||||
|
- wal_level=logical
|
||||||
|
|
||||||
|
redis:
|
||||||
|
image: redis:${REDIS_IMAGE_TAG:-7}
|
||||||
|
restart: ${RESTART_POLICY:-unless-stopped}
|
||||||
|
volumes:
|
||||||
|
- redis-data:/data
|
||||||
|
networks:
|
||||||
|
- webapp
|
||||||
|
ports:
|
||||||
|
- ${DOCKER_PUBLISH_IP:-127.0.0.1}:6389:6379
|
||||||
|
|
||||||
|
docker-provider:
|
||||||
|
image: ghcr.io/triggerdotdev/provider/docker:${TRIGGER_IMAGE_TAG:-v3}
|
||||||
|
restart: ${RESTART_POLICY:-unless-stopped}
|
||||||
|
volumes:
|
||||||
|
- /var/run/docker.sock:/var/run/docker.sock
|
||||||
|
user: root
|
||||||
|
networks:
|
||||||
|
- webapp
|
||||||
|
depends_on:
|
||||||
|
- webapp
|
||||||
|
ports:
|
||||||
|
- ${DOCKER_PUBLISH_IP:-127.0.0.1}:9021:9020
|
||||||
|
env_file:
|
||||||
|
- .env
|
||||||
|
environment:
|
||||||
|
<<: *worker-env
|
||||||
|
PLATFORM_SECRET: $PROVIDER_SECRET
|
||||||
|
|
||||||
|
coordinator:
|
||||||
|
image: ghcr.io/triggerdotdev/coordinator:${TRIGGER_IMAGE_TAG:-v3}
|
||||||
|
restart: ${RESTART_POLICY:-unless-stopped}
|
||||||
|
volumes:
|
||||||
|
- /var/run/docker.sock:/var/run/docker.sock
|
||||||
|
user: root
|
||||||
|
networks:
|
||||||
|
- webapp
|
||||||
|
depends_on:
|
||||||
|
- webapp
|
||||||
|
ports:
|
||||||
|
- ${DOCKER_PUBLISH_IP:-127.0.0.1}:9020:9020
|
||||||
|
env_file:
|
||||||
|
- .env
|
||||||
|
environment:
|
||||||
|
<<: *worker-env
|
||||||
|
PLATFORM_SECRET: $COORDINATOR_SECRET
|
||||||
|
|
||||||
|
electric:
|
||||||
|
image: electricsql/electric:${ELECTRIC_IMAGE_TAG:-latest}
|
||||||
|
restart: ${RESTART_POLICY:-unless-stopped}
|
||||||
|
environment:
|
||||||
|
DATABASE_URL: ${DATABASE_URL}?sslmode=disable
|
||||||
|
networks:
|
||||||
|
- webapp
|
||||||
|
depends_on:
|
||||||
|
- postgres
|
||||||
|
ports:
|
||||||
|
- ${DOCKER_PUBLISH_IP:-127.0.0.1}:3061:3000
|
||||||
56
apps/dokploy/templates/trigger/index.ts
Normal file
56
apps/dokploy/templates/trigger/index.ts
Normal file
@@ -0,0 +1,56 @@
|
|||||||
|
import {
|
||||||
|
type DomainSchema,
|
||||||
|
type Schema,
|
||||||
|
type Template,
|
||||||
|
generateBase64,
|
||||||
|
generateRandomDomain,
|
||||||
|
} from "../utils";
|
||||||
|
|
||||||
|
export function generate(schema: Schema): Template {
|
||||||
|
const triggerDomain = generateRandomDomain(schema);
|
||||||
|
const providerSecret = generateBase64(32);
|
||||||
|
const coordinatorSecret = generateBase64(32);
|
||||||
|
const dbPassword = generateBase64(24);
|
||||||
|
const dbUser = "triggeruser";
|
||||||
|
const dbName = "triggerdb";
|
||||||
|
|
||||||
|
const domains: DomainSchema[] = [
|
||||||
|
{
|
||||||
|
host: triggerDomain,
|
||||||
|
port: 3040,
|
||||||
|
serviceName: "webapp",
|
||||||
|
},
|
||||||
|
];
|
||||||
|
|
||||||
|
const envs = [
|
||||||
|
// Database configuration with secure credentials
|
||||||
|
`POSTGRES_USER=${dbUser}`,
|
||||||
|
`POSTGRES_PASSWORD=${dbPassword}`,
|
||||||
|
`POSTGRES_DB=${dbName}`,
|
||||||
|
`DATABASE_URL=postgresql://${dbUser}:${dbPassword}@postgres:5432/${dbName}`,
|
||||||
|
|
||||||
|
// Trigger configuration
|
||||||
|
`TRIGGER_DOMAIN=${triggerDomain}`,
|
||||||
|
"TRIGGER_PROTOCOL=http",
|
||||||
|
|
||||||
|
// Secrets for services
|
||||||
|
`PROVIDER_SECRET=${providerSecret}`,
|
||||||
|
`COORDINATOR_SECRET=${coordinatorSecret}`,
|
||||||
|
|
||||||
|
// Optional configurations with defaults
|
||||||
|
"TRIGGER_IMAGE_TAG=v3",
|
||||||
|
"POSTGRES_IMAGE_TAG=16",
|
||||||
|
"REDIS_IMAGE_TAG=7",
|
||||||
|
"ELECTRIC_IMAGE_TAG=latest",
|
||||||
|
"RESTART_POLICY=unless-stopped",
|
||||||
|
|
||||||
|
// Network bindings
|
||||||
|
"WEBAPP_PUBLISH_IP=127.0.0.1",
|
||||||
|
"DOCKER_PUBLISH_IP=127.0.0.1",
|
||||||
|
];
|
||||||
|
|
||||||
|
return {
|
||||||
|
envs,
|
||||||
|
domains,
|
||||||
|
};
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user