|
| 1 | +name: trigger |
| 2 | + |
| 3 | +services: |
| 4 | + webapp: |
| 5 | + image: ghcr.io/triggerdotdev/trigger.dev:${TRIGGER_IMAGE_TAG:-main} |
| 6 | + restart: ${RESTART_POLICY:-unless-stopped} |
| 7 | + ports: |
| 8 | + - ${WEBAPP_PUBLISH_IP:-0.0.0.0}:8030:3000 |
| 9 | + depends_on: |
| 10 | + - postgres |
| 11 | + - redis |
| 12 | + networks: |
| 13 | + - webapp |
| 14 | + - supervisor |
| 15 | + - traefik |
| 16 | + volumes: |
| 17 | + - shared:/home/node/shared |
| 18 | + user: root |
| 19 | + command: sh -c "chown -R node:node /home/node/shared && exec ./scripts/entrypoint.sh" |
| 20 | + healthcheck: |
| 21 | + test: ["CMD", "node", "-e", "http.get('http://localhost:3000/healthcheck', res => process.exit(res.statusCode === 200 ? 0 : 1)).on('error', () => process.exit(1))"] |
| 22 | + interval: 30s |
| 23 | + timeout: 10s |
| 24 | + retries: 5 |
| 25 | + start_period: 10s |
| 26 | + environment: |
| 27 | + APP_ORIGIN: http://localhost:8030 |
| 28 | + ELECTRIC_ORIGIN: http://electric:3000 |
| 29 | + DATABASE_URL: postgresql://postgres:postgres@postgres:5432/main?schema=public&sslmode=disable |
| 30 | + DIRECT_URL: postgresql://postgres:postgres@postgres:5432/main?schema=public&sslmode=disable |
| 31 | + SESSION_SECRET: ${SESSION_SECRET} |
| 32 | + MAGIC_LINK_SECRET: ${MAGIC_LINK_SECRET} |
| 33 | + ENCRYPTION_KEY: ${ENCRYPTION_KEY} |
| 34 | + MANAGED_WORKER_SECRET: ${MANAGED_WORKER_SECRET} |
| 35 | + REDIS_HOST: redis |
| 36 | + REDIS_PORT: 6379 |
| 37 | + REDIS_TLS_DISABLED: true |
| 38 | + APP_LOG_LEVEL: info |
| 39 | + DEV_OTEL_EXPORTER_OTLP_ENDPOINT: http://localhost:8030/otel |
| 40 | + TRIGGER_BOOTSTRAP_ENABLED: 1 |
| 41 | + TRIGGER_BOOTSTRAP_WORKER_GROUP_NAME: bootstrap-3 |
| 42 | + TRIGGER_BOOTSTRAP_WORKER_TOKEN_PATH: /home/node/shared/worker_token |
| 43 | + DEPLOY_REGISTRY_HOST: localhost:5000 |
| 44 | + OBJECT_STORE_BASE_URL: http://minio:9000 |
| 45 | + OBJECT_STORE_ACCESS_KEY_ID: BlJ2Hcd6Cgsz3ITBWy4p |
| 46 | + OBJECT_STORE_SECRET_ACCESS_KEY: RskeTL9VAQ7saSSI2hK1MUMaaAIavf7vyQyVPiDu |
| 47 | + GRACEFUL_SHUTDOWN_TIMEOUT: 1000 |
| 48 | + # Limits |
| 49 | + # TASK_PAYLOAD_OFFLOAD_THRESHOLD: 524288 # 512KB |
| 50 | + # TASK_PAYLOAD_MAXIMUM_SIZE: 3145728 # 3MB |
| 51 | + # BATCH_TASK_PAYLOAD_MAXIMUM_SIZE: 1000000 # 1MB |
| 52 | + # TASK_RUN_METADATA_MAXIMUM_SIZE: 262144 # 256KB |
| 53 | + # DEFAULT_ENV_EXECUTION_CONCURRENCY_LIMIT: 100 |
| 54 | + # DEFAULT_ORG_EXECUTION_CONCURRENCY_LIMIT: 100 |
| 55 | + labels: |
| 56 | + - "traefik.enable=true" |
| 57 | + - "traefik.http.routers.webapp.rule=Host(`webapp.localhost`)" |
| 58 | + - "traefik.http.routers.webapp.entrypoints=${TRAEFIK_ENTRYPOINT:-web}" |
| 59 | + # - "traefik.http.routers.webapp.tls.certresolver=letsencrypt" |
| 60 | + - "traefik.http.services.webapp.loadbalancer.server.port=3000" |
| 61 | + |
| 62 | + supervisor: |
| 63 | + image: ghcr.io/triggerdotdev/supervisor:${TRIGGER_IMAGE_TAG:-main} |
| 64 | + restart: ${RESTART_POLICY:-unless-stopped} |
| 65 | + depends_on: |
| 66 | + - webapp |
| 67 | + - docker-proxy |
| 68 | + networks: |
| 69 | + - supervisor |
| 70 | + - docker-proxy |
| 71 | + volumes: |
| 72 | + - shared:/home/node/shared |
| 73 | + user: root |
| 74 | + command: sh -c "chown -R node:node /home/node/shared && exec /usr/bin/dumb-init -- pnpm run --filter supervisor start" |
| 75 | + environment: |
| 76 | + # This needs to match the token of the worker group you want to connect to |
| 77 | + # TRIGGER_WORKER_TOKEN: ${TRIGGER_WORKER_TOKEN} |
| 78 | + TRIGGER_WORKER_TOKEN: file:///home/node/shared/worker_token |
| 79 | + MANAGED_WORKER_SECRET: ${MANAGED_WORKER_SECRET} |
| 80 | + # Point this at the webapp in prod |
| 81 | + TRIGGER_API_URL: http://webapp:3000 |
| 82 | + # Point this at the OTel collector or the webapp in prod |
| 83 | + OTEL_EXPORTER_OTLP_ENDPOINT: http://webapp:3000/otel |
| 84 | + TRIGGER_WORKLOAD_API_DOMAIN: supervisor |
| 85 | + TRIGGER_WORKLOAD_API_PORT_EXTERNAL: 8020 |
| 86 | + # Optional settings |
| 87 | + DEBUG: 1 |
| 88 | + ENFORCE_MACHINE_PRESETS: 1 |
| 89 | + TRIGGER_DEQUEUE_INTERVAL_MS: 1000 |
| 90 | + DOCKER_HOST: tcp://docker-proxy:2375 |
| 91 | + DOCKER_RUNNER_NETWORKS: webapp,supervisor |
| 92 | + DOCKER_REGISTRY_URL: ${DOCKER_REGISTRY_URL:-localhost:5000} |
| 93 | + DOCKER_REGISTRY_USERNAME: ${DOCKER_REGISTRY_USERNAME:-} |
| 94 | + DOCKER_REGISTRY_PASSWORD: ${DOCKER_REGISTRY_PASSWORD:-} |
| 95 | + DOCKER_AUTOREMOVE_EXITED_CONTAINERS: 0 |
| 96 | + healthcheck: |
| 97 | + test: ["CMD", "node", "-e", "http.get('http://localhost:8020/health', res => process.exit(res.statusCode === 200 ? 0 : 1)).on('error', () => process.exit(1))"] |
| 98 | + interval: 30s |
| 99 | + timeout: 10s |
| 100 | + retries: 5 |
| 101 | + start_period: 10s |
| 102 | + |
| 103 | + docker-proxy: |
| 104 | + image: tecnativa/docker-socket-proxy:${DOCKER_PROXY_IMAGE_TAG:-latest} |
| 105 | + restart: ${RESTART_POLICY:-unless-stopped} |
| 106 | + volumes: |
| 107 | + - /var/run/docker.sock:/var/run/docker.sock:ro |
| 108 | + networks: |
| 109 | + - docker-proxy |
| 110 | + environment: |
| 111 | + - LOG_LEVEL=info |
| 112 | + - POST=1 |
| 113 | + - CONTAINERS=1 |
| 114 | + - IMAGES=1 |
| 115 | + - INFO=1 |
| 116 | + - NETWORKS=1 |
| 117 | + healthcheck: |
| 118 | + test: ["CMD", "nc", "-z", "127.0.0.1", "2375"] |
| 119 | + interval: 30s |
| 120 | + timeout: 5s |
| 121 | + retries: 5 |
| 122 | + start_period: 5s |
| 123 | + |
| 124 | + postgres: |
| 125 | + image: postgres:${POSTGRES_IMAGE_TAG:-14} |
| 126 | + restart: ${RESTART_POLICY:-unless-stopped} |
| 127 | + ports: |
| 128 | + - ${POSTGRES_PUBLISH_IP:-127.0.0.1}:5433:5432 |
| 129 | + volumes: |
| 130 | + - postgres:/var/lib/postgresql/data/ |
| 131 | + networks: |
| 132 | + - webapp |
| 133 | + command: |
| 134 | + - -c |
| 135 | + - wal_level=logical |
| 136 | + environment: |
| 137 | + POSTGRES_USER: postgres |
| 138 | + POSTGRES_PASSWORD: postgres |
| 139 | + POSTGRES_DB: postgres |
| 140 | + healthcheck: |
| 141 | + test: ["CMD", "pg_isready", "-U", "postgres"] |
| 142 | + interval: 10s |
| 143 | + timeout: 5s |
| 144 | + retries: 5 |
| 145 | + start_period: 10s |
| 146 | + |
| 147 | + redis: |
| 148 | + image: redis:${REDIS_IMAGE_TAG:-7} |
| 149 | + restart: ${RESTART_POLICY:-unless-stopped} |
| 150 | + ports: |
| 151 | + - ${REDIS_PUBLISH_IP:-127.0.0.1}:6389:6379 |
| 152 | + volumes: |
| 153 | + - redis:/data |
| 154 | + networks: |
| 155 | + - webapp |
| 156 | + healthcheck: |
| 157 | + test: ["CMD", "redis-cli", "ping"] |
| 158 | + interval: 10s |
| 159 | + timeout: 5s |
| 160 | + retries: 5 |
| 161 | + start_period: 10s |
| 162 | + |
| 163 | + electric: |
| 164 | + image: electricsql/electric:${ELECTRIC_IMAGE_TAG:-1.0.13} |
| 165 | + restart: ${RESTART_POLICY:-unless-stopped} |
| 166 | + depends_on: |
| 167 | + - postgres |
| 168 | + networks: |
| 169 | + - webapp |
| 170 | + environment: |
| 171 | + DATABASE_URL: postgresql://postgres:postgres@postgres:5432/main?schema=public&sslmode=disable |
| 172 | + ELECTRIC_INSECURE: true |
| 173 | + ELECTRIC_USAGE_REPORTING: false |
| 174 | + healthcheck: |
| 175 | + test: ["CMD", "curl", "-f", "http://localhost:3000/v1/health"] |
| 176 | + interval: 10s |
| 177 | + timeout: 5s |
| 178 | + retries: 5 |
| 179 | + start_period: 10s |
| 180 | + |
| 181 | + clickhouse: |
| 182 | + image: bitnami/clickhouse:${CLICKHOUSE_IMAGE_TAG:-latest} |
| 183 | + restart: ${RESTART_POLICY:-unless-stopped} |
| 184 | + ports: |
| 185 | + - ${CLICKHOUSE_PUBLISH_IP:-127.0.0.1}:9090:9000 |
| 186 | + environment: |
| 187 | + CLICKHOUSE_ADMIN_USER: default |
| 188 | + CLICKHOUSE_ADMIN_PASSWORD: password |
| 189 | + volumes: |
| 190 | + - clickhouse:/bitnami/clickhouse |
| 191 | + - ./clickhouse/override.xml:/bitnami/clickhouse/etc/config.d/override.xml:ro |
| 192 | + networks: |
| 193 | + - webapp |
| 194 | + healthcheck: |
| 195 | + test: ["CMD", "clickhouse-client", "--host", "localhost", "--port", "9000", "--user", "default", "--password", "password", "--query", "SELECT 1"] |
| 196 | + interval: 5s |
| 197 | + timeout: 5s |
| 198 | + retries: 5 |
| 199 | + start_period: 10s |
| 200 | + |
| 201 | + registry: |
| 202 | + image: registry:${REGISTRY_IMAGE_TAG:-2} |
| 203 | + restart: ${RESTART_POLICY:-unless-stopped} |
| 204 | + ports: |
| 205 | + - ${REGISTRY_PUBLISH_IP:-127.0.0.1}:5000:5000 |
| 206 | + networks: |
| 207 | + - webapp |
| 208 | + volumes: |
| 209 | + # registry-user:very-secure-indeed |
| 210 | + - ./registry/auth.htpasswd:/auth/htpasswd:ro |
| 211 | + environment: |
| 212 | + REGISTRY_AUTH: htpasswd |
| 213 | + REGISTRY_AUTH_HTPASSWD_REALM: Registry Realm |
| 214 | + REGISTRY_AUTH_HTPASSWD_PATH: /auth/htpasswd |
| 215 | + healthcheck: |
| 216 | + test: ["CMD", "wget", "--spider", "-q", "http://localhost:5000/v2/"] |
| 217 | + interval: 10s |
| 218 | + timeout: 5s |
| 219 | + retries: 5 |
| 220 | + start_period: 10s |
| 221 | + |
| 222 | + minio: |
| 223 | + image: minio/minio:${MINIO_IMAGE_TAG:-latest} |
| 224 | + restart: ${RESTART_POLICY:-unless-stopped} |
| 225 | + ports: |
| 226 | + - ${MINIO_PUBLISH_IP:-127.0.0.1}:9000:9000 |
| 227 | + - ${MINIO_PUBLISH_IP:-127.0.0.1}:9001:9001 |
| 228 | + networks: |
| 229 | + - webapp |
| 230 | + volumes: |
| 231 | + - minio:/data |
| 232 | + environment: |
| 233 | + MINIO_ROOT_USER: admin |
| 234 | + MINIO_ROOT_PASSWORD: very-safe-password |
| 235 | + command: server --console-address ":9001" /data |
| 236 | + healthcheck: |
| 237 | + test: ["CMD", "curl", "-f", "http://localhost:9000/minio/health/live"] |
| 238 | + interval: 5s |
| 239 | + timeout: 10s |
| 240 | + retries: 5 |
| 241 | + start_period: 10s |
| 242 | + |
| 243 | + traefik: |
| 244 | + image: traefik:${TRAEFIK_IMAGE_TAG:-v3.4} |
| 245 | + restart: ${RESTART_POLICY:-unless-stopped} |
| 246 | + ports: |
| 247 | + - "80:80" |
| 248 | + - "443:443" |
| 249 | + - "8080:8080" # Traefik dashboard |
| 250 | + networks: |
| 251 | + - traefik |
| 252 | + command: |
| 253 | + - --api.insecure=true |
| 254 | + - --providers.docker=true |
| 255 | + - --providers.docker.exposedbydefault=false |
| 256 | + - --providers.docker.network=traefik |
| 257 | + - --entrypoints.web.address=:80 |
| 258 | + - --entrypoints.websecure.address=:443 |
| 259 | + # - --certificatesresolvers.letsencrypt.acme.tlschallenge=true |
| 260 | + # - --certificatesresolvers.letsencrypt.acme.email=local@foo.bar |
| 261 | + # - --certificatesresolvers.letsencrypt.acme.storage=/letsencrypt/acme.json |
| 262 | + - --log.level=DEBUG |
| 263 | + volumes: |
| 264 | + - /var/run/docker.sock:/var/run/docker.sock:ro |
| 265 | + - traefik-letsencrypt:/letsencrypt |
| 266 | + |
| 267 | +volumes: |
| 268 | + clickhouse: |
| 269 | + postgres: |
| 270 | + redis: |
| 271 | + shared: |
| 272 | + minio: |
| 273 | + traefik-letsencrypt: |
| 274 | + |
| 275 | +networks: |
| 276 | + traefik: |
| 277 | + name: traefik |
| 278 | + docker-proxy: |
| 279 | + name: docker-proxy |
| 280 | + supervisor: |
| 281 | + name: supervisor |
| 282 | + webapp: |
| 283 | + name: webapp |
0 commit comments