diff --git a/.env.example b/.env.example index 1542937..32ad99c 100644 --- a/.env.example +++ b/.env.example @@ -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. diff --git a/CHANGELOG.md b/CHANGELOG.md index bbadf61..2dd5305 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -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. diff --git a/README.md b/README.md index 24dadbf..966ed78 100644 --- a/README.md +++ b/README.md @@ -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 diff --git a/docker-compose.yml b/docker-compose.yml index c58a501..ac60fe5 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -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: