Brume · Docs
Maintenance

Upgrade

Upgrade a Brume instance without downtime: render review, automatic boot migrations, safe rolling update, rollback in one command.

In brief

Upgrade Brume through Helm: render, review, and apply the chart. Migrations run when the backend starts; pods roll one by one without downtime. On failure, helm rollback restores the previous state.

This page says what to do. What the mechanism can do, what it refuses, and what the application reaches to get there are in The update mechanism.

In commands, <release> is the Helm release name; <instance> is global.instanceName or, when that value is empty, <release>; <namespace> is the configured namespace, whose chart default is misty.

Docker-compose upgrade from the superadmin button

On docker-compose, the superadmin panel compares the current version with the latest GHCR release and shows Update when one is available.

Unless the release requires a chart upgrade

A release can declare, through its chart baseline, that images alone are not enough. The panel then removes the button and shows the full command instead:

helm upgrade --install <release> oci://ghcr.io/brume-ai/charts/brume-chart \
  --version <version> -f <values> -n <namespace>

An update forced through the API answers chart_upgrade_required and starts nothing.

The button goes through the opt-in updater sidecar, so the sidecar has to be started. What that detour protects — access to the Docker socket, and what the application can and cannot ask of it — is described in The update mechanism.

Enable the sidecar

docker compose --profile selfupdate up -d

The selfupdate profile starts updater, the only container exposed to the Docker socket. Without it, the heartbeat marks updates unavailable. Set COMPOSE_PROJECT_NAME to the running stack's project name so the sidecar recreates the correct containers.

Disable the self-update path

Omit selfupdate to stop the sidecar and avoid exposing the Docker socket. To disable the backend path too, set:

BRUME_SELFUPDATE_ENABLED=0

Run from published images

One-click updates require published images with a moving channel tag. Set BRUME_IMAGE_TAG to latest, ee-latest, or <major.minor> so docker compose pull fetches new releases.

A from-source stack (build: only) must rebuild images instead.

VariableRole
BRUME_SELFUPDATE_METHODSelects the path: auto, kubernetes, compose, or off.
BRUME_SELFUPDATE_ENABLEDEnables (1) or disables (0) the backend path.
BRUME_SELFUPDATE_REQUEST_DIRShared directory where the backend writes request.json and reads status.json.
BRUME_IMAGE_TAGImage tag used by backend, worker, and frontend (latest, ee-latest, <major.minor>, etc.).
BRUME_SELFUPDATE_SERVICESServices the sidecar updates, default backend worker frontend docs.
BRUME_SELFUPDATE_POLL_INTERVALSidecar polling interval, in seconds.

All-in-one image upgrade

The all-in-one image (ghcr.io/brume-ai/brume:ce) has no one-click update button (why): it is upgraded by hand.

The superadmin panel compares the current version with GHCR and flags that an update exists, then shows the manual steps: pull the image and recreate the container.

docker pull ghcr.io/brume-ai/brume:ce
# then recreate the container on the new image:
#  — either by re-running your `docker run … ghcr.io/brume-ai/brume:ce`
#  — or with `docker compose up -d` if you orchestrate it through compose

Persist the database across containers with a volume (-v brume-data:/var/lib/postgresql/data). The new container runs schema migrations at boot.

Automate it (optional)

For unattended updates, point external Watchtower at the container. It pulls and recreates it; Brume does not manage this automation.

The four-step flow

StepCommandEffect
Reviewhelm template <release> ee/helm-chart/ -f values/<instance>.yaml -n <namespace>Displays the YAML that will be applied, before touching it.
Applyhelm upgrade <release> ee/helm-chart/ -f values/<instance>.yaml -n <namespace>Pushes the new release.
Migrationpython -m brume.migrate (the database-migrations init container on Kubernetes; the backend entrypoint on compose)Applies schema migrations at boot, forward-only.
Rollbackhelm rollback <release> <revision> -n <namespace>Returns to a previous Helm revision.

Review before applying

The brume-chart chart is the instance source of truth. Render the manifest and compare it with the current state before running helm upgrade.

From the repository, or from the published chart

The commands below point at the chart in the repository. On every release, the same chart is also published as OCI: replace the path with oci://ghcr.io/brume-ai/charts/brume-chart --version <version> to upgrade an instance without cloning anything. The published chart pins the :v<version> images of that same release.

Render the manifest

helm template <release> ee/helm-chart/ \
  -f ee/helm-chart/values/<instance>.yaml --namespace <namespace>

Review the rendered YAML's image tags, resources, rolling strategy, and replicas.

Apply the release

helm upgrade <release> ee/helm-chart/ \
  -f ee/helm-chart/values/<instance>.yaml --namespace <namespace>

Helm records the new revision and retains the previous rollback target.

Verify the deployment

kubectl rollout status deployment/<instance>-backend -n <namespace>
kubectl rollout status deployment/<instance>-frontend -n <namespace>
kubectl get pods -n <namespace>

All pods must reach Running and Ready. A backend stuck in Init:CrashLoopBackOff means a migration failed: its logs are in the database-migrations init container, not in the main container (see below).

The chart is the source of truth

kubectl patch, kubectl edit, and ad-hoc kubectl apply on a component managed by the chart create divergence between the chart and the real cluster state. A change goes through the chart, then through helm upgrade.

Unattended upgrades on Kubernetes: the chart-updater component

The commands above assume someone to run them. The chart-updater component performs the same upgrade with nobody there — chart included, so it covers the very case the superadmin button refuses to handle.

It is off by default.

Read the trade-off before enabling

This component's account is namespace-admin-equivalent; that, and what bounds it, is explained in The update mechanism. Never point chartRef or registry at a registry you do not control.

Enable the component

chartUpdater:
  enabled: true
  schedule: "0 4 * * *"
  # Uncomment ONLY if this release renders cluster-scoped objects
  # (a namespace created by the chart, or tower.rbac.enabled):
  # rbac:
  #   clusterScoped: true

Then helm upgrade as usual. Every night the component reads the release tags of the backend image — the same source of truth as the built-in update check — compares them to the deployed chart version, and applies only what moves forward.

Read what it did

Every run's outcome is written to a ConfigMap, not only to logs a history limit will eventually discard:

kubectl get configmap <instance>-chart-updater-status -n <namespace> -o jsonpath='{.data}'

outcome is applied (upgraded), skipped (nothing newer), refused (a newer image exists but its chart is not published — nothing was touched), or failed, along with from_version, to_version, message, and finished_at.

Stop it

Set chartUpdater.enabled back to false and run helm upgrade. The CronJob and its rights disappear, the instance keeps running, and you upgrade by hand.

Your own values survive the upgrade: the component runs helm upgrade --reset-then-reuse-values, which takes the new chart's defaults and re-applies what you supplied on top. That is what guarantees the new chart's image tags actually take effect — a plain --reuse-values would let the release move to the new chart while still running the old images.

Schema migrations at startup

Migrations run on their own before the backend serves any request. Where they run depends on the deployment, and that decides where you read the logs when an upgrade fails.

On docker-compose and all-in-one: the backend entrypoint

The entrypoint migrates only when DATABASE_ADMIN_URL is set, and it creates the database roles first:

if [ -n "${DATABASE_ADMIN_URL:-}" ]; then
    uv run python -m brume.db_roles
    DATABASE_URL="$DATABASE_ADMIN_URL" uv run python -m brume.migrate
    unset DATABASE_ADMIN_URL
fi

exec uv run uvicorn brume.app:create_prod_app --factory --host 0.0.0.0 --port 8000 …

Without DATABASE_ADMIN_URL, the container starts the server and migrates nothing: a schema left behind almost always comes from that.

On Kubernetes: the database-migrations init container

The Helm chart moves migrations out of the main container. A database-migrations init container builds its own DATABASE_ADMIN_URL from the CNPG superuser Secret, runs brume.db_roles, then brume.migrate --ensure-pgaudit. The backend container never gets DATABASE_ADMIN_URL: the Secret it imports only carries the DATABASE_URL of the brume_app runtime role. Its entrypoint therefore migrates nothing.

Direct consequence: the migration logs are not in the main container.

# The failing backend pod:
kubectl get pods -n <namespace> -l app=<instance>-backend

# The migration logs — the init container, not the main one:
kubectl logs <pod> -n <namespace> -c database-migrations

A pod stuck in Init:CrashLoopBackOff is a failed migration; kubectl logs <pod> without -c would target the main container, which has not started yet and has nothing to say.

Either way, no manual step separates the deployment from service start: the new backend serves no request until its migrations are applied.

PropertyBehavior
Forward-onlyMigrations are not reverted. A corrected revision is added; an applied migration is never rewritten.
Checksum validationEach migration file is checked by checksum. Modifying an already applied file causes the deployment to be rejected.
Exactly onceThe runner guarantees that a migration runs only once; no IF NOT EXISTS, no BEGIN/COMMIT in files.

Rolling update: replace pods one by one

Critical deployments (frontend, backend, tower) carry required anti-affinity: one pod per worker node. With this constraint, the rolling update strategy must be maxUnavailable: 1 and maxSurge: 0.

maxSurge: 0 is mandatory with anti-affinity

With required anti-affinity (one pod per host), a maxSurge greater than 0 asks Kubernetes to create an additional pod that finds no free node: the rolling update blocks (deadlock). The maxUnavailable: 1 / maxSurge: 0 combination removes an old pod before creating a new one in its place, and the deployment progresses.

This is also the strategy applied to the Traefik DaemonSet (maxUnavailable: 1 / maxSurge: 0), for the same reason.

Rollback

Two levels depending on what you want to undo.

TargetCommandWhen
Entire Helm releasehelm rollback <release> <revision> -n <namespace>The helm upgrade introduced a bad config (values, image, resources). Returns to a complete revision.
One deploymentkubectl rollout undo deployment/<instance>-backend -n <namespace>A specific deployment regresses and you only want its previous image, without touching the rest.

To find the target Helm revision number, list history before rolling back:

helm history <release> -n <namespace>
kubectl rollout history deployment/<instance>-backend -n <namespace>

A Helm rollback does not roll back the database schema: migrations are forward-only. If the new version migrated the database, the old image must remain compatible with the migrated schema. Check this point before upgrading to a version that changes the schema in a non-backward-compatible way.

To fix the must be owner of relation error, follow the troubleshooting procedure.

Procrastinate schema

The asynchronous task queue runs on procrastinate, whose schema is fixed in migration 20260726145334_procrastinate-schema.sql. To upgrade procrastinate:

  • Record the version in pyproject.toml.
  • Regenerate the schema diff through procrastinate.schema.SchemaManager.get_schema().
  • Create a new migration with the diff.

Never modify that migration: checksum validation would reject the deployment. The rule applies to any already applied migration, procrastinate or not.

A reproducible upgrade

The same manifests apply to the shared cloud, dedicated cloud, and self-hosted. The chart renders the instance, migrations apply at boot, the rolling update preserves availability, and Helm rollback returns to a previous revision.

On this page