More

Working with the mirror after installation

Uploading new versions to the mirror, delivering updates to clusters.

Once the platform is installed in a closed loop, the mirror is used to deliver updates. When a new version of the platform is released, it is necessary to update the mirror, then the clusters.

Migration from old mirror

When migrating from a previous version of the mirror module (old Docker/Podman, different location):

  1. Stop the old mirror and remove the old container runtime if necessary (eg rm /usr/local/bin/podman or similar for your installation).
  2. Initialize the new mirror (stm init or stm bundle make / stm make) and, if necessary, pass the old mirror certificate with three flags together: --cert-file, --cert-key-file, and --cert-authority-file (paths to the certificate, key, and CA).
  3. Download the required versions of the platform from a bundle, from a repository, or from a manually assembled bundle. The list of versions in the old mirror can be found in the file $OLD_MIRROR_PATH/images/repo/bin/versions.json.
  4. For nodes on deb distributions, after changing the mirror on the nodes, run systemctl restart shturvald and check the update of the repositories (apt update).

Removing a release from the mirror

To remove a platform version from the mirror (to free up space or remove an outdated release):

stm delete --version=2.12.0,2.11.0

Specify the versions to be deleted, separated by commas. For correct deletion, metadata is required (files shturval_offline/VERSION/*.json in the repository); When using old bundles or stm younger than 1.3, you may need to update stm and re-download at least one release. Deleting does not automatically free up disk space: in Nexus you need to run the Compact blob store task (Administration → Tasks) for the corresponding blob store (docker, shturval_bin_public, shturval_helm, etc.).


Working with patches

The patch allows you to add missing packages or images to the mirror without rebuilding the bundle and without completely updating the mirror.

Building the patch (on a machine with access to the Shturval repository): prepare a config similar to config/patch.yaml (list of repositories and packages/images) and run stm patch make --license=XXXX-XXXX-XXXX. An archive of the form shturval-mirror-patch-TIMESTAMP.tgz will be created.

Applying the patch: in the directory with the initialized mirror, create the shturval-patch directory, place the archive in it and execute stm patch apply. After application, the archive can be deleted.


Ways to update a mirror

  1. Manual download of the bundle - the bundle of the new version is uploaded to a file hosting service, you download and upload to the mirror
  2. Pipeline - update without manual download (instructions in the Service Desk knowledge base)

Step by step update procedure

Step 1: Receive and unpack the bundle

On the mirror host, download the bundle using the link from the development team. The host must be able to open this link. Replace 2.14.0 with the version from the archive name, and <BUNDLE_URL> with the file URL.

Run the following commands in the same session. At the end of this step you return to the current mirror directory.

export NEW_VERSION=2.14.0
mkdir newbundle && cd newbundle   # create a directory for the new bundle
wget "<BUNDLE_URL>" -O shturval-bundle-$NEW_VERSION.tar.gz
tar -zxvf shturval-bundle-$NEW_VERSION.tar.gz   # unpack the archive in the current directory
rm shturval-bundle-$NEW_VERSION.tar.gz   # delete the downloaded archive
cd ..   # return to the current mirror directory

Step 2: Update the stm utility

Run the commands below from the mirror directory. If the mirror runs as root, restart it with sudo. In rootless mode, run ./stm restart as the mirror user.

cp newbundle/stm ./         # replace stm with the version from the new bundle
cp -rp newbundle/distr ./   # copy container images (Nginx, rewrite rules)
sudo ./stm restart          # restart mirror services with the new stm and distr

Step 3: Upload to mirror

Run the command in the current mirror directory. If the mirror runs as root, load the bundle with sudo. In rootless mode, run ./stm bundle load as the mirror user.

sudo ./stm bundle load --path=./newbundle/shturval-bundle

After a successful load, the newbundle directory is no longer needed: the stm binary and the distr directory are already copied into the mirror directory, and the bundle contents are loaded. Delete newbundle from the mirror directory to free disk space:

rm -rf ./newbundle

Step 4: Restart ShturvalUpdateChannel

After updating the mirror, it is required to restart the custom resource ShturvalUpdateChannel in each cluster (management and client) for which the update is planned. Without this, the new version will appear in at least 6 hours (reconciliation).

Via kubectl:

kubectl label ShturvalUpdateChannel shturval-update --namespace shturval-update-system example=restart

The example=restart parameter is a custom label for the reconciliation trigger.

Via GUI:

  1. Administration → Custom Resources → update.shturval.tech → ShturvalUpdateChannel
  2. Open the resource shturval-update
  3. Check → Save (no changes)

The new version will be available in 5-10 minutes.

Step 5: Updating Clusters

The order is management cluster first, then client clusters.

More details: Update procedure, Start and update stages.


Conditionally closed loop (Internet on the mirror)

If the mirror host has access to r.shturval.tech:

stm download --version=2.14.0

Then follow steps 4 and 5 above.