Skip to main content
Version: 3.2

Upgrading from 3.1 to 3.2

Move a 3.1 installation to 3.2: get 3.2, check, stop, back up and run upgrade apply once, then start. Buffered messages come through the upgrade.

From
3.1.x
Installs
Docker Compose · docker run · Single binary · Helm
Upgrade step
upgrade apply, once

3.2 is a minor release. It is not a swap of the image tag: 3.2 stores some of your data differently from 3.1, so your data is migrated once, by a command you run. MaestroHub never migrates data on its own. If you start 3.2 without the command, it refuses to start and tells you why (see If you skip the step).

What the command changes in 3.1 data:

  • Demo Plant (Beta): a workspace connected to a demo plant is carried over to the plant model of 3.2, where a plant runs once and workspaces connect to it.
  • App Studio (Beta): the Git remote settings (with their encrypted access tokens) and edit sessions that deleted apps left behind are removed, and the Draft preview gets its own storage.
  • Loss ledger: on a single node with PostgreSQL, the old loss ledger file is moved aside (see The loss ledger is one database on Postgres).
  • Database: the new tables and columns of 3.2 are added.

Read What Changes in 3.2 for every behaviour that changes, and who it affects.

upgrade check lists each of these for your own data before anything is changed.

The steps​

StepWhat you doMaestroHub is
1Get 3.2Running on 3.1
2upgrade checkRunning on 3.1
3Stop MaestroHubStopped
4Back up, then upgrade applyStopped
5Start 3.2Running on 3.2

MaestroHub is stopped from step 3 to step 5.

Is this guide for you?​

You runWhat to do
3.1.xFollow this guide.
3.1.x with Docker Compose that a tool manages, such as Dokploy, Portainer or CoolifyFollow this guide, and read If a tool manages your Compose file first.
3.0.xFollow Upgrading from 3.0 to 3.1 with the 3.2 image or archive. It runs the 3.2 upgrade in the same upgrade apply. Read What Changes in 3.1 and What Changes in 3.2 too.
2.6.xFollow Upgrade from 2.6.x to 3.0 with the 3.2 image or archive. It runs the later upgrades in the same upgrade apply.
No existing dataInstall 3.2. There is nothing to upgrade.

Which version do you run? Ask MaestroHub, without signing in:

curl http://localhost:8080/api/v1/version

It prints, for example, {"version":"3.1.0",…}.

Before you start​

  1. Read What Changes in 3.2. Most changes need nothing from you; a few need a setting changed before or after the upgrade.
  2. Back up your PostgreSQL databases, if MaestroHub keeps stores in PostgreSQL (the single-node bundle does, and so does Helm). upgrade apply backs up MaestroHub's own file stores, not your databases. It asks for the name of your snapshot and refuses without one.
  3. Plan a short stop. While MaestroHub is stopped it reads nothing from your devices and sends nothing. Values your devices produce in that time are not buffered. Messages that were already buffered stay buffered (see below).

An outage in progress is fine. If a destination is down and MaestroHub is holding a backlog for it, upgrade anyway: messages already buffered come through the upgrade and are delivered once the destination answers. See Upgrading with a store-and-forward backlog.

Know your installation​

Each step below gives its commands once for each kind of installation. Answer these questions now, so you pick the right commands and change them where yours differs. Do not run any upgrade command yet: you run them from step 2 on, after step 1 has got 3.2.

  1. How do you run MaestroHub? In each step, use the tab that matches: Docker Compose, docker run, Single binary or Helm. If a tool such as Dokploy, Portainer or Coolify manages your Compose file, use the docker run tab, and read If a tool manages your Compose file.

  2. Does MaestroHub run with a config file? Look at the MaestroHub service in your Compose file, or at the command you start MaestroHub with. An installation upgraded from 2.6 often still has its 2.6 Compose file.

    You seeThen
    A command: line, or a start command, with --config <file>Use the commands under With a config file, with your own file. With docker run or the single binary, pass the same --config <file> to every command; with docker run, mount the file too.
    No command: line and no --configUse the commands under Without a config file, or leave out --config. MaestroHub runs with its default settings and has no config file.

    A --config that names a file your installation does not have stops the command with failed to read config file: open /config/config.yaml: no such file or directory.

  3. What is your service called? The Compose commands use the service name maestrohub, as in the 3.1 bundles. docker compose config --services lists yours: use it in place of maestrohub. Run every Compose command from the folder that holds your Compose file.

  4. What is your data volume called? The docker run commands use the volume maestrohub-data. Use the volume name you gave 3.1 in its place.

  5. Is the disk that holds Docker's data small? upgrade check copies your stores there. See Free space for the copies in step 2.

If a tool manages your Compose file​

Tools such as Dokploy, Portainer and Coolify keep the Compose file in their own records, and write it to the host again at every deploy. Two things follow:

  • A change to the Compose file on the host does not last. The tool's next deploy writes its own version over it. The tool can also recreate the folder that holds the file, and a shell still in that folder then fails with getwd: no such file or directory.
  • A deploy with the 3.2 image before step 4 starts 3.2 on 3.1 data. It changes nothing, but MaestroHub refuses to start (see If you skip the step) and stays down until you finish steps 3 and 4.

So run steps 1 to 4 with the docker run commands, from any folder outside the tool's (your home folder, for example). They name the 3.2 image themselves, so the tool's Compose file stays on 3.1 and MaestroHub keeps running until step 3. Change the image in the tool only in step 5.

The docker run commands need the names your tool gave the container and the data volume. These two commands only read, so run them now:

  1. Find the MaestroHub container's name:

    docker ps --format '{{.Names}}  {{.Image}}'
  2. Find its data. Put the container's name from the first command in place of maestrohub:

    docker inspect maestrohub --format '{{range .Mounts}}{{println .Destination .Name .Source}}{{end}}'

    Use the line that starts with /data. If it has three words, the second is the volume's name: use it in place of maestrohub-data in every command. If it has two, the data is a folder on the host and the second word is its path: use that path in place of maestrohub-data.

If the service in the tool's Compose file has a command: line with --config <file>, mount that file and pass the same --config too.

Step 1. Get 3.2​

Keep a copy of your Compose file and .env, then set the image tag to 3.2.0 (in image: or in your .env) and pull it:

docker compose pull maestrohub

Do not run docker compose up yet. 3.1 keeps running until step 3.

Step 2. Check​

upgrade check changes nothing and is safe while 3.1 runs. It works on copies of your stores and reports what apply would do.

Free space for the copies. check copies the stores it upgrades to a temporary folder, and deletes the copies when it ends. In a container that folder is inside the container, on the disk that holds Docker's data (often /var/lib/docker). If that disk has less free space than your stores take (a large audit store, for example), put the copies on a larger disk with --work-dir. The folder must be writable by user ID 1000, which the upgrade runs as:

mkdir -p /mnt/big/upgrade-work && chown 1000:1000 /mnt/big/upgrade-work
docker run --rm -v maestrohub-data:/data -v /mnt/big/upgrade-work:/work \
maestrohub/context-platform:3.2.0 upgrade check --work-dir /work

With Docker Compose, add the same -v /mnt/big/upgrade-work:/work after run --rm, and --work-dir /work at the end.

With a config file (your service has a command: line with --config):

docker compose run --rm maestrohub upgrade check --config /config/config.yaml

Without a config file (your service has no command: line):

docker compose run --rm maestrohub upgrade check

Exit code 2 with work listed is what you expect from 3.1 data. If it lists an item that needs a person, read it now: apply asks you about it.

If it stops with failed to read config file: … no such file or directory, the command names a config file your installation does not have: it runs with the default settings. Run it again without --config /config/config.yaml: docker compose run --rm maestrohub upgrade check. See Know your installation.

Step 3. Stop MaestroHub​

docker compose stop maestrohub

Step 4. Back up and apply​

Take your PostgreSQL snapshot first, if you keep stores there. Then run apply. It asks what it needs to know, backs up every file store it changes, migrates your data and verifies the result. If a step fails, it puts every store back as it was.

With a config file (your service has a command: line with --config):

docker compose run --rm maestrohub upgrade apply --config /config/config.yaml

Without a config file (your service has no command: line):

docker compose run --rm maestrohub upgrade apply

With stores in PostgreSQL, add --db-snapshot-taken <your snapshot name>.

It ends with Upgraded and verified, and a To undo command that takes you back to 3.1 until 3.2 has started: keep it.

The commands that check and apply print, such as Next and To undo, are always in the Docker Compose form. With docker run, keep everything from upgrade on, and put your docker run prefix in front of it.

In a script, give --force --data-not-in-use so it does not ask, and --db-snapshot-taken <name> for PostgreSQL. The flags are in the command reference.

Step 5. Start 3.2​

docker compose up -d maestrohub
docker compose ps maestrohub

The container shows healthy once 3.2 is ready.

Buffers that held messages before the upgrade show them on Store & Forward, and deliver them once their destination answers.

Helm​

Single-node chart. helm upgrade runs the data upgrade for you, in the <release>-context-platform-single-node-upgrade-gate Job, before 3.2 starts. With the PostgreSQL the chart runs (the default), the Job also takes the database snapshot: it does steps 2 to 5 itself.

  1. Run the upgrade. Give it time, since Helm waits for the Job, and do not add --atomic (or --rollback-on-failure with Helm 4):

    helm upgrade <release> oci://registry-1.docker.io/maestrohub/context-platform-single-node      --version 3.2.0 -n <namespace> --reset-then-reuse-values --timeout 60m

    --reset-then-reuse-values takes the 3.2 chart's defaults and keeps the values you set; --reuse-values would also keep 3.1's defaults.

  2. The Job checks your data with 3.2 while 3.1 keeps serving, and checks that PostgreSQL's volume has room for the snapshot. Then it stops MaestroHub, dumps every MaestroHub database onto that volume, runs upgrade apply, and prints what it converted. Helm then starts 3.2. Read the Job's log with:

    kubectl -n <namespace> logs job/<release>-context-platform-single-node-upgrade-gate

The snapshot stays on PostgreSQL's volume, in upgrade-backups/3.2.0-<time>/, until the next upgrade replaces it: it is how you go back to 3.1. Running the upgrade again is safe: with nothing left to convert, the Job stops nothing.

With your own PostgreSQL server, or a historian on a server of its own, the Job cannot take the snapshot. The first upgrade stops with nothing changed and its log prints the steps: stop MaestroHub, take a snapshot with your own tooling, and run the upgrade again with --set upgradeGate.snapshotTaken=<snapshot name> --set upgradeGate.snapshotForVersion=3.2.0. You can do the same with the bundled PostgreSQL to use a snapshot of your own, such as a volume snapshot of a large historian.

  • Too little room on PostgreSQL's volume for the snapshot: the upgrade stops before anything is stopped, and the log gives the sizes. Grow the volume, or use a snapshot of your own.
  • If the snapshot or upgrade apply fails and the data is as it was, the Job says so and 3.1 can start again: the log names the command (helm rollback <release> -n <namespace>). If apply stops after it changed your databases (the Job's pod was killed, or the Job was deleted), MaestroHub stays stopped: run the upgrade again with --set upgradeGate.restoreInterrupted=<run id> as the log says. The Job restores the databases from its snapshot and upgrades again.
  • If Helm stops waiting (its timeout, or Ctrl-C), the Job carries on in the cluster. Wait for it with kubectl wait --for=condition=complete job/<release>-context-platform-single-node-upgrade-gate, then run the same upgrade again.
  • Out of memory. The Job's memory limit is 4 GiB. If its pod ends OOMKilled, add --set upgradeGate.resources.limits.memory=8Gi and run the upgrade again.
  • NetworkPolicy. With networkPolicy.enabled, the Job brings its own policies (DNS, PostgreSQL, the Kubernetes API server). If your cluster adds its own default-deny policies, allow egress from pods labelled app.kubernetes.io/component=upgrade-gate to the API server and to PostgreSQL.
  • Argo CD runs the Job as a PreSync hook, and the snapshot and the conversion run inside the sync: give it time.

The chart's README.md, section Upgrading, has every message the Job prints, where the snapshot is and how to copy it, the restore, how to go back to 3.1, and the steps for a snapshot of your own.

The data volume. The chart's /data claim is 13Gi by default (15Gi with historian.type=pebble). helm upgrade grows a smaller claim, such as the 5Gi of earlier releases, to it; when the claim's storage class does not allow volume expansion, the upgrade stops before changing anything and the chart README shows how to move /data to a new claim. See The data volume is big enough, or says so.

Enterprise chart (one deployment per service). helm upgrade runs the data upgrade for you, in the <release>-upgrade Job, before any 3.2 service starts. You take the database snapshot and give its name; the Job does steps 2 to 5.

  1. Run the upgrade as you always do. Give it time, since Helm waits for the Job:

    helm upgrade <release> <3.2 chart> -n <namespace> -f <your values> --timeout 30m

    The Job runs upgrade check against every MaestroHub database. On 3.1 data it stops the upgrade with nothing deployed, and 3.1 keeps running. Its log lists what 3.2 converts in your data, and how to take the snapshot:

    kubectl -n <app namespace> logs job/<release>-upgrade --all-containers
  2. Take a snapshot of the MaestroHub databases on your PostgreSQL server with your own tooling: a CloudNativePG backup, a volume snapshot, or pg_dump of each database. With backup.postgres.enabled, the chart's backup job takes one now. The log prints the command with your names; for a release named maestrohub it is:

    kubectl -n maestrohub create job --from=cronjob/maestrohub-backup-postgres pre-3-1
  3. Run the same upgrade again with the snapshot's name:

    helm upgrade <release> <3.2 chart> -n <namespace> -f <your values> --timeout 30m \
    --set upgrade.snapshotTaken=<snapshot name>

    The Job stops every MaestroHub service of the release (the databases keep running), runs upgrade apply, and prints what it converted. Then Helm starts the 3.2 services. MaestroHub is stopped from the start of upgrade apply until the 3.2 services are ready.

Running the upgrade again later is safe: with nothing left to convert, the Job stops nothing and the upgrade goes on. You can leave upgrade.snapshotTaken in your values.

  • The image. The Job runs one image, maestrohub/context-platform at the chart's version. It carries the upgrade command, and it also stops the services, through the Kubernetes API with the Job's own service account. If your chart's version is not the version of your services, set upgrade.image.tag to the 3.2 version.
  • Documents that need a person. If the log says a document needs a person, read its finding, then add --set upgrade.accept={<id>,<id>}.
  • If upgrade apply fails, the log says what was changed and what was put back. MaestroHub stays stopped. helm rollback <release> starts 3.1 again. If the report says a database was left changed, restore your snapshot first.
  • Argo CD runs the Job as a PreSync hook. The sync fails on 3.1 data until you set upgrade.snapshotTaken in the Application's values.

The chart's README.md (values upgrade.*) describes each setting.

New databases. With an external PostgreSQL, create loss_ledger_db before the upgrade, owned by the MaestroHub user; a release that ran with a module switched off also needs that module's database (see Five more modules always run). Until a database exists, its pod waits and helm upgrade --wait times out. If you upgrade the services one after the other, upgrade the graph and connectors services before the engine: see Rolling upgrades.

Air-gapped installs. The upgrade Job needs one image besides the 3.2 service images you already mirror: MaestroHub's own maestrohub/context-platform, at the version you install. Nothing else is pulled.

  1. Copy it into your registry, from a machine that reaches Docker Hub and your registry:

    docker pull maestrohub/context-platform:3.2.0
    docker tag maestrohub/context-platform:3.2.0 registry.example.com/maestrohub/context-platform:3.2.0
    docker push registry.example.com/maestrohub/context-platform:3.2.0
  2. Point the Job at it in your values. If your registry needs credentials, the Job uses the same pull secret as the rest of the chart, global.imagePullSecrets:

    upgrade:
    image:
    repository: registry.example.com/maestrohub/context-platform
    tag: "3.2.0"
    pullPolicy: IfNotPresent
    global:
    imagePullSecrets:
    - name: my-registry-credentials
  3. Run the steps above. To see which image the Job will run before you upgrade, render it:

    helm template <release> <3.2 chart> -f <your values> --show-only templates/job-upgrade.yaml | grep image:

If you skip the step​

If you start 3.2 on 3.1 data without upgrade apply, nothing is changed and nothing runs:

  • MaestroHub prints what it found and the commands to run, and serves a Data migration needed page on its address.
  • Docker shows the container unhealthy. docker inspect shows why: the health check prints MaestroHub did not start and the command to run.
  • Kubernetes keeps the pod running and not ready (/ready answers 503 with the reason).
  • Helm refuses the release at the upgrade gate, or on the Enterprise chart at the upgrade Job (see above).

Stop it, then go on from step 3. See also Upgrade problems.

If you want to go back​

Until 3.2 has started on your data, upgrade restore puts back the backup that apply took. Restore your PostgreSQL snapshot as well, then start 3.1 again. See Upgrade problems.