Provision Nominatim on ai-server-4080 (address geocoding beside OSRM) #16

Open
opened 2026-08-07 08:53:47 -07:00 by westfarn · 2 comments
Owner

Why

monica_site needs FOSS address geocoding / soft validation (contact form + portal mailing list → Contact.postal_address). OSRM on ai-server-4080 (10.0.0.128:5000) is routing-only — it cannot search/validate street addresses.

Nominatim is the usual OSM companion: same PBF source as OSRM, separate container + Postgres/PostGIS import. Provision it beside OSRM the same way we did SearxNG (#10) and the homelab OSRM pattern (Ditch_The_Agent/OSRM).

Repo (app-owned, like OSRM)

Create a small ops repo mirroring Ditch_The_Agent/OSRM:

  • docker-compose.yml — Nominatim API container (e.g. mediagis/nominatim)
  • scripts/import.sh (or similar) — one-shot PBF → Nominatim DB
  • README.md — sizing, LAN URL, UFW, smoke curl
  • .env.example — bind host, host port, PBF/dataset name
  • Do not reuse OSRM .osrm* graph files — only share the original .osm.pbf

Suggested location: ai_ml_operations/Nominatim (shared LAN service for monica_site + others) or Ditch_The_Agent/Nominatim to match OSRM ownership. Either works if compose + import live in git.

Port note

Do not use host port 8080 or 8088.

On ai-server-4080 today:

Port Service
5000 OSRM
8080 dta_webapp prod
8088 SearxNG
8082/8083 chat_web_app

Use 8089 for Nominatim (container 8080 → host 8089), unless inventory shows a better free port.

Consumers:

NOMINATIM_BASE_URL=http://10.0.0.128:8089

Data / sizing

  • Reuse the same Geofabrik PBF already used for OSRM preprocess (US extract on that host).
  • Nominatim builds its own Postgres DB — expect much more disk/RAM than OSRM graphs for full US.
  • If full-US import is too heavy, prefer a Midwest / Ohio (+ neighbors) extract for geocoding; OSRM can keep a larger routing extract if needed.
  • Document import time, disk, and RAM in the Nominatim README before running on 4080.

Proposed server-infra work

Mirror the searxng role pattern (#10):

  1. Add roles/nominatim/ (or deploy from cloned Nominatim repo under {{ apps_base_dir }}/nominatim) with:
    • defaults — image, dir, host port 8089, LAN CIDR, PBF path / dataset name
    • docker-compose template (or clone + compose from the Nominatim git repo)
    • tasks — dirs, env, UFW allow 8089/tcp from 10.0.0.0/24, docker compose up -d
  2. Gate with nominatim_stack: true in inventory/host_vars/ai-server-4080.yml.
  3. Wire into playbooks/site.yml under the ai-server-4080 play.
  4. Document in IMPLEMENTATION.md / scripts/provision.sh help text.
  5. Note consumer env: NOMINATIM_BASE_URL=http://10.0.0.128:8089 (monica_site later; optional DTA if needed).

Import may be manual first run (long-running) with Ansible only ensuring the stack + UFW + restart policy — same spirit as OSRM preprocess being a one-shot script.

Acceptance criteria

  • Nominatim ops repo exists (compose + import script + README), parallel to OSRM.
  • ./scripts/provision.sh ai-server-4080 (or targeted role) brings up Nominatim on 10.0.0.128:8089 (or documented port).
  • UFW allows 10.0.0.0/24 → Nominatim port only (not world-open).
  • From adama/roslin/ai-server-4080: curl -sG 'http://10.0.0.128:8089/search' --data-urlencode 'q=Akron, OH' -d 'format=json' -d 'limit=1' returns JSON with lat/lon.
  • Structured query smoke: /search?street=...&city=...&state=Ohio&postalcode=...&format=json works for a known Ohio address.
  • Host port does not clash with OSRM :5000, dta :8080, SearxNG :8088, chat :8082/:8083.
  • Docs state: share PBF only with OSRM; never mount .osrm* into Nominatim.
  • Role is no-op on adama/roslin unless explicitly enabled.

Related

  • Ditch_The_Agent/OSRM — routing sibling on same host
  • server-infra#10 — SearxNG on ai-server-4080 (same provision pattern)
  • monica_site — contact / mailing-list postal_address (geocode soft-check next)
## Why `monica_site` needs **FOSS address geocoding / soft validation** (contact form + portal mailing list → `Contact.postal_address`). OSRM on **ai-server-4080** (`10.0.0.128:5000`) is routing-only — it cannot search/validate street addresses. Nominatim is the usual OSM companion: same PBF **source** as OSRM, separate container + Postgres/PostGIS import. Provision it beside OSRM the same way we did SearxNG (#10) and the homelab OSRM pattern (`Ditch_The_Agent/OSRM`). ## Repo (app-owned, like OSRM) Create a small ops repo mirroring [Ditch_The_Agent/OSRM](https://git.aimloperations.com/Ditch_The_Agent/OSRM): - `docker-compose.yml` — Nominatim API container (e.g. `mediagis/nominatim`) - `scripts/import.sh` (or similar) — one-shot PBF → Nominatim DB - `README.md` — sizing, LAN URL, UFW, smoke `curl` - `.env.example` — bind host, host port, PBF/dataset name - **Do not** reuse OSRM `.osrm*` graph files — only share the original `.osm.pbf` Suggested location: `ai_ml_operations/Nominatim` (shared LAN service for monica_site + others) **or** `Ditch_The_Agent/Nominatim` to match OSRM ownership. Either works if compose + import live in git. ## Port note **Do not use host port 8080 or 8088.** On ai-server-4080 today: | Port | Service | |------|---------| | 5000 | OSRM | | 8080 | dta_webapp prod | | 8088 | SearxNG | | 8082/8083 | chat_web_app | Use **8089** for Nominatim (container 8080 → host 8089), unless inventory shows a better free port. Consumers: ```text NOMINATIM_BASE_URL=http://10.0.0.128:8089 ``` ## Data / sizing - Reuse the **same Geofabrik PBF** already used for OSRM preprocess (US extract on that host). - Nominatim builds its **own** Postgres DB — expect **much** more disk/RAM than OSRM graphs for full US. - If full-US import is too heavy, prefer a Midwest / Ohio (+ neighbors) extract for geocoding; OSRM can keep a larger routing extract if needed. - Document import time, disk, and RAM in the Nominatim README before running on 4080. ## Proposed server-infra work Mirror the `searxng` role pattern (#10): 1. Add `roles/nominatim/` (or deploy from cloned Nominatim repo under `{{ apps_base_dir }}/nominatim`) with: - defaults — image, dir, host port `8089`, LAN CIDR, PBF path / dataset name - docker-compose template (or clone + compose from the Nominatim git repo) - tasks — dirs, env, UFW allow `8089/tcp` from `10.0.0.0/24`, `docker compose up -d` 2. Gate with `nominatim_stack: true` in `inventory/host_vars/ai-server-4080.yml`. 3. Wire into `playbooks/site.yml` under the ai-server-4080 play. 4. Document in `IMPLEMENTATION.md` / `scripts/provision.sh` help text. 5. Note consumer env: `NOMINATIM_BASE_URL=http://10.0.0.128:8089` (monica_site later; optional DTA if needed). Import may be **manual first run** (long-running) with Ansible only ensuring the stack + UFW + restart policy — same spirit as OSRM preprocess being a one-shot script. ## Acceptance criteria - [ ] Nominatim ops repo exists (compose + import script + README), parallel to OSRM. - [ ] `./scripts/provision.sh ai-server-4080` (or targeted role) brings up Nominatim on `10.0.0.128:8089` (or documented port). - [ ] UFW allows `10.0.0.0/24` → Nominatim port only (not world-open). - [ ] From adama/roslin/ai-server-4080: `curl -sG 'http://10.0.0.128:8089/search' --data-urlencode 'q=Akron, OH' -d 'format=json' -d 'limit=1'` returns JSON with lat/lon. - [ ] Structured query smoke: `/search?street=...&city=...&state=Ohio&postalcode=...&format=json` works for a known Ohio address. - [ ] Host port does **not** clash with OSRM `:5000`, dta `:8080`, SearxNG `:8088`, chat `:8082/:8083`. - [ ] Docs state: share **PBF only** with OSRM; never mount `.osrm*` into Nominatim. - [ ] Role is no-op on adama/roslin unless explicitly enabled. ## Related - [Ditch_The_Agent/OSRM](https://git.aimloperations.com/Ditch_The_Agent/OSRM) — routing sibling on same host - server-infra#10 — SearxNG on ai-server-4080 (same provision pattern) - monica_site — contact / mailing-list `postal_address` (geocode soft-check next)
Author
Owner

Nominatim ops repo created: https://git.aimloperations.com/ai_ml_operations/Nominatim (scaffold next — compose + import script mirroring OSRM).

Nominatim ops repo created: https://git.aimloperations.com/ai_ml_operations/Nominatim (scaffold next — compose + import script mirroring OSRM).
Author
Owner

Scaffold landed on main:

Ready to clone on ai-server-4080 and wire Ansible in this issue.

Scaffold landed on main: - https://git.aimloperations.com/ai_ml_operations/Nominatim - `docker-compose.yml` (`mediagis/nominatim:5.1`, host **8089**) - `scripts/prepare-pbf.sh` (copy/symlink PBF from OSRM data) - README / `.env.example` / `.gitignore` Ready to clone on ai-server-4080 and wire Ansible in this issue.
Sign in to join this conversation.
No labels
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: ai_ml_operations/server-infra#16