diff --git a/.env.example b/.env.example index 9d29791..1542937 100644 --- a/.env.example +++ b/.env.example @@ -13,7 +13,6 @@ COOKIE_SECRET="CHANGE_ME_IN_LOCAL_ENV" APP_HOST="0.0.0.0" APP_PORT="4000" APP_ORIGIN="http://localhost:3000" -PG_BOSS_SCHEMA="pgboss" SESSION_TTL_DAYS="30" GOOGLE_MAPS_SERVER_KEY="YOUR_SERVER_MAPS_KEY" @@ -21,6 +20,7 @@ GOOGLE_MAPS_SERVER_KEY="YOUR_SERVER_MAPS_KEY" POSTGRES_DB="leads4less" POSTGRES_USER="postgres" POSTGRES_PASSWORD="CHANGE_ME_IN_LOCAL_ENV" +PG_BOSS_SCHEMA="pgboss" # Example Compose DATABASE_URL # DATABASE_URL="postgres://postgres:CHANGE_ME_IN_LOCAL_ENV@db:5432/leads4less" diff --git a/CHANGELOG.md b/CHANGELOG.md index 18abe56..bbadf61 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -16,6 +16,9 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/). - Aligned the Docker Compose and example environment settings so local and deployment configs use the same variable names and document URL-encoded database passwords when needed. - Simplified container deployment by adding a dedicated migration image and Compose startup ordering so the database becomes healthy, migrations run automatically, and the API, worker, and web services start afterward. +### Fixed +- Fixed the Docker startup flow by passing required env validation into the migration container, bundling SQL migrations into the runtime image, and creating pg-boss queues before the worker starts consuming them. + ## [2026-04-19] ### Added diff --git a/Dockerfile b/Dockerfile index d2e0863..b9e9836 100644 --- a/Dockerfile +++ b/Dockerfile @@ -23,6 +23,7 @@ COPY package*.json ./ RUN npm ci --omit=dev COPY --from=build /app/dist-server ./dist-server +COPY db/migrations ./dist-server/db/migrations FROM runtime-base AS api CMD ["npm", "run", "start:api"] diff --git a/docker-compose.yml b/docker-compose.yml index aaa757c..c58a501 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -25,6 +25,7 @@ services: environment: NODE_ENV: ${NODE_ENV} DATABASE_URL: ${DATABASE_URL} + COOKIE_SECRET: ${COOKIE_SECRET} PG_BOSS_SCHEMA: ${PG_BOSS_SCHEMA} restart: "no" diff --git a/server/src/jobs/register-jobs.ts b/server/src/jobs/register-jobs.ts index 721dcf2..d7d94b8 100644 --- a/server/src/jobs/register-jobs.ts +++ b/server/src/jobs/register-jobs.ts @@ -2,6 +2,9 @@ import type { PgBoss } from 'pg-boss'; import { RUN_DEEP_RESEARCH_BATCH_JOB, RUN_SEARCH_JOB } from './names.js'; export async function registerJobs(boss: PgBoss) { + await boss.createQueue(RUN_SEARCH_JOB); + await boss.createQueue(RUN_DEEP_RESEARCH_BATCH_JOB); + await boss.work(RUN_SEARCH_JOB, async ([job]) => { console.warn(`Job ${RUN_SEARCH_JOB} is queued but not implemented yet`, job?.id); });