Development

Canasta: Using Canasta > Manage wikis

This page documents the Canasta CLI commands for creating, importing, and managing wikis and wiki farms.

Table of contents

canasta create

Create a new Canasta installation.

Usage:

canasta create [flags]

Required flags:

Flag Short Description
--id -i Canasta instance ID (must be alphanumeric with optional hyphens/underscores)
--admin -a Initial wiki admin username (required unless --database is provided)

Optional flags:

Flag Short Default Description
--path -p Current directory Directory where the installation will be created
--orchestrator -o compose Orchestrator to use (currently only compose is supported)
--wiki -w ID of the wiki (required if --yamlfile is not provided)
--site-name -t Wiki ID Display name of the wiki
--domain-name -n localhost Domain name for the wiki
--password -s Auto-generated Initial wiki admin password
--yamlfile -f Path to a custom wikis.yaml file
--keep-config -k false Keep config files on installation failure
--override -r File to copy as docker-compose.override.yml
--rootdbpass Auto-generated Root database password
--wikidbuser root Wiki database username
--wikidbpass Auto-generated Wiki database password
--envfile -e Path to .env file with password overrides
--database -d Path to existing database dump (.sql or .sql.gz) to import instead of running install.php
--wiki-settings -l Path to per-wiki Settings.php to use instead of SettingsTemplate.php (only used with --database)
--global-settings -g Path to global settings file to copy to config/settings/ (filename preserved)
--dev -D false Enable development mode with Xdebug (see Development mode)
--dev-tag latest Canasta image tag to use (e.g., latest, dev-branch)
--build-from Build Canasta image from local source directory (expects Canasta/, optionally CanastaBase/ and Canasta-DockerCompose/)

Examples:

Create a basic wiki:

sudo canasta create -i mywiki -w main -n example.com -a admin

Create with custom admin password:

sudo canasta create -i mywiki -w main -n example.com -a admin -s "MySecurePassword123"

Create with custom database passwords (using environment variables to avoid shell history):

sudo canasta create -i mywiki -w main -n example.com -a admin \
  --rootdbpass "$ROOT_DB_PASS" --wikidbpass "$WIKI_DB_PASS"

Create with a custom wikis.yaml file:

sudo canasta create -i mywiki -a admin -f ./my-wikis.yaml

Create by importing an existing database:

sudo canasta create -i mywiki -w main -n example.com -d ./backup.sql.gz

Create by importing with a custom Settings.php:

sudo canasta create -i mywiki -w main -n example.com -d ./backup.sql.gz -l ./MySettings.php

Notes:


canasta add

Add a new wiki to an existing Canasta instance (wiki farm).

Usage:

canasta add [flags]

Required Flags:

Flag Short Description
--wiki -w ID of the new wiki
--url -u URL of the new wiki (domain/path format, e.g., 'localhost/wiki2')
--id -i Canasta instance ID
--admin -a Admin username for the new wiki (required unless --database is provided)

Optional Flags:

Flag Short Default Description
--site-name -t Wiki ID Display name of the wiki
--database -d Path to existing database dump (.sql or .sql.gz) to import instead of running install.php
--wiki-settings -l Path to per-wiki Settings.php to use instead of SettingsTemplate.php (only used with --database)
--password -s Auto-generated Admin password for the new wiki
--wikidbuser root Wiki database username

Examples:

Add a wiki at a subdomain:

sudo canasta add -i mywiki -w soccerwiki -u soccer.example.com -a admin

Add a wiki at a path:

sudo canasta add -i mywiki -w docs -u example.com/docs -t "Documentation Wiki" -a admin

Add a wiki by importing an existing database:

sudo canasta add -i mywiki -w imported -u example.com/imported -d ./backup.sql.gz

Add a wiki by importing with a custom Settings.php:

sudo canasta add -i mywiki -w imported -u example.com/imported -d ./backup.sql.gz -l ./MySettings.php

URL Format:


canasta export

Export the database of a wiki in a Canasta instance.

Usage:

canasta export [flags]

Required Flags:

Flag Short Description
--wiki -w ID of the wiki to export

Optional Flags:

Flag Short Default Description
--id -i Canasta instance ID
--file -f {wikiID}.sql Output file path

