Files
fn_registry/functions/pipelines/init_metabase.md
T
egutierrez 2e5bdacdcf feat: metabase_setup Python, fix list_databases, volumen Docker en init_metabase
Nueva función metabase_setup para setup inicial via API. Fix list_databases
que no extraía data del response wrapper. Pipeline init_metabase soporta
--mb-volumes para montar SQLite como volumen con fix de permisos automático.
Añadido .env a gitignore.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-28 23:23:20 +01:00

2.6 KiB

name, kind, lang, domain, version, purity, signature, description, tags, uses_functions, uses_types, returns, returns_optional, error_type, imports, tested, tests, test_file_path, file_path
name kind lang domain version purity signature description tags uses_functions uses_types returns returns_optional error_type imports tested tests test_file_path file_path
init_metabase pipeline go infra 1.0.0 impure func main() — Despliega stack Metabase + Postgres en Docker Pipeline que inicializa un contenedor Metabase con su base de datos Postgres. Crea red Docker, pull de imágenes, inicia Postgres con volume persistente, espera health check y lanza Metabase conectado.
docker
metabase
postgres
pipeline
infra
analytics
launcher
docker_create_network_go_infra
docker_pull_image_go_infra
docker_run_container_go_infra
docker_inspect_container_go_infra
retry_with_backoff_go_core
container_info_go_infra
network_go_docker
false error_go_core
os/exec
encoding/json
false
functions/pipelines/init_metabase/main.go

Ejemplo

# Básico
go run functions/pipelines/init_metabase/main.go \
  --project analytics \
  --metabase-port 3000 \
  --pg-user metabase \
  --pg-password metabase

# Con volume para registry.db (detecta cambios en vivo)
go run functions/pipelines/init_metabase/main.go \
  --project fn_registry \
  --mb-volumes "/home/lucas/fn_registry/registry.db:/data/registry.db"

Salida JSON:

{
  "network_id": "abc123...",
  "postgres_id": "def456...",
  "metabase_id": "ghi789...",
  "network_name": "analytics-net",
  "postgres_name": "analytics-postgres",
  "metabase_name": "analytics-metabase",
  "metabase_url": "http://localhost:3000"
}

Notas

El pipeline orquesta 5 pasos secuenciales:

  1. Red Docker — crea {project}-net con driver bridge
  2. Pull — descarga postgres:16 y metabase/metabase:latest
  3. Postgres — inicia con volume persistente (named volume por defecto o bind mount con --pg-volume)
  4. Health check — retry exponencial (hasta ~34 min) con pg_isready dentro del contenedor
  5. Metabase — conecta a Postgres via red interna, expone en puerto configurable. Con --mb-volumes monta volumes adicionales (ej: registry.db para SQLite)
  6. Permisos — ajusta ownership de directorios montados para el usuario metabase (UID 2000) dentro del contenedor

Reutiliza conceptualmente docker_create_network, docker_pull_image, docker_run_container, docker_inspect_container y retry_with_backoff, reimplementadas inline por ser un ejecutable independiente.

Para destruir el stack:

docker stop analytics-metabase analytics-postgres
docker rm analytics-metabase analytics-postgres
docker network rm analytics-net