From 1844faee98f13ad2b1cb7a304d99789c5ed4b8b1 Mon Sep 17 00:00:00 2001 From: Chase Martin Date: Wed, 14 Jan 2026 16:50:44 -0800 Subject: [PATCH 1/2] fix: update app.environment postgres_port for app to db network consitency in docker compose --- docker-compose.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/docker-compose.yml b/docker-compose.yml index 1c6dec4e..30d22b9d 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -27,6 +27,7 @@ services: - POSTGRES_PASSWORD=${POSTGRES_PASSWORD} - POSTGRES_DB=${POSTGRES_DB} - POSTGRES_HOST=db + - POSTGRES_PORT=5432 - MODE=${MODE} - AUTHENTIK_DISABLE_AUTHENTICATION=${AUTHENTIK_DISABLE_AUTHENTICATION} ports: From 3c55b75bd53cebd60d31af0c9b7d5f13471d05a5 Mon Sep 17 00:00:00 2001 From: Chase Martin Date: Wed, 14 Jan 2026 16:59:16 -0800 Subject: [PATCH 2/2] feat: update readme to better reflect docker-compose workflow --- README.md | 59 +++++++++++++++---------------------------------------- 1 file changed, 16 insertions(+), 43 deletions(-) diff --git a/README.md b/README.md index b35d4933..b5cf379e 100644 --- a/README.md +++ b/README.md @@ -97,69 +97,42 @@ Notes: - You can find the exact location from `psql` with: `SHOW config_file;` - After changing the port, restart PostgreSQL so the new port takes effect. -In development set `MODE=development` to allow lexicon enums to be populated. +In development set `MODE=development` to allow lexicon enums to be populated. When `MODE=development`, the app attempts to seed the database with 10 example records via `transfers/seed.py`; if a `contact` record already exists, the seed step is skipped. #### 5. Database and server +Choose one of the following: - - - - - - - - - - - - - - - - - - - - - -
- PostgreSQL + PostGIS installed locally - - Docker -
+**Option A: Local PostgreSQL + PostGIS** ```bash -#run database migrations +# run database migrations alembic upgrade head # start development server uvicorn app.main:app --reload ``` - - + +Notes: +* Requires PostgreSQL with PostGIS installed locally. +* Use the `POSTGRES_*` settings in `.env` for your local instance. + +**Option B: Docker Compose (dev)** ```bash # include -d flag for silent/detached build docker compose up --build ``` -
-Requires PostgreSQL and PostGIS extensions to be installed locally - -Requires Docker Desktop to be installed locally -
- -Run docker exec -it nmsamplelocations-app-1 bash to open a shell inside the running app container. -
- -After the database container is running, you can run tests with Pytest from your local command line (not necessarily inside the app container). -
- +Notes: +* Requires Docker Desktop. +* Spins up two containers: `db` (PostGIS/PostgreSQL) and `app` (FastAPI API service). +* `alembic upgrade head` runs on app startup after `docker compose up`. +* The database listens on `5432` in the container and is published to your host as `54321`. Ensure `POSTGRES_PORT=54321` in your `.env` to run local commands against the Docker DB (e.g., `uv run pytest`, `uv run python -m transfers.transfer`). #### Staging Data -To get staging data into the database run `python -m transfers.transfer` from the root directory of the project. +To get staging data into the database: `python -m transfers.transfer` from the root directory of the project. ### 🧭 Project Structure ```text