User:Chenhao178/report1

Background

Currently, Canasta offers a streamlined way to set up a feature-rich MediaWiki instance on virtually any server. However, it does not currently support running multiple wikis, or a wiki farm, within the same container. This project aims to fill this gap and provide the ability to run different wikis in the same container. The wikis could vary by directory , subdomain , or completely different domains.

In addition, this project intends to extend Canasta's command-line interface (CLI) to support wiki farm configuration. This would allow administrators to effortlessly create, manage, and delete individual wikis.

Implementation Approach

To simplify management and facilitate use, I've implemented a shared common setting that applies to all wikis. Alongside this commonality, each wiki is distinguished by its unique ID and has its own customized settings. This allows for the definition of unique skins, extensions and configurations for each wiki. In this way, multiple wikis can run independently in a single container.

For wikis under directories, I have scripted an automatic generator generatewikihtaccess.sh for .htaccess files to manage access permissions.

This PR introduced two new commands to the CLI for managing wiki farms: add and remove. Furthermore, we've updated the create command to directly create a wiki farm in a Canasta instance using a wikis.yaml file.

Importantly, our design philosophy in adding wiki farm support ensures the continuity of the original functionality. If you choose not to use the wiki farm related features, all other command operations will work as before. This makes the adoption of wiki farm features completely optional, allowing you to continue using the CLI in the way you're familiar with if desired.

Changes in CLI

add command

The add command is used to add a new wiki to a Canasta instance. The AddWiki function first checks whether the instance exists, and then it generates the farm settings for the instance. It also checks the running status of the instance, and verifies that a wiki with the specified name does not already exist.Upon validation of these prerequisites, the function proceeds to add the new wiki.

It takes the following parameters:

--wiki, -w: The name of the new wiki to be added.

--domain-name, -n: The domain name of the new wiki.

--path, -p: The path where the new wiki will be stored.

--id, -i: The ID of the Canasta instance where the new wiki will be added.

--orchestrator, -o: The orchestrator used for the installation, default is 'docker compose'.

--wiki-path, -d: The directory path of the new wiki.

remove command

The remove command is used to remove a wiki from a Canasta instance. The RemoveWiki function first checks whether the instance exists, generates farm settings for the instance, checks its running status, and verifies if the wiki exists. It then asks the user to confirm the removal, and if confirmed, it proceeds to remove the wiki, its corresponding database, and settings. Finally, it rewrites the Caddyfile, restarts the Canasta instance, and notifies the user about the successful removal.

The remove command accepts the following parameters:

--wiki, -w: The name of the wiki to be removed.

--path, -p: The path to the Canasta instance where the wiki is located.

--id, -i: The Canasta instance ID from which the wiki should be removed.

--orchestrator, -o: The orchestrator to use for the operation, with 'docker compose' as the default.

create command

The create command has been updated to accept a YAML file as input. This YAML file should contain all the information required to create a new wiki farm. However if you don't want to create a wiki farm it will still work as beforeThe function takes the following parameters:

--yamlfile, -f: The path of the initial wiki yaml file.

Next Steps

Moving forward, our main priority will be to optimize the architecture of Canasta to make it more conducive to supporting wiki farms. We plan to refine the internal structure, improve the schema, and potentially reframe certain components to ensure that Canasta can efficiently and effectively manage multiple wikis within a single container.

Your feedback and suggestions will be invaluable in this process, as we continue to improve and refine the system for better wiki farm support.