Skip to content

Deprecated

This page is deprecated and may contain information that is no longer up to date.

Container-based schema upgrade

Warning

If the DB schema upgrade fails, there is no automated rollback to the previous schema. Rollback will involve some manual steps. Not all schema changes can be rolled back (for example, deleting columns or tables). Before upgrading a production database, it is strongly recommended to back up the DB and to execute the upgrade procedure against a clone of the DB before upgrading the production DB.

The procedure for the DB schema upgrade is described below. This is the procedure used at CERN to upgrade the catalogue schema in production and preproduction. For local development the upgrade should be done manually on ones machine. Before proceeding with the upgrade it is advised to read the CTA release notes as extra work may be necessary for certain catalogue upgrades.

Pull the container from the public registry

The stable tag contains the most recent version of the container tested to work at CERN, and is the recomended tag.

Pull the latest stable image from CTA public registry gitlab repository container registry.

# podman pull gitlab-registry.cern.ch/cta/public_registry/container_registry/cta-catalogue-updater:stable
Trying to pull gitlab-registry.cern.ch/cta/public_registry/container_registry/cta-catalogue-updater:stable...
Getting image source signatures
Copying blob 609c31f8513b skipped: already exists
Copying blob bcc349949b20 skipped: already exists
Copying blob 968e711a3331 skipped: already exists
Copying blob 8bfdb552d6be skipped: already exists
Copying blob dbe8cb82a03e skipped: already exists
Copying blob d0cd475d3b53 skipped: already exists
Copying blob 85ec7c549d38 skipped: already exists
Copying config eed62e9a05 done
Writing manifest to image destination
eed62e9a05255991660aef71ef84d5161a10ecf5fa32d66b3d3221c26b381bba

Execute the upgrade procedure

To perform the catalogue update, the container requires the cta-catalogue.conf file to be mounted in the directory /shared/etc_cta and the yum repos to download the cta RPMs to be mounted in the directory /shared/etc_yum.repos.d.

The steps to container takes to perform the catalogue update are as follows:

  1. Install the necessary rpms to connect to the database
  2. Install the cta-catalogueutils RPM to get access to the cta-catalogue-schema-verify command
  3. Clone the CTA repo and checkout the version specified by the user to get access to the catalogue migration scripts.
  4. Run the cta-catalogue-schema-verifycommand to ensure the current catalogue schema is correct.
  5. Perform the liquibase command the user specified (normally the update command, but can also use the rollbackCount command to rollback an update)
  6. Run the cta-catalogue-schema-verifycommand to ensure the changes performed by liquibase left the catalogue with a correct schema.

The container requires the following command line arguments:

  • -v the version of CTA to checkout in step 3
  • -f the current version of the catalogue
  • -t the version of the catalogue to upgrade to
  • -c the liquibase command to run

The following command line arguments are optional:

  • -d if specified, skip the schema verify steps 4 and 6.
  • -s Preflight command to run before step 4.

Example instantiation using podman:

podman run -it -v /etc/cta:/shared/etc_cta:ro -v /etc/yum-puppet.repos.d:/shared/etc_yum.repos.d:ro gitlab-registry.cern.ch/cta/public_registry/container_registry/cta-catalogue-updater -v 4.8.7-1 -f 12.0 -t 13.0 -c update