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):
- Stop the old mirror and remove the old container runtime if necessary (eg
rm /usr/local/bin/podmanor similar for your installation). - Initialize the new mirror (
stm initorstm 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). - 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. - For nodes on deb distributions, after changing the mirror on the nodes, run
systemctl restart shturvaldand 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
- 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
- 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.15.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.15.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: The version appears in the cluster
After the bundle is loaded, cluster-manager refreshes the version list. If the cluster registry matches the management cluster registry, cluster-manager requests the update matrix directly. If the registries differ, check the CronJob and ConfigMap cluster-available-updates in the shturval-cluster-manager namespace of the client cluster. With a separate registry, the next check follows the CronJob schedule and runs no later than 60 minutes after the previous one.
Run the commands in the management cluster. Replace clustername with the cluster name:
kubectl get clusterinfo clustername -n clustername -o jsonpath='{.status.update.availableUpdates}'
kubectl describe clusterupdatechannel clustername -n clustername
If the version does not appear, open Update troubleshooting.
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.15.0
Then follow steps 4 and 5 above.