If the output filename ends in .gz, the export is automatically gzip-compressed.

Examples:

Export a wiki database:

sudo canasta export -i myfarm -w mainwiki

Export to a specific file:

sudo canasta export -i myfarm -w mainwiki -f ./backup.sql

Export with gzip compression:

sudo canasta export -i myfarm -w mainwiki -f ./backup.sql.gz

canasta import

Import a database dump into an existing wiki, replacing its current database. The containers are restarted after import.

Note: To create a new wiki from a database dump, use the --database flag with canasta create or canasta add instead.

Usage:

canasta import [flags]

Required Flags:

Flag Short Description
--wiki -w ID of the wiki to import into
--database -d Path to SQL dump file (.sql or .sql.gz)

Optional Flags:

Flag Short Default Description
--id -i Canasta instance ID
--wiki-settings -l Path to Settings.php to replace the existing one

Examples:

Import a database into an existing wiki:

sudo canasta import -i myfarm -w mainwiki -d ./backup.sql.gz

Import with a replacement Settings.php:

sudo canasta import -i myfarm -w mainwiki -d ./backup.sql.gz -l ./MySettings.php

canasta remove

Remove a wiki from a Canasta instance (wiki farm).

Usage:

canasta remove [flags]

Flags:

Flag Short Default Description
--wiki -w ID of the wiki to remove (required)
--id -i Canasta instance ID

Example:

sudo canasta remove -i mywiki -w soccerwiki

Warning: This command will delete the wiki and its corresponding database. You will be prompted for confirmation.


canasta delete

Delete an entire Canasta installation.

Usage:

canasta delete [flags]

Flags:

Flag Short Default Description
--id -i Canasta instance ID

Example:

sudo canasta delete -i mywiki

Warning: This command stops and removes all containers, volumes, and configuration files for the installation.


canasta list

List all Canasta installations managed by the CLI.

Usage:

canasta list

Example:

sudo canasta list

Example output:

Canasta ID  Wiki ID  Server Name  Server Path  Installation Path              Orchestrator
myfarm      wiki1    example.com  /            /home/user/myfarm              compose
myfarm      wiki2    example.com  /docs        /home/user/myfarm              compose
mywiki      main     localhost    /            /home/user/mywiki              compose

This displays all registered installations and wikis, showing:


Wiki farm example

This example demonstrates creating a wiki farm with multiple wikis using different URL schemes.

1. Create the initial installation with the first wiki:

sudo canasta create -i myfarm -w mainwiki -n example.com -a admin

2. Add a wiki using a path on the same domain:

sudo canasta add -i myfarm -w docs -u example.com/docs -t "Documentation Wiki" -a admin

3. Add a wiki using a subdomain:

sudo canasta add -i myfarm -w community -u community.example.com -a admin

4. View all wikis in the farm:

sudo canasta list

5. Manage extensions for a specific wiki:

sudo canasta extension enable SemanticMediaWiki -i myfarm -w docs

6. Remove a wiki from the farm:

sudo canasta remove -i myfarm -w community

Running on non-standard ports

By default, Canasta uses ports 80 (HTTP) and 443 (HTTPS). If you need to run on different ports (e.g., to run multiple Canasta installations on the same server), you must pass an env file with the port settings using the -e flag and include the port in the domain name with -n.

For an existing installation, edit .env to set the ports, update config/wikis.yaml to include the port in the URL, and restart:

HTTP_PORT=8080
HTTPS_PORT=8443
wikis:
- id: wiki1
  url: localhost:8443
  name: wiki1
sudo canasta restart -i myinstance

Example: Two wiki farms on the same server

To run two separate Canasta installations on the same server, the second installation must use different ports.

1. Create the first wiki farm (uses default ports 80/443):

sudo canasta create -i production -w mainwiki -n localhost -a admin
sudo canasta add -i production -w docs -u localhost/docs -a admin

2. Create an .env file for the second farm with non-standard ports:

Create a file called staging.env:

HTTP_PORT=8080
HTTPS_PORT=8443

3. Create the second wiki farm using the custom .env file and port in domain name:

sudo canasta create -i staging -w testwiki -n localhost:8443 -a admin -e staging.env

Now you can access: