Free, Open Source, Self-Hosted WhatsApp API Gateway
TypeScript apibotgatewayself-hostedwhatsappwhatsapp-apiwhatsapp-automationwhatsapp-botwhatsapp-gatewaywhatsapp-gateway-apiwhatsapp-webwhatsapp-web-api
feat(chart): make the startup probe budget a value
Yudhi Armyndharis57208fee82f4
diff --git a/CHANGELOG.md b/CHANGELOG.mdindex b10927e70..b75c0ba2d 100644--- a/CHANGELOG.md+++ b/CHANGELOG.md@@ -17,6 +17,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0- Expose poll choices and selection mode in message events, stored messages and history, and poll choices in dashboard chats; the SDKs type the poll of a live history message from the next SDK release after 0.5.1.- Expose optional last-message types in chat lists and, from the next SDK release after 0.5.1, in the SDKs.- Add bounded webhook failure redrive with optional payload retention; the SDKs expose it from the next SDK release after 0.5.1.+- Add `startupProbe.periodSeconds` and `startupProbe.failureThreshold` to the Helm chart's values, defaulting to the 5 s and 60 the chart rendered before, so a large messages table can be given a longer boot budget.- Expose caller-supplied send idempotency keys in all five SDKs from the next SDK release after 0.5.1; the 0.5.1 JavaScript and PHP packages ignore the extra argument.- Add optional 24-hour idempotency keys to twelve single-recipient send routes.- Add opt-in archive-only chat media with dashboard previews.@@ -193,7 +194,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0- On SQLite, `GET /api/search` leaves `score` out of the hits of a key restricted to sessions or chats, because it is computed over the whole index; the hits stay in relevance order.- Without an ffmpeg binary (`FFMPEG_PATH`), a Baileys voice note goes out with flat waveform bars instead of its real ones; the official image ships ffmpeg.- With `DATABASE_SSL=true`, the PostgreSQL certificate is now verified against `DATABASE_HOST` even when it is an IP address (`pg` 8.23.1). A certificate that names only `localhost` stops matching a connection by IP: use the certificate's DNS name as the host or add the IP to its subject alternative names. `DATABASE_SSL_REJECT_UNAUTHORIZED=false` remains the escape hatch.-- The first boot builds three indexes on `messages` (`IDX_messages_session_timestamp_id`, `IDX_messages_session_chat_timestamp_id` and `IDX_messages_session_direction_timestamp_id`) not concurrently, and the table with its indexes grows by about 240 MB per million messages. On PostgreSQL writes to that table wait until the boot migrations commit, after all three builds, and the Helm chart's startup probe (about 295 s) restarts a pod whose boot outlasts it, so on a large table run the migrations first (migration guide, section 14.5).+- The first boot builds three indexes on `messages` (`IDX_messages_session_timestamp_id`, `IDX_messages_session_chat_timestamp_id` and `IDX_messages_session_direction_timestamp_id`) not concurrently, and the table with its indexes grows by about 240 MB per million messages. On PostgreSQL writes to that table wait until the boot migrations commit, after all three builds, and the Helm chart's startup probe (about 295 s) restarts a pod whose boot outlasts it, so on a large table run the migrations first (migration guide, section 14.5) or raise `startupProbe.failureThreshold`.- ⚠️ **Breaking (API).** Baileys answers `400` for an animated image of more than 500 frames that it has to convert to WebP; an animated WebP is sent unchanged.- ⚠️ **Breaking (API).** Baileys answers `400` for an `image/svg+xml` sticker, profile picture or group picture, which 0.24.0 accepted; convert it to PNG or WebP before sending.- New Baileys pairings show `Ubuntu` instead of `OpenWA` as the device name in Linked Devices; set `BAILEYS_BROWSER_NAME=OpenWA` to keep the old name. Linked sessions are unaffected.diff --git a/charts/openwa/README.md b/charts/openwa/README.mdindex 74bcda5d5..766b7855d 100644--- a/charts/openwa/README.md+++ b/charts/openwa/README.md@@ -36,6 +36,11 @@ Or bring your own Secret: `--set existingSecret=my-openwa-secret`.The container port is fixed at 2785; do not set PORT in env (probes and theService 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).+All other values (`persistence`, `resources`, `ingress`, `serviceMonitor`, …) aredocumented inline in [values.yaml](values.yaml). The chart does NOT bundlePostgreSQL/Redis/MinIO — point `env` at your own, or stay on the SQLite default.diff --git a/charts/openwa/templates/statefulset.yaml b/charts/openwa/templates/statefulset.yamlindex 5e8b33035..44949ab9a 100644--- a/charts/openwa/templates/statefulset.yaml+++ b/charts/openwa/templates/statefulset.yaml@@ -71,6 +71,9 @@ spec:# immediately, so a fast boot is recognised in ~5s instead of waiting out a fixed delay.# The pod therefore becomes live SOONER than it does today, not later.#+ # periodSeconds and failureThreshold come from the startupProbe values (5 and 60 by default); an+ # operator whose first boot after an upgrade builds indexes on a large table raises the threshold.+ ## Kubernetes suspends the liveness and readiness probes until a startupProbe succeeds, so# the values below keep their meaning for steady state and stop governing boot. (That# suspension is documented kubelet behaviour, not something this chart's tests observe —@@ -84,9 +87,9 @@ spec:httpGet:path: /api/health/liveport: http- periodSeconds: 5+ periodSeconds: {{ .Values.startupProbe.periodSeconds }}timeoutSeconds: 5- failureThreshold: 60+ failureThreshold: {{ .Values.startupProbe.failureThreshold }}livenessProbe:httpGet:path: /api/health/livediff --git a/charts/openwa/values.yaml b/charts/openwa/values.yamlindex 973ed870e..a38e5622d 100644--- a/charts/openwa/values.yaml+++ b/charts/openwa/values.yaml@@ -86,6 +86,15 @@ resources:# this by the same amount too.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+# value only delays the restart of a boot that is genuinely stuck.+startupProbe:+ periodSeconds: 5+ failureThreshold: 60+# Pod-level securityContext, empty by default. The default image start is as# root: the entrypoint re-owns /app/data and the XDG dirs, then drops to the# openwa user (uid/gid 997) via gosu, which needs the capabilities added below.diff --git a/docs/14-migration-guide.md b/docs/14-migration-guide.mdindex 101cc93af..07b870a67 100644--- a/docs/14-migration-guide.md+++ b/docs/14-migration-guide.md@@ -874,7 +874,8 @@ docker compose run --rm openwa-api npm run migration:run:prodOn PostgreSQL the boot migrations run in one transaction, so an index build on a large table holds backwrites to that table until the whole chain commits. On the Helm chart a boot that outlasts the startup-probe (about 295 s) is killed, which rolls the build back and starts it again from nothing. Run the+probe (about 295 s by default; `startupProbe.failureThreshold` in the chart's values raises it) is killed,+which rolls the build back and starts it again from nothing. Run thecommand above first, in a one-off container of the new image on the same database (a Kubernetes `Job` onHelm); the pods then find nothing to build. To avoid the write lock as well, build the index beforehandwith `CREATE INDEX CONCURRENTLY IF NOT EXISTS` under the same name and columns, and the migration skips@@ -894,7 +895,7 @@ skips: check `pg_index.indisvalid` and drop the invalid index before building it| `0.25.0` | New Baileys pairings show `Ubuntu` as the linked-device name | Set `BAILEYS_BROWSER_NAME=OpenWA` to keep the old name; linked sessions are unaffected || `0.25.0` | `backup.sh` and `restore.sh` exit with status 2 on an unparsable or unreadable `./.env` or `.env.generated`, read the default SQLite paths under `OPENWA_DATA_DIR`, and with `DATABASE_SSL=true` verify the PostgreSQL certificate as the app does | Fix the line or the permissions, or pass the key in the environment; trust a private CA through `NODE_EXTRA_CA_CERTS` or `PGSSLROOTCERT` || `0.25.0` | With `DATABASE_SSL=true` the PostgreSQL certificate is verified against `DATABASE_HOST` even when it is an IP address | Use the certificate's DNS name as the host or add the IP to its subject alternative names; `DATABASE_SSL_REJECT_UNAUTHORIZED=false` remains the escape hatch |-| `0.25.0` | The first boot builds three indexes on `messages` without `CONCURRENTLY` (about 240 MB per million messages; on PostgreSQL writes wait), and the Helm startup probe restarts a pod whose boot outlasts about 295 s | On a large table run the migrations first (section 14.5) |+| `0.25.0` | The first boot builds three indexes on `messages` without `CONCURRENTLY` (about 240 MB per million messages; on PostgreSQL writes wait), and the Helm startup probe restarts a pod whose boot outlasts about 295 s | On a large table run the migrations first (section 14.5), or raise `startupProbe.failureThreshold` || `0.25.0` | Rolling back to 0.24.0 strands webhook outbox rows in state `queued`, and the upgrade deletes duplicate terminal `webhook_delivery_failures` rows | Drain or accept the queued rows before a rollback; the deleted duplicates are not restored || `0.25.0` | A Baileys voice note goes out with flat waveform bars when no ffmpeg binary is found, and an `FFMPEG_PATH` wrapper script sees only `PATH`, the library paths, `HOME`, the temp directories, `LANG`, `LC_ALL` and `SystemRoot` of the gateway's environment | Use the official image, which ships ffmpeg, and export what a wrapper script needs inside the script || `0.24.0` | A live key refused by its `allowedIps` (including an undeterminable client IP) or its `allowedSessions` answers `403` instead of `401`; `401` now means only a missing, unknown, revoked or expired key | Handle `403` for these refusals: SDK callers catch the forbidden error (Go `ErrForbidden`) instead of the auth error |