---
id: setup_geo_stack_docker_pipeline_py_pipelines
name: setup_geo_stack_docker_pipeline
kind: pipeline
lang: py
domain: pipelines
version: "1.0.0"
purity: impure
signature: "def setup_geo_stack_docker_pipeline(compose_path: str, wait_seconds: int, verify: bool) -> dict"
description: "Levanta el geo stack Docker (Valhalla + PostGIS + Martin) via docker compose up -d y verifica que los tres servicios responden."
tags: [pipeline, geo, footprint, docker, valhalla, postgis, martin]
uses_functions: ["valhalla_route_py_geo", "docker_container_running_py_infra"]
uses_types: []
returns: []
returns_optional: false
error_type: "error_go_core"
imports: []
example: |
  result = setup_geo_stack_docker_pipeline(
      compose_path="apps/footprint_geo_stack/docker-compose.yml",
      wait_seconds=60,
      verify=True,
  )
  # {"docker_up": True, "valhalla_ok": True, "postgis_ok": True, "martin_ok": True}
tested: true
tests: ["test_setup_geo_stack_docker_pipeline_shape", "test_setup_geo_stack_docker_pipeline_live_stack"]
test_file_path: "python/functions/pipelines/tests/test_setup_geo_stack_docker_pipeline.py"
file_path: "python/functions/pipelines/setup_geo_stack_docker_pipeline.py"
params:
  - {name: compose_path, desc: "Ruta al docker-compose.yml del geo stack (Valhalla + PostGIS + Martin)."}
  - {name: wait_seconds, desc: "Segundos a esperar tras docker compose up -d antes de verificar servicios. Default 60."}
  - {name: verify, desc: "Si True, verifica los tres servicios via HTTP/docker exec. Default True."}
output: "Dict con docker_up, valhalla_ok, postgis_ok y martin_ok (bool cada uno)."
source_repo: "internal:footprint_aurgi"
source_license: "internal-aurgi"
source_file: "internal:composed"
---

## Ejemplo

```python
result = setup_geo_stack_docker_pipeline(
    compose_path="apps/footprint_geo_stack/docker-compose.yml",
    wait_seconds=60,
    verify=True,
)
print(result)
# {"docker_up": True, "valhalla_ok": True, "postgis_ok": True, "martin_ok": True}
```

## Notas

Verifica Valhalla via GET /status (puerto 8002), PostGIS via `docker_container_running` +
`docker exec better_maps_postgis pg_isready -U geoserver -d gis`, y Martin via GET /health
(puerto 3000) con fallback a `docker_container_running`.

Los nombres de contenedor (`better_maps_postgis`, `better_maps_martin`, `better_maps_valhalla`)
están hardcodeados para coincidir con `apps/footprint_geo_stack/docker-compose.yml`.

`verify=True` corre las comprobaciones aunque `docker compose up -d` falle (típico cuando los
contenedores ya están vivos pero el `.env` con `VALHALLA_DATA_DIR` no está disponible).
