General concepts

From Canasta Wiki

This page covers foundational concepts that apply to all Canasta instances, whether hosting a single wiki or a wiki farm.

System requirements

The memory a Canasta instance needs depends on which optional services are enabled. On Docker Compose, canasta create measures total memory on the target host and fails early if it falls short:

Enabled Recommended host Preflight floor
Neither Elasticsearch nor observability 2 GiB 1600 MiB
Elasticsearch or observability 4 GiB 3500 MiB
Both 8 GiB 7000 MiB

The floors sit below the marketed size because a host reports less to the kernel after firmware and hypervisor reserves β€” a machine sold as 4 GiB typically reports 3700–3900 MiB β€” so 1600 / 3500 / 7000 accept a real 2 / 4 / 8 GiB host respectively.

The same check runs again when you turn a service on later: canasta config set CANASTA_ENABLE_ELASTICSEARCH=true (or CANASTA_ENABLE_OBSERVABILITY=true) re-evaluates the floor for the resulting combination and refuses if the host is too small, rather than letting the container start and get killed.

On Kubernetes the check is per node rather than per profile. At least one cluster node must have capacity for 3500 MiB of memory, 600m CPU, and 15 GiB of ephemeral storage β€” in practice a 4 GiB instance class or larger. The Compose numbers above do not transfer to node capacity.

For production use, 8 GB or more is recommended. Both Elasticsearch (for CirrusSearch) and the observability stack (OpenSearch + Logstash) are memory-intensive; with both enabled, 16 GB or more is recommended.

canasta create also performs a disk-space preflight on the host and fails early if there isn't enough free storage for container images and instance data, rather than failing partway through creation.

Instance IDs

Every Canasta instance (also referred to as a wiki farm, even if it contains only one wiki) has an instance ID β€” a name you choose when creating it with the -i flag:

canasta create -i myinstance -w main -n example.com

The instance ID is used to refer to the instance in subsequent commands:

canasta start -i myinstance
canasta extension list -i myinstance

Instance IDs must start and end with an alphanumeric character and may contain letters, digits, hyphens (-), and underscores (_).

Tip: The -i flag is only required for canasta create (since the instance directory doesn't exist yet). For all other commands, you can omit -i if you run the command from within the instance directory or any of its subdirectories. Examples on this wiki use the short form without -i.


Wiki IDs

Every wiki in a Canasta instance has a wiki ID β€” a short identifier set with the -w flag when creating or adding a wiki:

canasta create -i myinstance -w main -n example.com

Even a single-wiki instance requires a wiki ID. The wiki ID is used as:

  • The MariaDB database name for that wiki
  • The directory name under config/settings/wikis/
  • The suffix in the admin password file (admin-password_{wikiid})
  • The value passed to -w in commands like canasta extension, canasta remove, and canasta export

Wiki IDs may contain only alphanumeric characters and underscores. Hyphens are not allowed (unlike instance IDs). The names settings, images, w, wiki, and wikis are reserved. canasta create, add, remove, import, and export check the wiki ID against these rules before doing anything else. See Wiki ID naming rules for details.

Instance directory structure

After creating a Canasta instance, the directory contains:

{instance-path}/
β”œβ”€β”€ .env                           # Environment variables (domain, DB passwords, secret key)
β”œβ”€β”€ docker-compose.yml             # Docker Compose configuration
β”œβ”€β”€ docker-compose.override.yml    # Optional custom overrides
β”œβ”€β”€ docker-compose.edge.yml        # Generated: joins the HAProxy edge (do not edit)
β”œβ”€β”€ admin-password_{wiki-id}   # Generated admin password per wiki
β”œβ”€β”€ config/
β”‚   β”œβ”€β”€ wikis.yaml                 # Wiki definition (IDs, URLs, display names)
β”‚   β”œβ”€β”€ Caddyfile                  # Generated reverse proxy config (do not edit)
β”‚   β”œβ”€β”€ Caddyfile.site             # User customizations for Caddy site block
β”‚   β”œβ”€β”€ Caddyfile.global           # User global options and extra site blocks
β”‚   β”œβ”€β”€ haproxy-backend.cfg        # User HAProxy directives for this instance at the edge
β”‚   β”œβ”€β”€ edge-deny-cidrs.list       # Optional: addresses the edge refuses
β”‚   β”œβ”€β”€ edge-deny-user-agents.list # Optional: User-Agents the edge refuses
β”‚   └── settings/
β”‚       β”œβ”€β”€ global/                # PHP settings loaded for all wikis
β”‚       β”‚   └── *.php
β”‚       └── wikis/
β”‚           └── {wiki-id}/         # PHP settings loaded for a specific wiki
β”‚               └── *.php
β”œβ”€β”€ extensions/                    # User extensions
β”œβ”€β”€ skins/                         # User skins
β”œβ”€β”€ images/                        # Uploaded files
└── public_assets/                 # Publicly accessible files (logos, etc.)

conf.json

The CLI maintains a registry of all instances in a conf.json file. The location depends on the platform:

  • Linux (root): /etc/canasta/conf.json
  • Linux (non-root): ~/.config/canasta/conf.json
  • macOS: ~/Library/Application Support/canasta/conf.json

To override the default location, set the CANASTA_CONFIG_DIR environment variable. This takes priority over the platform defaults and is useful when multiple sysops need to share a single instance registry:

export CANASTA_CONFIG_DIR=/shared/canasta-config

The directory is created automatically if it does not exist.

Example:

{
    "Instances": {
        "myinstance": {
            "id": "myinstance",
            "path": "/home/user/myinstance",
            "orchestrator": "compose",
            "host": "localhost"
        },
        "remotewiki": {
            "id": "remotewiki",
            "path": "/opt/canasta/remotewiki",
            "orchestrator": "compose",
            "host": "ubuntu@prod1.example.com"
        }
    }
}

Each instance entry records the host where it lives (localhost or an SSH destination), so per-instance commands like canasta start -i myinstance automatically target the correct host without needing --host. See Help:Multi-host management for the multi-host workflow.

wikis.yaml

This file defines the wikis in the instance. Even a single-wiki instance has a wikis.yaml:

wikis:
- id: main
  url: example.com
  name: My Wiki

For a multi-wiki farm, it lists all wikis:

wikis:
- id: mainwiki
  url: example.com
  name: Main Wiki
- id: docs
  url: example.com/docs
  name: Documentation

The url field uses domain/path format without the protocol. The Caddyfile is regenerated from this file whenever wikis are added or removed.

Changing a wiki's display name

The name field in wikis.yaml controls the wiki's display name ($wgSitename in MediaWiki). It defaults to the wiki ID if not set. The name is initially set with the -t (--site-name) flag of canasta create or canasta add:

canasta create -i myinstance -w docs -n example.com -t "Project Documentation"

To change it later, edit the name field directly in config/wikis.yaml:

wikis:
- id: docs
  url: example.com/docs
  name: Project Documentation

The change takes effect immediately β€” no restart is needed.

Do not set $wgSitename in PHP settings files β€” it is configured automatically from wikis.yaml.

$wgMetaNamespace provides an alias for the Project namespace (the Project: prefix always works as well). It is derived from the display name with spaces replaced by underscores. For example, a wiki named "Project Documentation" will get the alias Project_Documentation:. If you need a different alias, you can override $wgMetaNamespace in a per-wiki settings file (use underscores instead of spaces).

Changing the domain name

The domain name is stored in config/wikis.yaml and the .env file (MW_SITE_SERVER, MW_SITE_FQDN). See Common tasks: Changing the domain name for step-by-step instructions for single wikis, path-based farms, and subdomain-based farms.

Caddyfile, Caddyfile.site, and Caddyfile.global

Canasta uses Caddy as each instance's reverse proxy. On Docker Compose, the host's HAProxy edge sits in front of it, terminating TLS and routing each hostname to its instance, and Caddy serves plain HTTP behind it. The config/Caddyfile is auto-generated from wikis.yaml and is overwritten whenever wikis are added or removed β€” do not edit it directly.

To add custom Caddy directives for the site block (headers, rewrites, etc.), edit config/Caddyfile.site. To add global Caddy options or additional site blocks (e.g., a www-to-non-www redirect), edit config/Caddyfile.global. Both files are imported by the generated Caddyfile and are never overwritten.

If you're coming from an Apache-based MediaWiki install, the Caddyfile.site and Caddyfile.global files take the place of the directives you'd put in .htaccess: rewrites, redirects, header rules, and other URL-handling logic.

Example Caddyfile.site:

header X-Frame-Options "SAMEORIGIN"
header X-Content-Type-Options "nosniff"

Example Caddyfile.global β€” redirect www.example.com to example.com so both domains reach the same wiki:

www.example.com {
    redir https://example.com{uri} permanent
}

The HAProxy edge routes a site block like this to the instance and gets it a certificate automatically; see Extra sites in Caddyfile.global.

See the Caddy documentation for available directives.

If deploying behind an external reverse proxy that handles SSL termination, see Common tasks: Deploying behind a reverse proxy.

Settings

Settings files are placed in the settings directories:

  • Global settings (config/settings/global/) β€” loaded for every wiki
  • Per-wiki settings (config/settings/wikis/{wiki-id}/) β€” loaded only for that wiki

This lets you configure shared behavior globally while customizing individual wikis where needed.

Loading order

Each settings directory can contain two types of files: YAML files and PHP files. Canasta loads them in the following order:

  1. YAML files (*.yaml) β€” loaded in lexicographic order via MediaWiki's SettingsBuilder::loadFile()
  2. PHP files (*.php) β€” loaded in lexicographic order via require_once

Global settings are loaded first, followed by per-wiki settings for the current wiki. Within each directory, the YAML-then-PHP order applies.

Both formats are valid ways to add settings. PHP files are useful for settings that require logic, function calls (such as enableSemantics()), or conditional expressions that YAML cannot represent. The YAML format supports extensions, skins, and configuration settings:

extensions:
- MyExtension
skins:
- MySkin

Since all settings files live in the mounted config/ volume, they persist across container restarts. Changes take effect on the next page load β€” no restart is required.

Note: YAML settings file loading relies on MediaWiki's SettingsBuilder API, which is still marked as unstable and may change in future MediaWiki versions. If the API changes, Canasta will be updated to match. PHP settings files are not affected by this and will always work.

Passwords

  • Admin passwords are saved to admin-password_{wikiid} β€” one file per wiki
  • Database passwords are saved to the .env file: MYSQL_PASSWORD for the database administrator (root on the bundled database), and WIKI_DB_PASSWORD for the account MediaWiki connects with (WIKI_DB_USER, mediawiki as of Canasta CLI 4.22.0 on Docker Compose and 4.25.2 on Kubernetes). See Database accounts.

If not specified at creation time, passwords are auto-generated (30 characters with digits and symbols).

The Canasta stack

A Canasta instance is built from two Docker images and the CLI. Both images are built from the Canasta repository and share one version number; the CLI is versioned and released separately:

  • CanastaBase (actual image name canasta-base) β€” the base Docker image, built from the repository's top-level Dockerfile. It contains the MediaWiki core software, Debian Linux, Apache and PHP, and the ~40 extensions and skins bundled with MediaWiki by default. The database, search, cache and proxy services are not in the images; they run as separate containers (see Containers). When new Long Term Support (LTS) versions of MediaWiki are released, they are delivered through a new Canasta version.
  • Canasta (actual image name canasta) β€” a Docker image built from Dockerfile.canasta, a thin layer on top of CanastaBase adding over 130 more extensions and skins.
  • Canasta CLI β€” the command-line tool that manages instances with support for both Docker Compose and Kubernetes orchestrators. The CLI version is independent of the Docker image version; canasta version shows both the image version and CLI version.

Running canasta upgrade moves an instance to the Canasta version the CLI targets.

Extension and skin versions

Canasta bundles over 170 extensions and skins. The specific version (commit) of each extension is determined by the Recommended Revisions project β€” a community-maintained set of YAML files that list the recommended revision of each extension for each MediaWiki LTS version.

Canasta's extensions-skins.yaml file inherits from Recommended Revisions, pinning each extension to a tested commit. This ensures that all bundled extensions are compatible with the MediaWiki version in the image. When building a custom image, you can override or extend extensions-skins.yaml to add, remove, or pin extensions differently.

Custom Canasta images

By default, canasta create uses the Canasta version that the CLI was built for, ghcr.io/canastawiki/canasta:<version>, where <version> is the target Canasta version that canasta version shows. Each CLI release pins a specific image version to ensure compatibility. The CLI depends on that image's behavior, so another image is for testing, such as trying a new Canasta release before a CLI release targets it, or for an image derived from the targeted version, such as one with an extra package installed. You can override the image with the --canasta-image or --build-from flags, or by setting CANASTA_IMAGE with canasta config set.

When to use a custom image

Scenario Flag Example
Test a published Canasta version before a CLI release targets it --canasta-image --canasta-image ghcr.io/canastawiki/canasta:3.5.1
Use an image derived from the targeted version, from your own registry --canasta-image --canasta-image registry.example.com/canasta:v1.2.3
Test local changes to Canasta --build-from --build-from ~/canasta-repos
Run MediaWiki core without the bundled extensions and skins --canasta-base --canasta-base

--canasta-image

Specifies a full image reference to use instead of the default:

canasta create -i myinstance -w mywiki -n example.com\
  --canasta-image ghcr.io/canastawiki/canasta:3.5.1

This writes CANASTA_IMAGE to the instance's .env file so the stack uses the specified image.

--canasta-base

Runs the canasta-base image instead of canasta: MediaWiki core and the extensions and skins bundled with MediaWiki, without the ones Canasta adds.

canasta create -i myinstance -w mywiki -n example.com --canasta-base

On its own, it uses the canasta-base release that matches the CLI's target Canasta version, ghcr.io/canastawiki/canasta-base:<version>, and canasta upgrade moves it to each new release, as it does for canasta. With --build-from, only canasta-base is built from the source directory, and every canasta upgrade rebuilds it the same way. canasta info shows such an instance as "canasta-base built from source".

--build-from

Builds the Canasta images from local source. The directory must contain Canasta/. A Canasta checkout that has Dockerfile.canasta builds both canasta-base and canasta. With a checkout that does not, a CanastaBase/ checkout of the archived CanastaBase repository beside it, if present, is built first and used as the base image. See Development mode: Building from local source for details.

--canasta-image is mutually exclusive with both --build-from and --canasta-base, since each of those chooses the image itself.

Orchestrator differences

Docker Compose: Both --canasta-image and --build-from work directly. Docker pulls or builds the image locally, and the Compose stack uses it.

Kubernetes: --canasta-image works as long as the image is pullable from the cluster (i.e., it's in a public registry or one the cluster has credentials for). --build-from needs no registry configuration: the CLI automatically stands up an in-cluster registry, pushes the built image there, and configures every node to pull from it β€” so it works on single- and multi-node clusters out of the box.

Caveats

  • Upgrades are affected. When CANASTA_IMAGE is an official version tag (ghcr.io/canastawiki/canasta: or, from 3.6.0, ghcr.io/canastawiki/canasta-base:, followed by a version number), canasta upgrade moves it to the version the new CLI release targets, keeping the image it names, and reports the change. A canasta-base tag from the older 1.x CanastaBase line is left as it is. Any other image, such as one from your own registry or a tag like latest, is left as it is, and keeping it compatible with the CLI is up to you. To return to the default image, set CANASTA_IMAGE to the image the CLI targets, canasta config set -i myinstance CANASTA_IMAGE=ghcr.io/canastawiki/canasta:<version>, where <version> is the target Canasta version canasta version shows; later upgrades then move it with each release. Unsetting CANASTA_IMAGE does not change the image on Kubernetes. An instance created with --build-from stays built from source; see Development mode: Switching back to upstream images.
  • MediaWiki version changes. If the custom image uses a different MediaWiki version than the previous image, update.php runs automatically on the next container start to apply database schema changes.
  • Compatibility. Custom images should be based on canasta-base, and on the Canasta version the CLI targets, to ensure the expected directory structure, entry scripts, and configuration mechanisms are present. Using an unrelated or older image will likely not work.

Containers

A Canasta instance runs several Docker containers. Some are always present; others are optional and can be enabled or disabled.

Required containers

  • web β€” the main container running Apache, PHP, and MediaWiki. This is where all wiki requests are handled.
  • db β€” MariaDB database server. Stores all wiki content, user accounts, and metadata. Optional: when an external database is configured at create time, the bundled db container is not started and MediaWiki connects to your external server instead.
  • caddy: Caddy reverse proxy. Handles the instance's incoming HTTP traffic and URL routing for wiki farms. On Docker Compose it serves plain HTTP behind the host's HAProxy edge, which terminates TLS and holds the certificates. Configuration is managed via config/Caddyfile (auto-generated) and config/Caddyfile.site / config/Caddyfile.global (user-editable).

Optional containers

  • varnish β€” Varnish HTTP cache, sitting between Caddy and the web container. Caches anonymous page views to reduce load on MediaWiki. Enabled by default. To disable:
canasta config set CANASTA_ENABLE_VARNISH=false
  • elasticsearch β€” powers the CirrusSearch extension for full-text search. Disabled by default; enable with canasta config set CANASTA_ENABLE_ELASTICSEARCH=true.
  • redis β€” Redis, a main object cache shared by the web server and maintenance scripts. Disabled by default; see Object cache.
  • opensearch and logstash β€” the observability stack. OpenSearch stores logs and Logstash ingests them. Disabled by default; see the Observability guide for setup.

Host-wide containers

On Docker Compose, the instances on a host share the HAProxy edge: canasta-edge (HAProxy, on the instances' ports) and canasta-edge-acme (Let's Encrypt certificates). They belong to no single instance; the first instance on the host starts them, and they stop when the last one is deleted.

The optional containers are memory-intensive. See System requirements for guidance on how much memory to allocate.