canasta upgrade

From Canasta Wiki

canasta > upgrade

canasta upgrade

Upgrade Canasta instances

Synopsis

Upgrade all registered Canasta instances by refreshing configs, pulling latest images, running migrations, and restarting containers. A native install first updates the CLI itself to the latest release; with --dry-run it reports the release it would update to and previews with the installed version. A restarted instance whose startup composer update failed is reported with a warning, and so is each wiki of a running Docker Compose instance that does not answer through the HAProxy edge after the upgrade, as canasta start reports it.

Upgrade never moves an instance back to an older Canasta release. If any instance runs a newer release than this CLI targets, no instance is upgraded; going back is canasta backup restore.

On Docker Compose, an instance whose new image may not fit on the filesystem that holds container images is not upgraded and keeps running as it is. The size of the image it runs now is the measure, so the check can ask for more space than the pull needs. The filesystem also needs at least 250,000 free inodes, since an image unpacks to over 100,000 files. canasta image prune reclaims the images no instance uses.

On Docker Compose, upgrade first moves each host's instances behind the HAProxy edge, keeping their hostnames, ports and certificates. A host whose instances the edge cannot all serve is refused with the reason, and none of its instances is upgraded; an instance whose move fails is put back as it was and not upgraded. --dry-run shows each host's plan. Upgrade also renames the TLS settings in each .env: CADDY_TLS_MODE to TLS_MODE (CADDY_AUTO_HTTPS=off to TLS_MODE=off), and CADDY_TRUSTED_PROXIES, CADDY_TLS_CERT and CADDY_TLS_KEY to TRUSTED_PROXIES, TLS_CERT and TLS_KEY.

A Docker Compose instance managed through gitops runs the Canasta release of the CLI on its own host, so upgrade moves its .env to the new release and leaves env.template, which every host shares, unchanged. An image set with canasta config set CANASTA_IMAGE=... other than a release of the official image is kept in env.template for every host, and upgrade leaves it as it is.

A Kubernetes instance managed through gitops is not redeployed: Argo CD deploys it from its gitops repo. Upgrade stages the refreshed chart and image tag there, and you deploy them with canasta gitops push, then canasta gitops sync. An instance built from source still has its image rebuilt, and its web pods restart when the new build differs from the image they run.

An instance built from source is rebuilt on the upgrade's Canasta release: a BASE_IMAGE build argument that names an older ghcr.io/canastawiki/canasta:<version> image is moved to the new release, in the rebuild and in the recorded build arguments. Any other BASE_IMAGE is kept as given.

Upgrade also moves a running instance on the bundled database off the database root account, onto MediaWiki's own mediawiki account with access to the instance's wiki databases only. It leaves the instance on root, and says why, while a settings file sets $wgDBuser or $wgDBpassword or the server holds a database no wiki declares, and tries again on the next upgrade. canasta config set CANASTA_DB_ROOT_ACCOUNT=true keeps an instance on root. On a gitops-managed Kubernetes instance the move is staged with the rest and takes effect at the push and sync. A stopped instance is left stopped and on root until an upgrade runs while it is running; --dry-run and the end of the upgrade name each such instance.

By default the CLI itself updates to the latest released version within the current major (the highest vX.Y.Z tag whose major matches the installed version), so an upgrade never crosses a major boundary on its own. Pass --allow-major to move to the latest release overall, including a new major version (which may include breaking changes). Pass --dev to track the development branch (head of main) instead. --dev also stays within the current major: when the head of main is another major, the CLI is not moved.

A move to a new major version goes in steps. The CLI first updates to the latest release of its current major and upgrades every instance there, as canasta upgrade does. It then checks every instance for what would stop it from moving, and moves to the new major only if nothing does; otherwise it names each problem and stays where it is, with no instance moved. For the move to 5.x, which runs MediaWiki 1.47 on Docker Compose only, these stop it: a Kubernetes instance; the Interwiki or Lingo extension enabled or loaded, which the 1.47 image does not ship; an enabled extension in the instance's extensions directory whose requires.MediaWiki excludes 1.47; and php8.2 packages or /etc/php/8.2 in docker-compose.override.yml, config/sidecars.yaml, a Dockerfile in the instance directory or an image build argument. Settings that MediaWiki 1.44 removed, CANASTA_ELASTICSEARCH_IMAGE, an image built from source, and an extension that needs the legacy parser enabled without $wgUseParsoidParser = false are named for a look before the move. 1.47 parses pages with Parsoid by default, which NumerAlpha, Semantic Drilldown and Semantic MediaWiki do not fully work with. --dry-run --allow-major runs the checks of the installed version and changes nothing.

Once nothing stops the move, every instance is backed up with canasta backup create, tagged before-<major>.x, and the CLI moves only if every backup succeeds. An instance with no backup repository (RESTIC_REPOSITORY) therefore stops the move too. Pass --skip-backup when the instances are backed up already. To go back, put the CLI back on the earlier release and restore that snapshot with canasta backup restore -s <snapshot>, which returns the instance to the image and database it had before the move.

Pass --purge to reclaim disk after the upgrade: each upgraded host has the Canasta images the upgrade superseded removed (never one an instance on that host is pinned to, running or stopped), dangling sidecar-rebuild layers pruned, and — on Kubernetes — the in-cluster registry garbage-collected. Volumes are never touched. canasta image prune runs the same reclaim on one host without upgrading anything.

canasta upgrade [flags]

Examples

canasta upgrade
canasta upgrade --allow-major
canasta upgrade --dev
canasta upgrade --dry-run
canasta upgrade --purge

Flags

Flag Shorthand Description Default Required Orchestrator
--allow-major Allow upgrading across a major version boundary to the latest release overall (may include breaking changes) Both
--dev Track the development branch (head of main) instead of the latest release Both
--dry-run Preview changes without applying, including the CLI's own update Both
--purge After upgrading, reclaim disk by removing images the upgrade superseded (never removes in-use images or volumes) Both
--skip-backup With --allow-major, move to a new major release without first backing up every instance Both

Global flags

Flag Shorthand Description Default Required Orchestrator
--help -h Show help message and exit Both
--verbose -v Enable verbose output Both