Public Access
1
0

chore: expose docker services on host ports

This commit is contained in:
pguerrerox
2026-05-05 23:04:06 +00:00
parent ecb3310216
commit d4bce92872
4 changed files with 17 additions and 12 deletions
+1
View File
@@ -4,6 +4,7 @@ NODE_ENV="development"
# Frontend env vars for the Vite app
VITE_API_BASE_URL="http://localhost:4000/api"
VITE_GOOGLE_MAPS_PLATFORM_KEY="YOUR_BROWSER_MAPS_KEY"
WEB_PORT="3000"
# Backend env vars
# For Docker Compose deployments, point DATABASE_URL at the internal "db" host.
+1
View File
@@ -15,6 +15,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/).
- Updated the Docker Compose deployment config to read app secrets and Vite build settings from environment variables, and added a `.dockerignore` to keep container builds leaner.
- 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.
- Published the Docker web and API services to host ports so local Compose runs are reachable directly from the browser with configurable `WEB_PORT` and `APP_PORT` values.
### 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.
+11 -8
View File
@@ -38,18 +38,21 @@ If you open the app from another machine on your LAN, set `VITE_API_BASE_URL` an
## Docker Deployment
1. Copy `.env.example` to `.env` and set at least:
- `DATABASE_URL` to the Compose database host, for example `postgres://postgres:YOUR_PASSWORD@db:5432/leads4less`
- `POSTGRES_DB`
- `POSTGRES_USER`
- `POSTGRES_PASSWORD`
- `COOKIE_SECRET`
- `GOOGLE_MAPS_SERVER_KEY`
- `VITE_API_BASE_URL`
- `VITE_GOOGLE_MAPS_PLATFORM_KEY`
- `DATABASE_URL` to the Compose database host, for example `postgres://postgres:YOUR_PASSWORD@db:5432/leads4less`
- `POSTGRES_DB`
- `POSTGRES_USER`
- `POSTGRES_PASSWORD`
- `WEB_PORT`
- `APP_PORT`
- `COOKIE_SECRET`
- `GOOGLE_MAPS_SERVER_KEY`
- `VITE_API_BASE_URL`
- `VITE_GOOGLE_MAPS_PLATFORM_KEY`
2. Build and start the full stack:
`docker compose up --build`
The Compose stack starts PostGIS, waits for the database to become healthy, runs migrations automatically, and then starts the API, worker, and web containers.
With the default `.env.example` values, the app is exposed on `http://localhost:3000` and the API on `http://localhost:4000`.
## Database Layout
+4 -4
View File
@@ -49,8 +49,8 @@ services:
PG_BOSS_SCHEMA: ${PG_BOSS_SCHEMA}
SESSION_TTL_DAYS: ${SESSION_TTL_DAYS}
restart: unless-stopped
expose:
- ${APP_PORT}
ports:
- "${APP_PORT}:${APP_PORT}"
worker:
build:
@@ -81,8 +81,8 @@ services:
api:
condition: service_started
restart: unless-stopped
expose:
- "80"
ports:
- "${WEB_PORT}:80"
volumes:
leads4less-db: