Skip to content

Upgrading#

How an Empowerment Center installation is moved to a new version, what happens to the own database, how to go back if needed and how to keep third-party images up to date with their security patches.

Before you start#

  • Read the release notes of the new version: they may ask for something before upgrading (a database extension, a new variable).
  • Choose a time without use: jobs in progress are lost and scheduled tasks that are running are treated as interrupted.
  • Have the new images at hand, for the backend and the frontend, of the same version: they are always updated together.

Migrations only go forward#

On startup, the new backend updates the schema of the own database (its migrations) before serving anyone. Those migrations only go forward:

  • an earlier version does not start on an already migrated database;
  • going back means restoring the backup from before the upgrade with the earlier images.

That is why the first step is always the backup. With the own database in Oracle, even more so: there a migration that fails halfway is not undone (see With the own database in Oracle).

Upgrade with Docker Compose#

  1. Back up the own database and check that the file is not empty (see Backup and restore):

    docker compose -f deploy/compose.yaml exec -T db \
      pg_dump -U postgres -Fc ecenter > ecenter-antes-de-actualizar.dump
    
  2. Get the new images. If they come from a registry, change the tag in deploy/.env (ECENTER_BACKEND_IMAGE and ECENTER_FRONTEND_IMAGE) and pull them; if you build them, use the new sources:

    docker compose -f deploy/compose.yaml pull     # from a registry
    docker compose -f deploy/compose.yaml build    # from the sources
    
  3. Also replace deploy/compose.yaml with the new version's one, if it brings changes (for example, another pinned version of Chromium or PostGIS), keeping your .env and your own application.yml.

  4. Start:

    docker compose -f deploy/compose.yaml up -d
    

    Compose stops the old backend (with 45 s to finish in an orderly way), starts the new one, which applies the migrations, and then serves.

  5. Check the version at https://ecenter.example.org/api/about and in Administration › Operations › Summary, and that there are no new alerts.

What carries on and what does not:

What After upgrading
Users' sessions They carry on: they are in the own database. On reloading, the browser loads the new web application.
Jobs in progress and their results They are lost: users calculate again.
Scheduled tasks running They are treated as interrupted and stay that way in their history.
Kept data of cubes If the new version calculates differently, each affected document is calculated once, when opened or at its next scheduled recalculation.

Note

The first time a new version starts it may re-index what workbooks and portal publications use. Meanwhile, usage searches are somewhat slower, but complete.

With several instances#

Stop all instances before starting the first new one. An old instance does not understand the migrated database and could save data the new one cannot read.

  1. Make the backup.
  2. Stop all backends.
  3. Start a new one and wait for it to be healthy (it has migrated the database).
  4. Start the others.

Without containers#

  1. Back up the own database.
  2. Stop the backend service.
  3. Replace the jar with the new one and the web application files with the new ones.
  4. Start the service and follow its log until it serves.

With the own database in Oracle#

Upgrading is the same: the backup, the new images or jar, and starting. The new backend applies the Oracle migrations on startup. Two things change:

  • The backup before upgrading is made with the Oracle tools (RMAN or Data Pump), not with pg_dump (see Backup and restore).
  • A migration that fails halfway is not undone. In Oracle, each statement that changes the structure (DDL) is committed by itself: if a migration fails in the middle, what it already did stays done.

Warning

With the own database in Oracle, the backup before upgrading is not optional. If a migration fails, stop the backend, restore that backup and tell Action Ware. To keep working meanwhile, go back to the earlier version as described in Going back.

Going back#

If something goes wrong and you have to return to the earlier version:

  1. Stop the backend.
  2. Restore the backup from before the upgrade (see Restore the own database; with the own database in Oracle, with the Oracle tools).
  3. Put back in deploy/.env the tags of the earlier images (and the earlier compose.yaml, if you changed it).
  4. Start: docker compose -f deploy/compose.yaml up -d.

What was done between the upgrade and going back is lost.

Pinned images#

Third-party images (PostGIS, Chromium, Valhalla and the bases of the ECenter images) are pinned by their digest, with the tag in front so it can be read:

image: postgis/postgis:18-3.6-alpine@sha256:…

That way, a tag that someone publishes again does not change what is installed without your deciding it. But pinned is not patched: with the digest, restarting does not pick up the security patches published later under the same tag.

Every month, and before upgrading ECenter, review the third-party images of deploy/compose.yaml:

  1. Look at the current digest of the same tag:

    docker buildx imagetools inspect postgis/postgis:18-3.6-alpine
    

    The Digest: line is that of the image for all its platforms.

  2. If it has changed, replace the digest in deploy/compose.yaml and restart that service.

  3. Check that everything still works.

Image How often it usually has patches
postgis/postgis (and its PostgreSQL) With each minor version of PostgreSQL.
chromedp/headless-shell Every few weeks: it loads the base map from outside.
ghcr.io/valhalla/valhalla-scripted With each version of Valhalla.

The ECenter images (backend and frontend) are updated by Action Ware with each version, with their JRE, their nginx and their dependencies up to date. Do not change their digest on your own.

Important

Do not change the major version of PostgreSQL (from 18 to another) by changing the image tag: the data of one major version cannot be read with another. That requires a PostgreSQL migration (pg_upgrade or backup and restore) and that ECenter supports that version.

If the database user is a superuser#

With the deploy/compose.yaml of the preview versions of ECenter 8, the ecenter user of the own database was the image's superuser. The init script does not run again on a volume that already exists, so it stays that way and works, but it is advisable to remove it. It is the user with which the image created the database, and PostgreSQL does not let you remove its superuser attribute (“The bootstrap superuser must have the SUPERUSER attribute”): the database is moved to a new volume with a backup.

  1. Make a backup with ecenter, which in that installation is the superuser, and also keep it off the server:

    docker compose -f deploy/compose.yaml exec -T db pg_dump -U ecenter -Fc ecenter > ecenter-antes.dump
    
  2. Stop the installation, without deleting its volumes, and delete only the database one:

    docker compose -f deploy/compose.yaml down
    docker volume rm ecenter_db-data
    
  3. Start only the database. When it is created again, ecenter is its owner without being a superuser and postgres has no password:

    docker compose -f deploy/compose.yaml up -d db
    
  4. Restore the backup as in Backup and restore (steps 2 and 3, with ecenter-antes.dump) and start the rest with docker compose -f deploy/compose.yaml up -d.

From then on, make the backups with postgres, as in Backup and restore.

See also#