Free, Open Source, Self-Hosted WhatsApp API Gateway
TypeScript apibotgatewayself-hostedwhatsappwhatsapp-apiwhatsapp-automationwhatsapp-botwhatsapp-gatewaywhatsapp-gateway-apiwhatsapp-webwhatsapp-web-api
docs(migration): state the first-boot cost of the type backfill
Yudhi Armyndharis334a61870bc0
diff --git a/charts/openwa/README.md b/charts/openwa/README.mdindex 17815ef3e..6317a93da 100644--- a/charts/openwa/README.md+++ b/charts/openwa/README.md@@ -38,8 +38,9 @@ Service targetPort are pinned to it) — service.port changes the Service port.The kubelet startup probe allows `startupProbe.periodSeconds` x (`startupProbe.failureThreshold` - 1)seconds for a boot, 295 by default. The first boot after an upgrade can build indexes on a large-`messages` table before the port opens: raise `startupProbe.failureThreshold`, or run the migrations-first ([docs/14-migration-guide.md](../../docs/14-migration-guide.md), section 14.5).+`messages` table and convert its legacy message types before the port opens: raise+`startupProbe.failureThreshold`, or run the migrations first+([docs/14-migration-guide.md](../../docs/14-migration-guide.md), section 14.5).Upgrade with `helm upgrade openwa ./charts/openwa --reset-then-reuse-values` (Helm 3.14 or later), or with`-f values.yaml`. Plain `--reuse-values` renders the new templates with the old release's defaults, whichdiff --git a/charts/openwa/values.yaml b/charts/openwa/values.yamlindex a38e5622d..c05f2789b 100644--- a/charts/openwa/values.yaml+++ b/charts/openwa/values.yaml@@ -88,8 +88,9 @@ terminationGracePeriodSeconds: 75# Boot budget of the kubelet startupProbe on /api/health/live: the container is restarted after# periodSeconds x (failureThreshold - 1) = 5s x 59 = 295s without an answer. The first boot after an-# upgrade builds indexes on a large messages table (about 3.8s per million rows) before the port-# opens, so raise failureThreshold, or run the migrations first (docs/14, section 14.5). A higher+# upgrade builds indexes on a large messages table (about 3.8s per million rows) and converts legacy+# message types in the same transaction (about 60s per million legacy rows on PostgreSQL) before the+# port opens, so raise failureThreshold, or run the migrations first (docs/14, section 14.5). A higher# value only delays the restart of a boot that is genuinely stuck.startupProbe:periodSeconds: 5diff --git a/docs/14-migration-guide.md b/docs/14-migration-guide.mdindex 51e89bc66..35c10a6ad 100644--- a/docs/14-migration-guide.md+++ b/docs/14-migration-guide.md@@ -887,6 +887,7 @@ skips: check `pg_index.indisvalid` and drop the invalid index before building it| Release | Change | Action || -------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |+| `next` | The first boot rewrites every legacy `messages.type` value in one `UPDATE`, inside the transaction of the other pending migrations: on PostgreSQL about a minute per million legacy rows, with the port closed. Only a database whose conversion kept being cancelled on `0.25.0` still holds a large backlog | Count them with `SELECT count(*) FROM messages WHERE type IN ('chat', 'buttons_response', 'list_response', 'template_button_reply', 'ptt', 'vcard', 'multi_vcard')`; above a few million, run the migrations first (section 14.5), or raise `startupProbe.failureThreshold` to cover about a minute per million legacy rows (measured with twelve indexes on the table) on top of the index builds || `0.25.0` | Once teardown begins (SIGTERM, SIGINT, `POST /api/infra/restart`) every request except `/api/health`, `/api/health/*`, the dashboard's HTML pages and CORS preflights answers `503` with `Connection: close`, `GET /api/infra/health` included | Probe `/api/health/live` for liveness that survives teardown, and retry a `503` once the instance is up again || `0.25.0` | `stop_grace_period` (Docker) and `terminationGracePeriodSeconds` (Kubernetes) go from 45 to 75 s, and a stop that runs 67 s past the shutdown delay exits with status 1 instead of 137 | Raise a pinned 45 s value to at least 75 s, plus the excess of `SHUTDOWN_DELAY_MS` over 3 s and of `WEBHOOK_SHUTDOWN_DRAIN_MS` over 5 s; on Helm upgrade with `--reset-then-reuse-values` (3.14 or later) or `-f values.yaml`, since plain `--reuse-values` keeps the 0.24.0 defaults; a container that drops all capabilities and starts as root must add `KILL` to the capabilities 0.24.0 shipped, or a stop never reaches the app; update exit-code alerts || `0.25.0` | `400` instead of `201` or `200` for a phone number WhatsApp reports as unregistered (Baileys; `503` when the lookup gets no answer) and for `vote-poll` with no matching option text (whatsapp-web.js) | Handle `400` (`POLL_OPTION_NOT_FOUND` carries `validOptions`) and `503` on these routes; an empty `options` list still clears a vote |