From a1cdb31e49b682d65c1eff918bf59e0f2fec622d Mon Sep 17 00:00:00 2001 From: Brian Fertig Date: Wed, 12 Aug 2026 13:15:41 -0600 Subject: [PATCH] feat: make host port configurable via APP_PORT env var Allow users to customize the host-side port mapping while keeping the container's internal port fixed at 3000. The default remains 3000 when APP_PORT is unset. - Add APP_PORT to .env.example with documentation - Update docker-compose.yml to use ${APP_PORT:-3000}:3000 - Update README with new env var and usage notes --- .env.example | 4 ++++ README.md | 10 ++++++---- docker-compose.yml | 5 ++++- 3 files changed, 14 insertions(+), 5 deletions(-) diff --git a/.env.example b/.env.example index ca02089..89ebc93 100644 --- a/.env.example +++ b/.env.example @@ -12,3 +12,7 @@ AUTH_SECRET="replace-with-a-generated-secret" POSTGRES_USER=organize POSTGRES_PASSWORD=organize POSTGRES_DB=organize + +# Host port the "app" service is published on (e.g. http://localhost:3000). +# The container always listens on 3000 internally regardless of this value. +APP_PORT=3000 diff --git a/README.md b/README.md index a8af415..09228a3 100644 --- a/README.md +++ b/README.md @@ -69,10 +69,11 @@ the Compose plugin. migrations automatically on every boot before serving traffic. No separate migration or setup step is needed. -4. **Open the app** at [http://localhost:3000](http://localhost:3000) and - sign up. The very first account created becomes the site's - administrator; everyone after that follows whatever - [sign-up mode](#sign-up-modes) is currently set (Open, by default). +4. **Open the app** at [http://localhost:3000](http://localhost:3000) (or + whatever `APP_PORT` you set) and sign up. The very first account + created becomes the site's administrator; everyone after that follows + whatever [sign-up mode](#sign-up-modes) is currently set (Open, by + default). ### Updating @@ -105,6 +106,7 @@ Docker Compose (see `.env.example` for the template). | `POSTGRES_USER` | `db` | Postgres superuser created on first init. | | `POSTGRES_PASSWORD` | `db` | Password for `POSTGRES_USER`. Change this from the `.env.example` placeholder. | | `POSTGRES_DB` | `db` | Database name created on first init. | +| `APP_PORT` | `app` (host mapping only) | Host port the app is published on, e.g. `3000` for `http://localhost:3000`. Defaults to `3000` if unset. The container always listens on 3000 internally regardless of this value. | | `DATABASE_URL` | host-side tooling only | Prisma connection string for running things like `npx prisma studio` from your own machine. **Not** used by the `app` container itself — see note below. | > **Note on `DATABASE_URL`:** inside `docker-compose.yml`, the `app` diff --git a/docker-compose.yml b/docker-compose.yml index 2621c06..dcbe8cc 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -30,4 +30,7 @@ services: AUTH_SECRET: ${AUTH_SECRET} NODE_ENV: production ports: - - "3000:3000" + # Host-side port only -- the container itself always listens on + # 3000 internally (see Dockerfile's EXPOSE). Defaults to 3000 if + # APP_PORT isn't set. + - "${APP_PORT:-3000}:3000"