From b4593ec1d225ffe15a471687d35df2fbac678dd3 Mon Sep 17 00:00:00 2001 From: "Alexander G." Date: Fri, 4 Oct 2024 12:42:42 +0300 Subject: [PATCH 1/5] Update trigger.yaml --- templates/compose/trigger.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/templates/compose/trigger.yaml b/templates/compose/trigger.yaml index 6181a69259..2e8e9f9a73 100644 --- a/templates/compose/trigger.yaml +++ b/templates/compose/trigger.yaml @@ -6,7 +6,7 @@ services: trigger: - image: ghcr.io/triggerdotdev/trigger.dev:latest + image: ghcr.io/triggerdotdev/trigger.dev:main environment: - SERVICE_FQDN_TRIGGER_3000 - LOGIN_ORIGIN=$SERVICE_FQDN_TRIGGER From ab8b36266bed9182eaa867eaf41ddc51a3e90056 Mon Sep 17 00:00:00 2001 From: "Alexander G." Date: Fri, 4 Oct 2024 12:44:19 +0300 Subject: [PATCH 2/5] Update trigger-with-external-database.yaml --- templates/compose/trigger-with-external-database.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/templates/compose/trigger-with-external-database.yaml b/templates/compose/trigger-with-external-database.yaml index dcd3e2b971..00702452b4 100644 --- a/templates/compose/trigger-with-external-database.yaml +++ b/templates/compose/trigger-with-external-database.yaml @@ -6,7 +6,7 @@ services: trigger: - image: ghcr.io/triggerdotdev/trigger.dev:latest + image: ghcr.io/triggerdotdev/trigger.dev:main environment: - SERVICE_FQDN_TRIGGER_3000 - LOGIN_ORIGIN=$SERVICE_FQDN_TRIGGER From b84cecfd3f757d792017892c793f4bee017a22af Mon Sep 17 00:00:00 2001 From: Alex Renoki Date: Sat, 5 Oct 2024 10:21:14 +0300 Subject: [PATCH 3/5] Added missing services. --- templates/compose/trigger.yaml | 44 ++++++++++++++++++++++++++++++++-- 1 file changed, 42 insertions(+), 2 deletions(-) diff --git a/templates/compose/trigger.yaml b/templates/compose/trigger.yaml index 2e8e9f9a73..1064ef789e 100644 --- a/templates/compose/trigger.yaml +++ b/templates/compose/trigger.yaml @@ -11,15 +11,23 @@ services: - SERVICE_FQDN_TRIGGER_3000 - LOGIN_ORIGIN=$SERVICE_FQDN_TRIGGER - APP_ORIGIN=$SERVICE_FQDN_TRIGGER + - ELECTRIC_ORIGIN=http://electric:3000 - MAGIC_LINK_SECRET=$SERVICE_PASSWORD_64_MAGIC - ENCRYPTION_KEY=$SERVICE_PASSWORD_64_ENCRYPTION - SESSION_SECRET=$SERVICE_PASSWORD_64_SESSION + - PROVIDER_SECRET=$SERVICE_PASSWORD_64_PROVIDER + - COORDINATOR_SECRET=$SERVICE_PASSWORD_64_COORDINATOR - POSTGRES_USER=$SERVICE_USER_POSTGRES - POSTGRES_PASSWORD=$SERVICE_PASSWORD_POSTGRES - POSTGRES_DB=${POSTGRES_DB:-trigger} - POSTGRES_HOST=postgres - DATABASE_URL=postgres://$SERVICE_USER_POSTGRES:$SERVICE_PASSWORD_POSTGRES@postgresql:5432/$POSTGRES_DB - DIRECT_URL=postgres://$SERVICE_USER_POSTGRES:$SERVICE_PASSWORD_POSTGRES@postgresql:5432/$POSTGRES_DB + - REDIS_HOST=redis + - REDIS_PORT=6379 + - REDIS_TLS_DISABLED=true + - V3_ENABLED=${V3_ENABLED:-true} + - REMIX_APP_PORT=${REMIX_APP_PORT:-3000} - RUNTIME_PLATFORM=docker-compose - NODE_ENV=production - AUTH_GITHUB_CLIENT_ID=${AUTH_GITHUB_CLIENT_ID} @@ -30,10 +38,43 @@ services: depends_on: postgresql: condition: service_healthy + redis: + condition: service_healthy + electric: + condition: service_healthy + healthcheck: + test: + - CMD-SHELL + - pwd + electric: + image: electricsql/electric + restart: always + environment: + DATABASE_URL: postgres://$SERVICE_USER_POSTGRES:$SERVICE_PASSWORD_POSTGRES@postgresql:5432/$POSTGRES_DB + depends_on: + postgresql: + condition: service_healthy + healthcheck: + test: + - CMD-SHELL + - pwd + redis: + image: "redis:7" + environment: + - ALLOW_EMPTY_PASSWORD=yes + restart: always healthcheck: - test: ["NONE"] + test: + - CMD-SHELL + - "redis-cli -h localhost -p 6379 ping" + interval: 5s + timeout: 5s + retries: 3 + volumes: + - redis-data:/data postgresql: image: postgres:16-alpine + restart: always volumes: - postgresql-data:/var/lib/postgresql/data environment: @@ -45,4 +86,3 @@ services: interval: 5s timeout: 20s retries: 10 - From b1e91252f3ccb640c1d2cd29edc23454775e70db Mon Sep 17 00:00:00 2001 From: Alex Renoki Date: Wed, 9 Oct 2024 12:54:19 +0300 Subject: [PATCH 4/5] Updated trigger service --- templates/compose/trigger.yaml | 122 ++++++++++++++++++++++++--------- 1 file changed, 90 insertions(+), 32 deletions(-) diff --git a/templates/compose/trigger.yaml b/templates/compose/trigger.yaml index 1064ef789e..e33459535b 100644 --- a/templates/compose/trigger.yaml +++ b/templates/compose/trigger.yaml @@ -4,37 +4,56 @@ # logo: svgs/trigger.png # port: 3000 +x-common-env: &common-env + PORT: 3030 + REMIX_APP_PORT: 3000 + NODE_ENV: production + RUNTIME_PLATFORM: docker-compose + V3_ENABLED: true + INTERNAL_OTEL_TRACE_DISABLED: 1 + INTERNAL_OTEL_TRACE_LOGGING_ENABLED: 0 + POSTGRES_USER: $SERVICE_USER_POSTGRES + POSTGRES_PASSWORD: $SERVICE_PASSWORD_POSTGRES + POSTGRES_DB: ${POSTGRES_DB:-trigger} + MAGIC_LINK_SECRET: $SERVICE_PASSWORD_64_MAGIC + SESSION_SECRET: $SERVICE_PASSWORD_64_SESSION + ENCRYPTION_KEY: $SERVICE_PASSWORD_64_ENCRYPTION + PROVIDER_SECRET: $SERVICE_PASSWORD_64_PROVIDER + COORDINATOR_SECRET: $SERVICE_PASSWORD_64_COORDINATOR + DATABASE_HOST: postgresql + DATABASE_URL: postgres://$SERVICE_USER_POSTGRES:$SERVICE_PASSWORD_POSTGRES@postgresql:5432/$POSTGRES_DB + DIRECT_URL: postgres://$SERVICE_USER_POSTGRES:$SERVICE_PASSWORD_POSTGRES@postgresql:5432/$POSTGRES_DB + REDIS_HOST: redis + REDIS_PORT: 6379 + REDIS_TLS_DISABLED: true + COORDINATOR_HOST: 127.0.0.1 + COORDINATOR_PORT: 9020 + WHITELISTED_EMAILS: "" + ADMIN_EMAILS: "" + DEFAULT_ORG_EXECUTION_CONCURRENCY_LIMIT: 300 + DEFAULT_ENV_EXECUTION_CONCURRENCY_LIMIT: 100 + DEPLOY_REGISTRY_HOST: docker.io + DEPLOY_REGISTRY_NAMESPACE: trigger + REGISTRY_HOST: ${DEPLOY_REGISTRY_HOST} + REGISTRY_NAMESPACE: ${DEPLOY_REGISTRY_NAMESPACE} + AUTH_GITHUB_CLIENT_ID: ${AUTH_GITHUB_CLIENT_ID} + AUTH_GITHUB_CLIENT_SECRET: ${AUTH_GITHUB_CLIENT_SECRET} + RESEND_API_KEY: ${RESEND_API_KEY} + FROM_EMAIL: ${FROM_EMAIL} + REPLY_TO_EMAIL: ${REPLY_TO_EMAIL} + LOGIN_ORIGIN: $SERVICE_FQDN_TRIGGER_3000 + APP_ORIGIN: $SERVICE_FQDN_TRIGGER_3000 + DEV_OTEL_EXPORTER_OTLP_ENDPOINT: $SERVICE_FQDN_TRIGGER_3000/otel + OTEL_EXPORTER_OTLP_ENDPOINT: "http://trigger:3040/otel" + ELECTRIC_ORIGIN: http://electric:3000 + services: trigger: - image: ghcr.io/triggerdotdev/trigger.dev:main + image: ghcr.io/triggerdotdev/trigger.dev:v3 + restart: always environment: - - SERVICE_FQDN_TRIGGER_3000 - - LOGIN_ORIGIN=$SERVICE_FQDN_TRIGGER - - APP_ORIGIN=$SERVICE_FQDN_TRIGGER - - ELECTRIC_ORIGIN=http://electric:3000 - - MAGIC_LINK_SECRET=$SERVICE_PASSWORD_64_MAGIC - - ENCRYPTION_KEY=$SERVICE_PASSWORD_64_ENCRYPTION - - SESSION_SECRET=$SERVICE_PASSWORD_64_SESSION - - PROVIDER_SECRET=$SERVICE_PASSWORD_64_PROVIDER - - COORDINATOR_SECRET=$SERVICE_PASSWORD_64_COORDINATOR - - POSTGRES_USER=$SERVICE_USER_POSTGRES - - POSTGRES_PASSWORD=$SERVICE_PASSWORD_POSTGRES - - POSTGRES_DB=${POSTGRES_DB:-trigger} - - POSTGRES_HOST=postgres - - DATABASE_URL=postgres://$SERVICE_USER_POSTGRES:$SERVICE_PASSWORD_POSTGRES@postgresql:5432/$POSTGRES_DB - - DIRECT_URL=postgres://$SERVICE_USER_POSTGRES:$SERVICE_PASSWORD_POSTGRES@postgresql:5432/$POSTGRES_DB - - REDIS_HOST=redis - - REDIS_PORT=6379 - - REDIS_TLS_DISABLED=true - - V3_ENABLED=${V3_ENABLED:-true} - - REMIX_APP_PORT=${REMIX_APP_PORT:-3000} - - RUNTIME_PLATFORM=docker-compose - - NODE_ENV=production - - AUTH_GITHUB_CLIENT_ID=${AUTH_GITHUB_CLIENT_ID} - - AUTH_GITHUB_CLIENT_SECRET=${AUTH_GITHUB_CLIENT_SECRET} - - RESEND_API_KEY=${RESEND_API_KEY} - - FROM_EMAIL=${FROM_EMAIL} - - REPLY_TO_EMAIL=${REPLY_TO_EMAIL} + SERVICE_FQDN_TRIGGER_3000: "" + <<: *common-env depends_on: postgresql: condition: service_healthy @@ -50,7 +69,7 @@ services: image: electricsql/electric restart: always environment: - DATABASE_URL: postgres://$SERVICE_USER_POSTGRES:$SERVICE_PASSWORD_POSTGRES@postgresql:5432/$POSTGRES_DB + <<: *common-env depends_on: postgresql: condition: service_healthy @@ -78,11 +97,50 @@ services: volumes: - postgresql-data:/var/lib/postgresql/data environment: - - POSTGRES_USER=$SERVICE_USER_POSTGRES - - POSTGRES_PASSWORD=$SERVICE_PASSWORD_POSTGRES - - POSTGRES_DB=${POSTGRES_DB:-trigger} + <<: *common-env + command: + - -c + - wal_level=logical healthcheck: test: ["CMD-SHELL", "pg_isready -U $${POSTGRES_USER} -d $${POSTGRES_DB}"] interval: 5s timeout: 20s retries: 10 + docker-provider: + image: ghcr.io/triggerdotdev/provider/docker:v3 + restart: always + volumes: + - /var/run/docker.sock:/var/run/docker.sock + user: root + depends_on: + trigger: + condition: service_healthy + environment: + <<: *common-env + PLATFORM_HOST: trigger + PLATFORM_WS_PORT: 3030 + SECURE_CONNECTION: "false" + PLATFORM_SECRET: $PROVIDER_SECRET + coordinator: + image: ghcr.io/triggerdotdev/coordinator:v3 + restart: always + volumes: + - /var/run/docker.sock:/var/run/docker.sock + user: root + depends_on: + trigger: + condition: service_healthy + environment: + <<: *common-env + PLATFORM_HOST: trigger + PLATFORM_WS_PORT: 3030 + SECURE_CONNECTION: "false" + PLATFORM_SECRET: $COORDINATOR_SECRET + healthcheck: + test: + - CMD-SHELL + - pwd + +volumes: + postgresql-data: + redis-data: From c3c1671b6cd07cdd3e222ca9d86f12695817e9fa Mon Sep 17 00:00:00 2001 From: "Alexander G." Date: Sun, 20 Oct 2024 14:24:13 +0300 Subject: [PATCH 5/5] Adding healthcheck to trigger --- templates/compose/trigger.yaml | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/templates/compose/trigger.yaml b/templates/compose/trigger.yaml index e33459535b..818f54eb40 100644 --- a/templates/compose/trigger.yaml +++ b/templates/compose/trigger.yaml @@ -62,9 +62,10 @@ services: electric: condition: service_healthy healthcheck: - test: - - CMD-SHELL - - pwd + test: "timeout 10s bash -c ':> /dev/tcp/127.0.0.1/3000' || exit 1" + interval: 10s + timeout: 5s + retries: 5 electric: image: electricsql/electric restart: always