Skip to content

Upgrade Caracal

Caracal upgrades are forward-only at the database layer. Every release ships expand-only schema changes: new migrations are backward compatible with the previous application version, so the database can be migrated while the old version is still serving. This removes the maintenance window — the schema moves first, then services roll onto it.

Contract-phase changes (dropping, renaming, retyping, or tightening a column to NOT NULL) are split into a later release and must be tagged -- caracal:phase contract. CI (validateMigrations.sh) rejects untagged contract changes so the no-window guarantee cannot silently regress.

For the Compose-based runtime, caracal upgrade performs the full expand-then-roll sequence in order:

Terminal window
caracal upgrade

It stages the new images (pull, or build in dev), applies the expand-phase migrations against the running database, then rolls the services and waits for readiness. If the migration step fails it aborts before touching services, leaving the previous version running. Pass --no-pull to roll already-staged images without fetching.

  1. Read release notes and changed chart values.
  2. Render the new Helm/Compose configuration.
  3. Confirm secrets and required env vars still match service config.
  4. Back up Postgres and runtime secrets.
  5. Confirm Redis streams/groups and audit health.
  6. Prepare canary token exchange and Gateway request.
Terminal window
helm -n caracal diff upgrade caracal infra/helm/caracal -f values.production.yaml
helm -n caracal upgrade caracal infra/helm/caracal -f values.production.yaml
kubectl -n caracal get jobs
kubectl -n caracal rollout status deploy/caracal-api

The migration Job runs as a pre-install/pre-upgrade hook when migrations are enabled.

caracal upgrade automates this. To run it by hand:

Terminal window
export CARACAL_VERSION=<new-version>
docker compose -f infra/docker/runtime-compose.yml pull
docker compose -f infra/docker/runtime-compose.yml run --rm dbMigrate
docker compose -f infra/docker/runtime-compose.yml up -d
bash infra/scripts/smokeTest.sh
CheckExpected
/ready endpointsAPI, STS, Gateway, Audit, Coordinator pass.
Migrationsschema_migrations includes the expected versions.
RedisStreams and consumer groups exist; pending entries are bounded.
AuditDLQ empty or understood; replay backlog drains.
Token exchangeSTS exchange succeeds for canary application/resource.
GatewayCanary protected request reaches upstream and produces audit evidence.

Prefer roll-forward fixes after migrations. If rolling back app images, verify the previous version understands the current schema and config values.

SymptomAction
Migration hook failsStop rollout, inspect Job logs, restore only if no migration committed; otherwise roll forward.
New pods fail config validationCompare env vars and mounted secret keys with current service config.
Readiness fails after app rollbackSchema or Redis stream expectations may no longer match the old app.

Use Export Audit Evidence when audit retention, SIEM export, or compliance evidence needs a durable path.