Contributing

From Canasta Wiki

Contributing

This guide covers the release workflow for the Canasta project, how the various repositories work together, and how to create your own Canasta-based distribution.

Repository overview

The Canasta project spans several repositories:

Repository Description
Canasta Both Docker images: canasta-base (MediaWiki, Apache, PHP, bundled extensions/skins, and maintenance scripts) from Dockerfile, and canasta (additional extensions/skins) from Dockerfile.canasta
Canasta-CLI python/Ansible command-line tool for managing Canasta instances
Canasta-Go Legacy Go implementation of the Canasta CLI (no longer maintained; archived)
CanastaBase Archived; the canasta-base image's source is now in the Canasta repository

The Docker image hierarchy is:

canasta-base (mediawiki + core extensions + skins + maintenance scripts)
  └── canasta (additional extensions/skins)

Caddy, Varnish, MariaDB, and Elasticsearch/OpenSearch run as separate containers alongside the Canasta web container — they are not part of the Canasta image.

Forking Canasta

There are various reasons you might want to fork Canasta to create your own Canasta-like MediaWiki distribution image. The most common reason is to change the default set of extensions and skins. If you find bugs or want to add generally useful features, please contribute patches to the main repositories instead.

Canasta separates generic MediaWiki-handling code (the canasta-base image) from the set of extensions and skins (the canasta image, which uses canasta-base as its base image). Both are built from the Canasta repository. A child image adds background tasks by placing shell scripts in /maintenance-scripts/: the container starts every *.sh file there in the background each time it starts. This lets a child image add functionality without changing canasta-base itself. The config/ directory, which holds MediaWiki settings, is not part of the image: it is each instance's own bind-mounted directory, managed with the CLI.

CLI compatibility: The CLI relies on specific behavior in the canasta-base image's scripts (maintenance routines, environment variable handling, etc.). If you want your custom image to work with the CLI, you must preserve that contract. To use a custom image with an existing CLI instance, set CANASTA_IMAGE in the instance's .env file to point to your image.

Changing the set of extensions and skins

To offer a different set of extensions and skins, you may only need to modify one file: extensions-skins.yaml, which lists the extensions and skins to install in a minimal format. The full syntax is defined in the Recommended Revisions documentation.

The inherits keyword makes it easy to base your set on another listing. You can use the Canasta extensions-skins.yaml as a starting point, adding entries for extensions and skins to include or using the remove keyword to exclude them.

Leaving an extension out needs no other change: no extension has scripts of its own in the image, and the startup handling for Semantic MediaWiki runs only when Semantic MediaWiki is installed. If you add an extension that needs a recurring background task, add a script for it to /maintenance-scripts/.

Modifying image internals

When making deeper changes to a Canasta-based image:

  • Never modify _sources/canasta/LocalSettings.php — this is reserved for fundamental changes needed to keep MediaWiki working on the Canasta stack.
  • Change CanastaDefaultSettings.php sparingly. It is the only image-level settings file, so a default that belongs in your image goes there, but upstream updates to Canasta may also change it, so you will need to reconcile any differences when updating your base image. Settings that belong to one wiki or instance go in that instance's config/settings/ directory instead.
  • Both LocalSettings.php and CanastaDefaultSettings.php live in _sources/canasta/ and are part of the canasta-base image.

Release workflow

A typical Canasta release involves changes across one or more repositories. The general flow is:

1. Merge changes into the Canasta code

Submit and merge pull requests to the Canasta repo.

2. CI builds on every master push

Every push to master triggers the CI workflow, which:

  1. Builds the canasta-base and canasta images for linux/amd64 and linux/arm64
  2. Pushes the mutable rolling tags: latest, <MW_MAJOR>-latest, <MW_VERSION>-latest, and <MW_VERSION>-<DATE>-<SHA>

3. Bump the VERSION file for a new release

Once all PRs for the release are merged into master, update the VERSION file in the Canasta repository to the new version number (e.g., 3.6.1) in a final PR. master accepts changes only through pull requests.

When the CI detects that the VERSION file changed in the push, it also pushes an immutable versioned tag (e.g., 3.6.1) for both images in the same build. This is the tag that CLI instances are pinned to — it is never overwritten by future builds.

4. Update the CLI default image tag

After the versioned image is published, update the CANASTA_VERSION file in the Canasta-CLI repository to match the new version (e.g., 3.6.1). The playbook reads this file at runtime and uses the value as the default image tag for new instances.

This ensures new instances created with canasta create use the new version. Existing instances keep whatever version is in their .env file until explicitly upgraded.

5. Release the CLI

Bump the VERSION file in the Canasta-CLI repository to trigger a new release. The VERSION file controls the CLI version number, which is independent of the Canasta version in CANASTA_VERSION. You can release new CLI versions without bumping the Canasta version, and vice versa.

Image tagging strategy

The Canasta Docker image uses several tag types:

Tag When published Mutable? Example
latest Every push to master Yes canasta:latest
<MW_MAJOR>-latest Every push to master Yes canasta:1.43-latest
<MW_VERSION>-latest Every push to master Yes canasta:1.43.1-latest
<MW_VERSION>-<DATE>-<SHA> Every push to master No canasta:1.43.1-20260224-abc1234
<CANASTA_VERSION> A push to master that changes VERSION No canasta:3.6.1
<MW_VERSION>-<DATE>-<PR> Pull requests No canasta:1.43.1-20260224-42

The CLI pins instances to the immutable <CANASTA_VERSION> tag (e.g., 3.6.1). This guarantees reproducible deployments — the image an instance uses does not change unless the user explicitly upgrades.

Updating the CLI default image

The default image tag is controlled by the CANASTA_VERSION file at the repository root. The Ansible playbook reads this file at runtime via lookup('file', …) and uses the value as the default image tag.

When canasta create runs, it writes CANASTA_IMAGE=ghcr.io/canastawiki/canasta:<tag> to the instance's .env file. The Compose and Kubernetes templates reference ${CANASTA_IMAGE} — once an instance is created, its image tag is pinned in the .env until you explicitly upgrade.

To update:

  1. Change CANASTA_VERSION to the new image version
  2. Submit a PR to Canasta-CLI
  3. After merging, bump VERSION if you want a new CLI release

Version files

The CLI uses two version files:

File Controls Example
VERSION CLI version number (triggers release when changed) 4.32.1
CANASTA_VERSION Default Canasta Docker image tag 3.6.1

These are independent — you can release CLI updates (bug fixes, new commands) without bumping the Canasta version, and update the pinned Canasta version without changing the CLI version.

Testing changes locally

To test changes to Canasta before they are published, use --build-from:

# Directory structure expected by --build-from:
# ~/canasta-repos/
#   └── Canasta/

canasta create -i test-instance -w mywiki -n localhost \
  --build-from ~/canasta-repos

This builds the image(s) locally and uses them for the instance. See Custom Canasta images and Development mode for details. To test changes to canasta-base without the extensions and skins in Dockerfile.canasta, add --canasta-base; see Building canasta-base alone.