Webhook Dispatcher — Migration Plan
Status: populated Owner: Platform Engineering Last updated: 2026-04-18 Companion: DATA_MODEL · DEPLOYMENT_TOPOLOGY
1. Initial Bootstrap Migration (Greenfield)
Flyway Migration Sequence
| Version | File | Description |
|---|---|---|
| V1 | V1__create_hook_schema.sql | Create hook schema |
| V2 | V2__create_webhook_configs.sql | hook.webhook_configs + indexes + max-10 trigger |
| V3 | V3__create_delivery_attempts.sql | hook.delivery_attempts + indexes |
| V4 | V4__add_delivery_status_check.sql | CHECK constraint on status enum values |
| V5 | V5__add_payload_snapshot_compression.sql | Enable TOAST compression on payload_snapshot |
| V6 | V6__grant_hook_svc.sql | GRANT statements for hook_svc service account |
2. Deployment Checklist (New Environment)
- PostgreSQL
hookschema created - Flyway V1–V6 applied successfully
-
hook_svcservice account created with correct grants - KMS key provisioned and IAM role attached to pod service account
- NATS stream
WEBHOOK_DISPATCHcreated with correct retention (24 h) - Durable consumer
webhook-dispatcherprovisioned - Kong service + routes configured
- JWT plugin configured with correct JWKS endpoint
- Kubernetes Secrets populated (DATABASE_URL, NATS TLS, KMS)
- ConfigMap applied
- Deployment scaled to 3 replicas + HPA applied
- Prometheus scrape target configured
- Grafana dashboard imported
- Alert rules applied and tested
3. Future Migration: Add Webhook Versioning
When REST API v2 is introduced:
- Add
api_versioncolumn tohook.webhook_configs(nullable, defaultv1). - No data migration required; existing configs remain
v1. - New v2 features gated on
api_version = 'v2'.
4. Future Migration: Add Webhook Signing Algorithm Field
Allow per-webhook choice of signing algorithm (currently hardcoded HMAC-SHA256):
- Add
signing_algorithm VARCHAR(16) NOT NULL DEFAULT 'HMAC-SHA256'. - Existing webhooks default to current behaviour.
- New algorithms added as application feature, not schema migration.
5. Rollback Procedure
- Scale
webhook-dispatcherto 0 replicas. - Restore previous image tag.
- If schema rollback needed: apply down-migration script.
- Scale to 3 replicas.
- Verify
/readyreturns 200; verifyhook_nats_consumer_status= 1. - Monitor retry poller for any stalled
FAILED_RETRYrows.