trips/spatial/docker-compose.yml
Greg Pomerantz c367eba5cb Live web enrichment (SearXNG) + PostGIS spatial stack
Milestone 1 — live web search:
- mock/server.js: /search + /search-status proxy to the self-hosted
  SearXNG (third leg of the 3-source blend; engine endpoint stays
  server-side), /spatial + /spatial-status proxy to the spatial service
- mock/app.js: background enrichment of suggestion cards — each
  candidate gets a web element (discovery cards + "you might like"
  rows) that is checked via SearXNG in the background (one in-flight
  query per place, 1 h TTL, failures retry in ~5 min) and APPENDS
  sourced facts with provenance URLs; never reorders/rewrites the plan.
  New LLM tools: web_search (cite URLs) and poi_near (PostGIS). Status
  badge gains 'web' / 'spatial'.
- styles.css: .cc-web live-facts blocks, t-web verified chip

Milestone 2 — PostGIS spatial DB (code complete; needs docker access
to run — see spatial/README.md):
- spatial/: docker-compose (postgis/postgis:16-3.4 + osm2pgsql:16
  one-shot importer + spatiald), schema.sql (poi table w/ GIST index,
  spatial_extract bookkeeping, refresh_poi()), import.sh for the PBF
  extracts in ../osm, spatiald (Go, lib/pq): /health, /near
  (ST_DWithin), /nearest (KNN), /corridor (ST_Buffer along a route),
  with kind/name/extract/limit filters
2026-09-10 09:43:30 -04:00

61 lines
2.0 KiB
YAML

# PostGIS spatial stack for the trip planner.
#
# docker compose up -d postgis # start the DB (schema.sql runs on first boot)
# ./import.sh ../osm/nh.osm.pbf # import an OSM extract (one-shot osm2pgsql)
# docker compose run --rm spatiald # start the query service on :5005
#
# The PBF extracts live in ../osm (gitignored). osm2pgsql runs as a one-shot
# container so the host needs no osm2pgsql/osmium installation.
services:
postgis:
image: postgis/postgis:16-3.4
container_name: trips-postgis
environment:
POSTGRES_DB: trips
POSTGRES_USER: trips
POSTGRES_PASSWORD: trips
ports:
- "5432:5432"
volumes:
- pgdata:/var/lib/postgresql/data
# initdb scripts run in lexicographic order, once, on an empty volume
- ./schema.sql:/docker-entrypoint-initdb.d/10-schema.sql:ro
healthcheck:
test: ["CMD-SHELL", "pg_isready -U trips -d trips"]
interval: 5s
timeout: 3s
retries: 12
# One-shot importer. `docker compose run --rm importer` (or import.sh)
# loads the PBF named in PBF_FILE into the DB. The osm2pgsql image runs
# as uid 1001 and needs the PBF readable — import.sh bind-mounts ../osm.
importer:
image: osm2pgsql/osm2pgsql:16
user: "1001:1001"
network_mode: "service:postgis"
environment:
PBF_FILE: /data/nh.osm.pbf
# --create --clean: fresh load every time (extracts are small enough);
# slim mode keeps the RAM footprint sane; disable-operations saves time.
ARGS: >-
--host=postgis --port=5432 --database=trips --user=trips
--password=trips --create --clean --slim
--flat-nodes=/tmp/flat.nodes --disable-operations
--import-strips=10
volumes:
- ../osm:/data:ro
spatiald:
build: .
container_name: trips-spatiald
environment:
SPATIAL_DSN: "host=postgis port=5432 user=trips password=trips dbname=trips sslmode=disable"
ports:
- "5005:5005"
depends_on:
postgis:
condition: service_healthy
volumes:
pgdata: