Identidad del proyecto
Parámetros globales compartidos por todos los recursos
| Parámetro | Valor |
|---|---|
| Proyecto GCP | andesmar-gcp |
| Región Cloud Run / Jobs / SQL / AR | southamerica-west1 (Santiago) |
| Región Cloud Scheduler | southamerica-east1 (São Paulo) — Scheduler no opera en west1 |
| Timezone schedulers | America/Argentina/Buenos_Aires (manifiestos sync: Mendoza en runbook) |
| Cloud SQL connection name | andesmar-gcp:southamerica-west1:andesmar-db-staging |
| Bases de datos | andesmar_sales — schemas public (OLTP), bi_rebuild (BI) y sap (liquidación SAP)andesmar_srt — base aislada para el SRT de liquidaciones |
| Bucket raw events | andesmar-staging-raw-events |
| Artifact Registry | cloud-run-source-deploy @ southamerica-west1 |
| Conectividad SQL | Socket Unix /cloudsql/... — sin VPC connector |
Diagrama de topología
Vista de infraestructura GCP — no es el flujo de datos de negocio
/cloudsql/andesmar-gcp:southamerica-west1:andesmar-db-staging, configurado con --add-cloudsql-instances en servicios y jobs.
Cloud Run Services
Servicios HTTP siempre activos en southamerica-west1
| Servicio | Estado | Rol | Imagen / deploy |
|---|---|---|---|
andesmar-api-staging |
Activo | API FastAPI: webhooks Betterez (POST /api/v1/webhooks/betterez), consultas sales/manifests, raw-first → GCS + Postgres |
cloud-run-source-deploy/andesmar-api-stagingDeploy auto vía Cloud Build en push a main |
andesmar-presentaciones |
Activo | nginx estático para handouts HTML de negocio. Protegido con IAP (login Google) | Build manual: docs/presentaciones/_deploy/deploy.sh |
andesmar-api-prod |
Planificado | Servicio prod — no desplegado a sep-2026 | — |
Cloud Run Jobs
21 jobs en southamerica-west1, disparados por Scheduler o manualmente
| Job | Imagen | Propósito | Runbook |
|---|---|---|---|
bi-rebuild-incremental |
bi-rebuild-incremental |
ETL SQL incremental del schema bi_rebuild (2×/día) |
scripts/sql/bi_rebuild/operativo/CLOUD_RUN_JOB_RUNBOOK.md |
| Job | Imagen | Propósito | Runbook |
|---|---|---|---|
andesmar-manifests-sync |
andesmar-api-staging (reutiliza imagen API) |
Sync programado manifiestos Betterez (outlook + detalle). Red de seguridad cada 30 min | scripts/manifests_sync/RUNBOOK_MANIFESTS_SYNC_JOB.md |
betterez-reconciliation-jobs| Job | Propósito | Runbook |
|---|---|---|
betterez-status-reconciliation | Reconciliación estados tickets vs API Betterez (c/6 h) | scripts/reconciliation/job/RUNBOOK_STATUS_RECONCILIATION.md |
betterez-transactions-safety-net | Transacciones API sin fila padre OLTP → reinyecta raw-first (D-3..D-1) | scripts/reconciliation/job/RUNBOOK_TRANSACTIONS_SAFETY_NET.md |
betterez-manifests-safety-net | Huérfanos manifiesto sin entries → manifest-leg API | scripts/reconciliation/job/RUNBOOK_MANIFESTS_SAFETY_NET.md |
betterez-undelivered-webhooks | Webhooks undelivered D-1 vs OLTP | scripts/reconciliation/job/RUNBOOK_UNDELIVERED_WEBHOOKS.md |
betterez-raw-events-relational-catchup | Drena backlog raw_events post-webhook async (c/15 min) | scripts/reconciliation/job/RUNBOOK_RAW_EVENTS_RELATIONAL_CATCHUP.md |
betterez-ticket-change-successor | Fase 3 successor tickets cambiados vía API (semanal) | scripts/reconciliation/job/RUNBOOK_TICKET_CHANGE_SUCCESSOR_JOB.md |
schedules-safety-net | Itinerarios/schedules faltantes desde Inventory API | scripts/schedules_sync/RUNBOOK_SCHEDULES_SAFETY_NET.md |
andesmar-agency-catalog-sync | Catálogo agencias → dim_agency | scripts/accounts_sync/RUNBOOK_AGENCY_CATALOG_SYNC.md |
andesmar-manifest-labels-sync | Tags manifiesto desde API detail | scripts/manifests_sync/RUNBOOK_JOBS_5_7_METADATA_SYNC.md |
andesmar-manifest-tag-catalog-sync | Catálogo tags → dim_manifest_tag | scripts/manifests_sync/RUNBOOK_MANIFEST_TAG_CATALOG_SYNC.md |
andesmar-route-catalog-sync | Catálogo rutas Inventory | scripts/inventory_sync/RUNBOOK_ROUTE_CATALOG_SYNC.md |
manifest-leg-guard | Guard drift manifest_legs OLTP vs fact_manifest_leg | scripts/manifest_legs_sync/RUNBOOK_MANIFEST_LEG_GUARD.md |
Lista canónica de los 12 jobs reconciliation: scripts/reconciliation/job/redeploy_reconciliation_jobs_image.sh
| Job | Imagen | Propósito | Runbook |
|---|---|---|---|
sap-liquidacion-pipeline | sap-liquidacion-pipeline | Pasos 1→3 de la liquidación de agencias (schema sap): liquida boletos e ítems y arma asientos. No envía | scripts/sap/RUNBOOK_LIQUIDACION_SAP.md |
sap-asientos-sender-qa | sap-liquidacion-pipeline | Paso 4: envío desatendido de asientos solo a SAP QA, corte SAP_ENVIO_DESDE | scripts/sap/job/RUNBOOK_LIQUIDACION_PIPELINE_JOB.md |
andesmar-srt-publish | betterez-reconciliation-jobs | Publica transacciones, pagos y boletos en la base aislada andesmar_srt (grano transacción) | scripts/srt_sync/RUNBOOK_SRT_PUBLISH.md |
andesmar-srt-publish-liquidaciones | betterez-reconciliation-jobs | Publica las vistas de liquidación para el SRT después del pipeline SAP | scripts/srt_sync/RUNBOOK_SRT_PUBLISH.md |
| Job | Imagen | Propósito | Runbook |
|---|---|---|---|
andesmar-aux-combustible-sync | betterez-reconciliation-jobs | Planilla de combustible → bi_rebuild.aux_combustible (reemplazo total, frescura por origen) | scripts/combustible_sync/RUNBOOK_AUX_COMBUSTIBLE_SYNC.md |
andesmar-raw-events-recompress | betterez-reconciliation-jobs | Recompresión gzip del histórico del bucket de raw events. Job de campaña, sin scheduler | scripts/ops/README_RAW_EVENTS_GZIP.md |
| Job | Imagen | Propósito |
|---|---|---|
andesmar-health-report |
andesmar-health-report |
Resumen diario salud API/BI/jobs por email (recomendado 08:00 ART, manual) |
Cloud Scheduler
22 triggers en southamerica-east1 — estado según runbooks (jun–sep 2026)
api_andesmar/docs/manifests_scheduler_alertas.md §8 (2026-06-13/14) y, para SAP, SRT y combustible, del runbook de cada job (sep-2026). Los schedulers SAP usan zona Etc/UTC; el resto, America/Argentina/Buenos_Aires.
| Scheduler | Job target | Cron | Frecuencia | Estado |
|---|---|---|---|---|
bi-rebuild-incremental-midnight | bi-rebuild-incremental | 0 0 * * * | 00:00 ART | ENABLED |
bi-rebuild-incremental-noon | bi-rebuild-incremental | 0 12 * * * | 12:00 ART | ENABLED |
andesmar-manifests-sync-trigger | andesmar-manifests-sync | 0,30 * * * * | Cada 30 min | ENABLED |
betterez-status-reconciliation-q6h | betterez-status-reconciliation | 0 */6 * * * | Cada 6 h | ENABLED |
betterez-transactions-safety-net-daily | betterez-transactions-safety-net | 30 6 * * * | 06:30 ART | ENABLED |
betterez-manifests-safety-net-daily | betterez-manifests-safety-net | 45 6 * * * | 06:45 ART | ENABLED |
betterez-undelivered-webhooks-daily | betterez-undelivered-webhooks | 0 10 * * * | 10:00 ART | ENABLED |
betterez-raw-events-catchup-15m | betterez-raw-events-relational-catchup | */15 * * * * | Cada 15 min | ENABLED |
betterez-ticket-change-successor-weekly | betterez-ticket-change-successor | 0 7 * * 1 | Lunes 07:00 ART | ENABLED |
schedules-safety-net-weekly | schedules-safety-net | 0 7 * * 0 | Dom 07:00 ART | ENABLED |
andesmar-agency-catalog-sync-monthly | andesmar-agency-catalog-sync | 0 9 1 * * | Día 1, 09:00 ART | ENABLED |
andesmar-manifest-labels-sync-weekly | andesmar-manifest-labels-sync | 0 8 * * 0 | Dom 08:00 ART | ENABLED |
andesmar-manifest-tag-catalog-monthly | andesmar-manifest-tag-catalog-sync | 30 8 1 * * | Día 1, 08:30 ART | ENABLED |
andesmar-route-catalog-monthly | andesmar-route-catalog-sync | 0 9 1 * * | Día 1, 09:00 ART | ENABLED |
manifest-leg-guard-weekly | manifest-leg-guard | 0 8 * * 0 | Dom 08:00 ART | ENABLED |
sap-liquidacion-pipeline-daily | sap-liquidacion-pipeline | 0 8 * * * | 05:00 ART (cron en UTC) | ENABLED |
sap-asientos-sender-qa-daily | sap-asientos-sender-qa | 0 9 * * * | 06:00 ART (cron en UTC) | ENABLED |
andesmar-srt-publish-daily | andesmar-srt-publish | 30 2 * * * | 02:30 ART | ENABLED |
andesmar-srt-publish-liquidaciones-daily | andesmar-srt-publish-liquidaciones | 30 5 * * * | 05:30 ART | ENABLED |
andesmar-aux-combustible-sync-daily | andesmar-aux-combustible-sync | 0 3 * * * | 03:00 ART | ENABLED |
andesmar-aux-combustible-sync-midday | andesmar-aux-combustible-sync | 45 11 * * * | 11:45 ART | ENABLED |
Busqueda_Manifiestos |
HTTP legacy → /manifests/sync |
0,30 * * * * |
Cada 30 min (obsoleto) | PAUSED |
Patrón: Scheduler OAuth SA (*-scheduler-sa) → POST al endpoint de ejecución del Cloud Run Job en west1.
Datos gestionados
Cloud SQL y Cloud Storage
Cloud SQL — andesmar-db-staging
- Connection name:
andesmar-gcp:southamerica-west1:andesmar-db-staging - Región:
southamerica-west1 - Bases:
andesmar_salesyandesmar_srt(aislada, lectura para el SRT) - Schemas de
andesmar_sales:public(OLTP: sales, tickets, manifest_entries, raw_events, …) ·bi_rebuild(BI activo para MicroStrategy, incluyeaux_combustible) ·sap(liquidaciones y asientos) - Schemas de
andesmar_srt:andesmar(publicado por el job, solo lectura para el SRT) ·srt(objetos propios del SRT) - Tier documentado:
db-custom-2-8192 - Roles DB planificados:
postgres(admin),andesmar_api,andesmar_etl
Cloud Storage — andesmar-staging-raw-events
- JSON raw-first de webhooks y reinyecciones (inmutable, auditable)
- Prefijos operativos:
safety-net-runs/,undelivered-runs/ - Bucket prod planificado:
andesmar-raw-events(no desplegado)
Seguridad e IAM
Secret Manager, service accounts y roles típicos
| Secret | Consumidor | Variable env |
|---|---|---|
bi-rebuild-database-url | Jobs BI, reconciliation, catálogos, health-report | DATABASE_URL |
andesmar-api-database-url | Servicio andesmar-api-staging | DATABASE_URL |
andesmar-api-auth-key | Servicio API staging | API_AUTH_KEY |
betterez-webhook-secret | API + jobs (vía ref) | BETTEREZ_WEBHOOK_SECRET |
betterez-api-key | Jobs reconciliation / catálogos | BETTEREZ_API_KEY |
betterez-login-user / betterez-login-password | Jobs (JWT refresh) | BETTEREZ_LOGIN_* |
DATABASE_URL (nombre literal) | Job andesmar-manifests-sync | DATABASE_URL |
health-report-smtp-*, health-report-mail-* | Job andesmar-health-report | SMTP / mail env vars |
sap-sentry-dsn | Jobs SAP | SENTRY_DSN |
sap-qa-token-client-id / sap-qa-token-client-secret | Job sap-asientos-sender-qa (OAuth SAP QA; no hay secretos de prod) | SAP_CLIENT_ID / SAP_CLIENT_SECRET |
srt-database-url | Jobs andesmar-srt-publish* | SRT_DATABASE_URL |
Cada job tiene un par de SAs dedicadas:
- Runtime SA (
{job}-job-sa): ejecuta el contenedor. Roles:roles/cloudsql.client,roles/secretmanager.secretAccessor,roles/storage.objectAdmin(donde aplica GCS) - Scheduler SA (
{job}-scheduler-sao abreviado): dispara el job. Rol:roles/run.developer
Ejemplos: bi-rebuild-job-sa, manifests-sync-job-sa, bz-tx-safety-net-job-sa, sap-liquidacion-job-sa, srt-publish-job-sa, aux-combustible-sync-job-sa.
El job de combustible además impersona una SA miembro de la unidad compartida donde vive la planilla (Sheets API, alcance de solo lectura).
API staging usa la SA default de Compute (*-compute@developer.gserviceaccount.com) con acceso a secrets vía IAM.
CI/CD e imágenes
Cloud Build, Artifact Registry y triggers
| Recurso | Detalle |
|---|---|
| Artifact Registry | southamerica-west1-docker.pkg.dev/andesmar-gcp/cloud-run-source-deploy/{imagen}:{tag} |
| Imágenes principales | andesmar-api-staging · betterez-reconciliation-jobs · bi-rebuild-incremental · andesmar-health-report · sap-liquidacion-pipeline |
| Cloud Build trigger API | ID 109502bd-78d2-489f-ab04-3e48e632b777 — config api_andesmar/cloudbuild.staging.yaml — push a main → deploy andesmar-api-staging |
| APIs habilitadas (patrón deploy) | artifactregistry, cloudbuild, run, cloudscheduler, secretmanager, sqladmin, storage |
Referencias en el repositorio
Runbooks y documentación canónica para profundizar
| Documento | Contenido |
|---|---|
api_andesmar/INFORME_ARQUITECTURA.md | Arquitectura general del sistema |
docs/integracion/ECOSISTEMA_BETTEREZ_CONSULTA_Y_ESCUCHA.md | Jobs, webhooks, API Betterez — inventario operativo |
api_andesmar/docs/manifests_scheduler_alertas.md | Estado schedulers + alertas manifiestos |
scripts/sql/bi_rebuild/operativo/CLOUD_RUN_JOB_RUNBOOK.md | Deploy e IAM del job BI |
scripts/monitoring/STAGING_API_CLOUD_RUN.md | Configuración servicio API staging |
scripts/RUNBOOK_INDEX.md | Índice de todos los runbooks operativos |
scripts/dev/lib/gcloud_deploy.sh | Helper compartido de deploy (proyecto, región, secrets) |
scripts/sap/RUNBOOK_LIQUIDACION_SAP.md | Liquidación SAP: pasos, alertas, envío, estado del paralelo |
scripts/srt_sync/RUNBOOK_SRT_PUBLISH.md | Publicación a andesmar_srt, roles y deploy |
scripts/combustible_sync/RUNBOOK_AUX_COMBUSTIBLE_SYNC.md | Sync de la planilla de combustible, frescura y alertas |
docs/presentaciones/andesmar-plataforma-datos-2026-06.html. Para las integraciones: Asientos contables SAP, SRT de liquidaciones y Planilla de combustible.