# Local PostgreSQL for a self-contained Navi deployment.
# The pgvector image ships the `vector` extension; pg_trgm ships in postgres
# contrib. Navi's DDL expects both to be installed (install.sh handles that).
#
# Bound to 127.0.0.1 only: the database is never exposed past the host.
# restart: always — the module must survive reboots (server "lives always").
services:
postgres:
image: pgvector/pgvector:pg16
container_name: navi-postgres
restart: always
environment:
POSTGRES_DB: navi
POSTGRES_USER: navi
POSTGRES_PASSWORD: ${NAVI_DB_PASSWORD:?NAVI_DB_PASSWORD must be set in .env}
ports:
- "127.0.0.1:5432:5432"
volumes:
- navi-pgdata:/var/lib/postgresql/data
healthcheck:
test: ["CMD-SHELL", "pg_isready -U navi -d navi"]
interval: 5s
timeout: 3s
retries: 12
volumes:
navi-pgdata: