Repository navigation
Expand file tree
/
Copy pathdocker-compose.trigger.yml
More file actions
130 lines (126 loc) · 5.26 KB
/
Copy pathdocker-compose.trigger.yml
File metadata and controls
130 lines (126 loc) · 5.26 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
# Optional self-hosted Trigger.dev v4 *webapp only* for Ever Works.
#
# Layered on top of docker-compose.yml (or docker-compose.build.yml) and
# gated behind the `trigger` Compose profile:
#
# docker compose \
# -f docker-compose.yml -f docker-compose.trigger.yml \
# --profile trigger up -d
#
# ===================== READ THIS BEFORE USING =====================
#
# THIS FILE ALONE DOES NOT EXECUTE BACKGROUND JOBS. A full Trigger.dev v4
# self-host needs more than the webapp:
#
# - webapp (this file)
# - supervisor (orchestrates task runners)
# - workers / runner containers (the actual job executors)
# - docker socket proxy (so the supervisor can launch containers safely)
# - object storage (for large payloads — minio works)
# - optionally clickhouse (for production event history)
#
# Without the supervisor + a runner, the webapp will accept job submissions
# from `packages/tasks` and queue them, but nothing will ever pick them up
# off the queue. They will sit indefinitely. This is fine if all you want
# is to:
#
# - browse the Trigger.dev management UI locally,
# - verify that the platform can reach a Trigger.dev API and obtain a
# secret key,
# - exercise the connection / auth path without paying for Cloud during
# development.
#
# If you need jobs to actually run, you have two options:
#
# 1. (Strongly recommended for most operators.) Use Trigger.dev Cloud.
# Sign up at https://trigger.dev, mint a project token, and set
# TRIGGER_SECRET_KEY in .env.compose. Skip this file entirely.
#
# 2. Follow the upstream production self-host template at
# https://trigger.dev/docs/self-hosting/docker which includes the
# supervisor + runner + storage stack. That template is intentionally
# not vendored here — keeping it in sync upstream is non-trivial and
# out of scope for the platform repo.
#
# ===================== Networking notes =====================
#
# This file ships the webapp + a dedicated Postgres + a dedicated Redis on
# ports offset from the platform's own services (Postgres 5432 → 5433,
# Redis 6379 → 6389) so they can coexist on the same Docker network
# without conflict.
services:
ever-works-trigger-db:
image: postgres:16-alpine
container_name: ever-works-trigger-db
restart: unless-stopped
profiles: ['trigger']
environment:
POSTGRES_DB: trigger
POSTGRES_USER: ${TRIGGER_DB_USER:-trigger}
POSTGRES_PASSWORD: ${TRIGGER_DB_PASS:-trigger_password}
command: ['postgres', '-c', 'wal_level=logical']
healthcheck:
test:
[
'CMD-SHELL',
'pg_isready -U $${POSTGRES_USER} -d $${POSTGRES_DB} || exit 1',
]
interval: 10s
timeout: 5s
retries: 5
volumes:
- trigger_postgres_data:/var/lib/postgresql/data/
ports:
- '${TRIGGER_DB_PUBLISH_PORT:-5433}:5432'
networks:
- ever-works-network
ever-works-trigger-redis:
image: redis:7-alpine
container_name: ever-works-trigger-redis
restart: unless-stopped
profiles: ['trigger']
command: ['redis-server', '--appendonly', 'yes']
healthcheck:
test: ['CMD-SHELL', 'redis-cli -h localhost ping | grep -q PONG']
interval: 5s
timeout: 5s
retries: 5
volumes:
- trigger_redis_data:/data
ports:
- '${TRIGGER_REDIS_PUBLISH_PORT:-6389}:6379'
networks:
- ever-works-network
ever-works-trigger-webapp:
# Trigger.dev v4 webapp — pin TRIGGER_IMAGE_TAG in .env.compose to a
# specific v4 release (e.g. `v4.4.6`) for reproducible deploys.
image: ghcr.io/triggerdotdev/trigger.dev:${TRIGGER_IMAGE_TAG:-v4}
container_name: ever-works-trigger-webapp
restart: unless-stopped
profiles: ['trigger']
depends_on:
ever-works-trigger-db:
condition: service_healthy
ever-works-trigger-redis:
condition: service_healthy
environment:
LOGIN_ORIGIN: ${TRIGGER_LOGIN_ORIGIN:-http://localhost:3040}
APP_ORIGIN: ${TRIGGER_APP_ORIGIN:-http://localhost:3040}
DATABASE_URL: postgresql://${TRIGGER_DB_USER:-trigger}:${TRIGGER_DB_PASS:-trigger_password}@ever-works-trigger-db:5432/trigger
DIRECT_URL: postgresql://${TRIGGER_DB_USER:-trigger}:${TRIGGER_DB_PASS:-trigger_password}@ever-works-trigger-db:5432/trigger
REDIS_HOST: ever-works-trigger-redis
REDIS_PORT: 6379
REDIS_TLS_DISABLED: 'true'
SESSION_SECRET: ${TRIGGER_SESSION_SECRET:-change-me-session-secret}
MAGIC_LINK_SECRET: ${TRIGGER_MAGIC_LINK_SECRET:-change-me-magic-link-secret}
ENCRYPTION_KEY: ${TRIGGER_ENCRYPTION_KEY:-change-me-encryption-key-32-bytes}
MANAGED_WORKER_SECRET: ${TRIGGER_MANAGED_WORKER_SECRET:-change-me-worker-secret}
WHITELISTED_EMAILS: ${TRIGGER_WHITELISTED_EMAILS:-}
NODE_ENV: production
ports:
- '${TRIGGER_WEBAPP_PUBLISH_PORT:-3040}:3000'
networks:
- ever-works-network
volumes:
trigger_postgres_data: {}
trigger_redis_data: {}