From 96101b9b3ec141123fd9b39a197613d8ae035b1d Mon Sep 17 00:00:00 2001 From: Egutierrez Date: Mon, 4 May 2026 23:43:59 +0200 Subject: [PATCH] =?UTF-8?q?chore:=20initial=20sync=20=E2=80=94=20Docker=20?= =?UTF-8?q?geo=20stack=20(PostGIS=20+=20Martin=20+=20Valhalla)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-Authored-By: Claude Opus 4.7 (1M context) --- .gitignore | 13 +++++++++ app.md | 63 +++++++++++++++++++++++++++++++++++++++ docker-compose.yml | 73 ++++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 149 insertions(+) create mode 100644 .gitignore create mode 100644 app.md create mode 100644 docker-compose.yml diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..7721b24 --- /dev/null +++ b/.gitignore @@ -0,0 +1,13 @@ +.venv/ +node_modules/ +__pycache__/ +*.pyc +operations.db* +.env +.env.* + +# Datos generados por el stack (tiles, cache PG) +data/ +postgres-data/ +valhalla-data/ +martin-cache/ diff --git a/app.md b/app.md new file mode 100644 index 0000000..12f0817 --- /dev/null +++ b/app.md @@ -0,0 +1,63 @@ +--- +name: footprint_geo_stack +lang: bash +domain: infra +description: "Stack Docker para footprint geo: PostGIS 16-3.4 + Martin tile server + Valhalla. Datos de tiles montados desde DataProyects." +tags: [docker, service, geo, valhalla, postgis] +uses_functions: [] +uses_types: [] +entry_point: "docker-compose.yml" +dir_path: "apps/footprint_geo_stack" +--- + +# footprint_geo_stack + +Stack Docker para servicios geo del proyecto footprint_aurgi: + +- **PostGIS 16-3.4** — base de datos espacial en :5432 +- **Martin** — tile server MVT en :3000 +- **Valhalla** — routing engine en :8002 + +## Levantar + +```bash +cd apps/footprint_geo_stack +docker compose up -d +``` + +## Parar + +```bash +docker compose down +``` + +## Puertos expuestos + +| Servicio | Puerto | Descripcion | +|----------|--------|-------------| +| PostGIS | 5432 | postgres://geoserver:geoserver@localhost:5432/gis | +| Martin | 3000 | http://localhost:3000 (webUI habilitado) | +| Valhalla | 8002 | http://localhost:8002 (route, isochrone, matrix) | + +## Datos + +Los tiles de Valhalla se montan desde: +`/home/lucas/DataProyects/footprint_aurgi/better_maps/data` → `/custom_files` + +Contiene `valhalla_tiles.tar`, `admin_data`, `timezone_data` y la PBF de Espana. +NO se rebuilden los tiles (`force_rebuild: False`). + +## Health checks + +```bash +# PostGIS +docker exec better_maps_postgis pg_isready -U geoserver -d gis + +# Martin +curl -sf http://localhost:3000/health + +# Valhalla +curl -s -X POST http://localhost:8002/route \ + -H 'Content-Type: application/json' \ + -d '{"locations":[{"lat":40.4168,"lon":-3.7038},{"lat":41.3874,"lon":2.1686}],"costing":"auto"}' +``` diff --git a/docker-compose.yml b/docker-compose.yml new file mode 100644 index 0000000..0b6b49e --- /dev/null +++ b/docker-compose.yml @@ -0,0 +1,73 @@ +services: + postgis: + image: postgis/postgis:16-3.4 + container_name: better_maps_postgis + restart: always + environment: + POSTGRES_USER: geoserver + POSTGRES_PASSWORD: geoserver + POSTGRES_DB: gis + ports: + - "5432:5432" + healthcheck: + test: ["CMD-SHELL", "pg_isready -U geoserver -d gis"] + interval: 10s + timeout: 5s + retries: 5 + volumes: + - postgis-data:/var/lib/postgresql/data + networks: + - geonet + + martin: + image: ghcr.io/maplibre/martin:latest + container_name: better_maps_martin + restart: always + depends_on: + postgis: + condition: service_healthy + environment: + DATABASE_URL: postgres://geoserver:geoserver@postgis:5432/gis + command: + - "--webui" + - "enable-for-all" + ports: + - "3000:3000" + healthcheck: + test: ["CMD", "wget", "-q", "--spider", "http://127.0.0.1:3000/health"] + interval: 10s + timeout: 5s + retries: 3 + networks: + - geonet + + valhalla: + image: ghcr.io/nilsnolde/docker-valhalla/valhalla:latest + container_name: better_maps_valhalla + restart: always + depends_on: + postgis: + condition: service_healthy + environment: + tile_urls: "" + build_admins: "True" + build_time_zones: "True" + force_rebuild: "False" + serve_tiles: "True" + server_threads: "16" + volumes: + - /home/lucas/DataProyects/footprint_aurgi/better_maps/data:/custom_files + ports: + - "8002:8002" + networks: + - geonet + cpus: 20 + + + +volumes: + postgis-data: + +networks: + geonet: + driver: bridge