Skip to content

Commit 8e9f4e6

Browse files
committed
feat: update environment configuration for Docker and enhance README with local development setup
1 parent 884ffc6 commit 8e9f4e6

4 files changed

Lines changed: 40 additions & 3 deletions

File tree

.env.example

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ DB_DRIVER=postgres
22

33
POSTGRES_USER=admin
44
POSTGRES_PASSWORD=password
5-
POSTGRES_DB=ocotillo
5+
POSTGRES_DB=ocotilloapi_dev
66
POSTGRES_HOST=localhost
77
POSTGRES_PORT=5432
88

README.md

Lines changed: 36 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -140,6 +140,36 @@ Notes:
140140
* Create file gcs_credentials.json in the root directory of the project, and obtain its contents from a teammate.
141141
* PostgreSQL uses the default port 5432.
142142

143+
Minimum vars to set in `.env` for local development:
144+
* `POSTGRES_USER`
145+
* `POSTGRES_PASSWORD`
146+
* `POSTGRES_DB` (`ocotilloapi_dev` when using Docker Compose dev)
147+
* `POSTGRES_HOST` (`localhost` for local psql/pytest against mapped Docker port)
148+
* `POSTGRES_PORT` (`5432`)
149+
* `MODE` (`development` recommended locally)
150+
* `SESSION_SECRET_KEY`
151+
152+
Auth-related vars (required when auth is enabled, optional when `AUTHENTIK_DISABLE_AUTHENTICATION=1`):
153+
* `AUTHENTIK_DISABLE_AUTHENTICATION`
154+
* `AUTHENTIK_URL`
155+
* `AUTHENTIK_CLIENT_ID`
156+
* `AUTHENTIK_AUTHORIZE_URL`
157+
* `AUTHENTIK_TOKEN_URL`
158+
159+
pygeoapi vars:
160+
* `PYGEOAPI_MOUNT_PATH` (default `/ogcapi`)
161+
* `PYGEOAPI_RUNTIME_DIR` (default `/tmp/pygeoapi`)
162+
* `PYGEOAPI_POSTGRES_HOST`
163+
* `PYGEOAPI_POSTGRES_PORT`
164+
* `PYGEOAPI_POSTGRES_DB`
165+
* `PYGEOAPI_POSTGRES_USER`
166+
* `PYGEOAPI_POSTGRES_PASSWORD`
167+
168+
Optional telemetry vars:
169+
* `SENTRY_DSN`
170+
* `APITALLY_CLIENT_ID`
171+
* `ENVIRONMENT`
172+
143173
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.
144174

145175
#### 5. Database and server
@@ -169,9 +199,13 @@ docker compose up --build
169199

170200
Notes:
171201
* Requires Docker Desktop.
172-
* Spins up two containers: `db` (PostGIS/PostgreSQL) and `app` (FastAPI API service).
202+
* By default, spins up two containers: `db_dev` (PostGIS/PostgreSQL) and `app` (FastAPI API service).
203+
* `db_test` is opt-in via profile: `docker compose --profile test up`.
173204
* `alembic upgrade head` runs on app startup after `docker compose up`.
174-
* The database listens on port `5432` both inside the container and on your host. Ensure `POSTGRES_PORT=5432` in your `.env` to run local commands against the Docker DB (e.g., `uv run pytest`, `uv run python -m transfers.transfer`).
205+
* Compose uses hardcoded DB names:
206+
* dev: `ocotilloapi_dev`
207+
* test: `ocotilloapi_test`
208+
* The database listens on port `5432` both inside the container and on your host. Ensure `POSTGRES_PORT=5432` and `POSTGRES_DB=ocotilloapi_dev` in your `.env` to run local commands against the Docker dev DB (e.g., `uv run pytest`, `uv run python -m transfers.transfer`).
175209

176210
#### Staging Data
177211

docker-compose.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,8 @@ services:
2121
retries: 20
2222

2323
db_test:
24+
profiles:
25+
- test
2426
build:
2527
context: .
2628
dockerfile: ./docker/db/Dockerfile

entrypoint.sh

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
#!/bin/sh
2+
set -eu
23

34
DB_HOST="${POSTGRES_HOST:-db}"
45
DB_PORT="${POSTGRES_PORT:-5432}"

0 commit comments

Comments
 (0)