Public Access
1
0

fix: make docker startup complete successfully

This commit is contained in:
pguerrerox
2026-05-05 00:09:52 +00:00
parent a48c954945
commit ecb3310216
5 changed files with 9 additions and 1 deletions
+1 -1
View File
@@ -13,7 +13,6 @@ COOKIE_SECRET="CHANGE_ME_IN_LOCAL_ENV"
APP_HOST="0.0.0.0" APP_HOST="0.0.0.0"
APP_PORT="4000" APP_PORT="4000"
APP_ORIGIN="http://localhost:3000" APP_ORIGIN="http://localhost:3000"
PG_BOSS_SCHEMA="pgboss"
SESSION_TTL_DAYS="30" SESSION_TTL_DAYS="30"
GOOGLE_MAPS_SERVER_KEY="YOUR_SERVER_MAPS_KEY" GOOGLE_MAPS_SERVER_KEY="YOUR_SERVER_MAPS_KEY"
@@ -21,6 +20,7 @@ GOOGLE_MAPS_SERVER_KEY="YOUR_SERVER_MAPS_KEY"
POSTGRES_DB="leads4less" POSTGRES_DB="leads4less"
POSTGRES_USER="postgres" POSTGRES_USER="postgres"
POSTGRES_PASSWORD="CHANGE_ME_IN_LOCAL_ENV" POSTGRES_PASSWORD="CHANGE_ME_IN_LOCAL_ENV"
PG_BOSS_SCHEMA="pgboss"
# Example Compose DATABASE_URL # Example Compose DATABASE_URL
# DATABASE_URL="postgres://postgres:CHANGE_ME_IN_LOCAL_ENV@db:5432/leads4less" # DATABASE_URL="postgres://postgres:CHANGE_ME_IN_LOCAL_ENV@db:5432/leads4less"
+3
View File
@@ -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. - 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. - 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] ## [2026-04-19]
### Added ### Added
+1
View File
@@ -23,6 +23,7 @@ COPY package*.json ./
RUN npm ci --omit=dev RUN npm ci --omit=dev
COPY --from=build /app/dist-server ./dist-server COPY --from=build /app/dist-server ./dist-server
COPY db/migrations ./dist-server/db/migrations
FROM runtime-base AS api FROM runtime-base AS api
CMD ["npm", "run", "start:api"] CMD ["npm", "run", "start:api"]
+1
View File
@@ -25,6 +25,7 @@ services:
environment: environment:
NODE_ENV: ${NODE_ENV} NODE_ENV: ${NODE_ENV}
DATABASE_URL: ${DATABASE_URL} DATABASE_URL: ${DATABASE_URL}
COOKIE_SECRET: ${COOKIE_SECRET}
PG_BOSS_SCHEMA: ${PG_BOSS_SCHEMA} PG_BOSS_SCHEMA: ${PG_BOSS_SCHEMA}
restart: "no" restart: "no"
+3
View File
@@ -2,6 +2,9 @@ import type { PgBoss } from 'pg-boss';
import { RUN_DEEP_RESEARCH_BATCH_JOB, RUN_SEARCH_JOB } from './names.js'; import { RUN_DEEP_RESEARCH_BATCH_JOB, RUN_SEARCH_JOB } from './names.js';
export async function registerJobs(boss: PgBoss) { 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]) => { await boss.work(RUN_SEARCH_JOB, async ([job]) => {
console.warn(`Job ${RUN_SEARCH_JOB} is queued but not implemented yet`, job?.id); console.warn(`Job ${RUN_SEARCH_JOB} is queued but not implemented yet`, job?.id);
}); });