From a0c41212aab1f6773d4b91795e77427fed414d9e Mon Sep 17 00:00:00 2001 From: xrendan Date: Fri, 27 Mar 2026 16:26:24 -0600 Subject: [PATCH] Add production docker-compose with separate GoodJob worker Runs web and worker as separate containers from the same image. The worker process handles all background jobs and cron scheduling, keeping the web process focused on serving requests. Uses the GOOD_JOB_EXECUTION_MODE env var to set external mode. Co-Authored-By: Claude Opus 4.6 (1M context) --- docker-compose.prod.yml | 45 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 45 insertions(+) create mode 100644 docker-compose.prod.yml diff --git a/docker-compose.prod.yml b/docker-compose.prod.yml new file mode 100644 index 0000000..392e2d6 --- /dev/null +++ b/docker-compose.prod.yml @@ -0,0 +1,45 @@ +services: + web: + build: . + ports: + - "${PORT:-4000}:3000" + environment: + - RAILS_ENV=production + - RAILS_MASTER_KEY + - DATABASE_URL + - HOST + - RAILS_LOG_LEVEL + - RAILS_MAX_THREADS + - GOOD_JOB_EXECUTION_MODE=external + - SMTP_USER_NAME + - SMTP_PASSWORD + - SMTP_ADDRESS + - GEMINI_API_KEY + - APPSIGNAL_PUSH_API_KEY + depends_on: + worker: + condition: service_started + restart: unless-stopped + healthcheck: + test: ["CMD", "curl", "-f", "http://localhost:3000/up"] + interval: 30s + timeout: 5s + retries: 3 + start_period: 30s + + worker: + build: . + command: bundle exec good_job start + environment: + - RAILS_ENV=production + - RAILS_MASTER_KEY + - DATABASE_URL + - HOST + - RAILS_LOG_LEVEL + - GOOD_JOB_EXECUTION_MODE=external + - SMTP_USER_NAME + - SMTP_PASSWORD + - SMTP_ADDRESS + - GEMINI_API_KEY + - APPSIGNAL_PUSH_API_KEY + restart: unless-stopped