-
Notifications
You must be signed in to change notification settings - Fork 14
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add farm management support #88
Conversation
I like using add/remove for the commands (I can't come up with any better terms). As far as PHP file structure I'd say default to CommonSettings.php for the upper level with the expectation that for single-wiki 'farms' this file is a stub and ignored by admins. |
return err | ||
} | ||
|
||
fmt.Println("Successfully Added the Wiki '" + name + "in Canasta instance '" + instance.Id + "'...") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
shouldn't there be a space between name +"
and in Canasta
?
cmd/add/add.go
Outdated
} | ||
|
||
// addWiki accepts the Canasta instance ID, the name, domain and path of the new wiki, and the initial admin info, then creates a new wiki in the instance. | ||
func AddWiki(name, domain, wikipath, siteName, databasePath string, instance config.Installation) error { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is it possible for any of these params to be non-null but empty? If so, how is that handled?
} | ||
|
||
// addWiki accepts the Canasta instance ID, the name, domain and path of the new wiki, and the initial admin info, then creates a new wiki in the instance. | ||
func RemoveWiki(name string, instance config.Installation) error { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What happens if this is removing the last wiki in the Canasta instance?
@@ -27,13 +28,15 @@ func CloneStackRepo(orchestrator, canastaId string, path *string) error { | |||
*path += "/" + canastaId | |||
logging.Print(fmt.Sprintf("Cloning the %s stack repo to %s \n", orchestrator, *path)) | |||
repo := orchestrators.GetRepoLink(orchestrator) | |||
err := git.Clone(repo, *path) | |||
err := git.Cloneb(repo, *path, "CLI") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What is git.Cloneb
? Is it a typo or is it different than git.Clone
?
} | ||
|
||
func RewriteSettings(path string, WikiNames []string) error { | ||
for _, name := range WikiNames { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is name
always guaranteed to be nonempty?
Related Issue: #57
Background:
Our previous discussions have highlighted the need to provide more flexibility and efficiency in managing wiki farms in Canasta, which is a Docker-based MediaWiki distribution. The initial implementation included the ability to run multiple wikis (or a wiki farm) within a single container, which was a significant stride towards our project's goal. However, for even more user-friendly and effective management of wiki farms, the enhancement of Canasta's CLI became evident.
Summary
This PR introduces 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.
Table of Contents
Enhancements
create
Description: Creates a Canasta installation. Enhanced to support wiki farm setup with the
-f
flag.Usage:
sudo go run canasta.go create [flags]
-p, --path
: Canasta directory.-o, --orchestrator
: Orchestrator to use for installation (default: "docker-compose").-i, --id
: Canasta instance ID.-w, --wiki
: Name of the wiki.-n, --domain-name
: Domain name (default: "localhost").-a, --WikiSysop
: Initial wiki admin username.-s, --password
: Initial wiki admin password.-f, --yamlfile
: Initial wiki yaml file for wiki farm setup.-k, --keep-config
: Keep the config files on installation failure.YAML Format for Wiki Farm:
To create a wiki farm, you need to provide a YAML file with the following format:
sudo go run canasta.go create -f [yamlfile] # Example: "wikis.yaml
extension
Description: Manage Canasta extensions. Enhanced to target a specific wiki within the farm using the
-w
flag.Subcommands:
list
: Lists all the installed Canasta extensions.enable
: Enables specified extensions.disable
: Disables specified extensions.Usage:
sudo go run canasta.go extension [subcommand] [flags]
Flags:
-i, --id
: Specifies the Canasta instance ID.-p, --path
: Specifies the Canasta installation directory.-w, --wiki
: Specifies the ID of a specific wiki within the Canasta farm.-v, --verbose
: Enables verbose output.New Commands
add
Description: Adds a new wiki to a Canasta instance.
Usage:
sudo go run canasta.go add [flags]
Flags:
-w, --wiki
: ID of the new wiki.-u, --url
: URL of the new wiki.-s, --site-name
: Name of the new wiki site.-p, --path
: Path to the new wiki.-i, --id
: Canasta instance ID.-o, --orchestrator
: Orchestrator to use for installation (default: "docker-compose").-d, --database
: Path to the existing database dump.remove
Description: Removes a wiki from a Canasta instance.
Usage:
sudo go run canasta.go remove [flags]
Flags:
-w, --wiki
: ID of the wiki to be removed.-p, --path
: Path to the wiki.-i, --id
: Canasta instance ID.Docker-Compose Structure
Our current docker compose structure is as follows:
Each wiki's settings file is contained within a directory of their name under the config directory. These settings include a CommonSettings.php file.
Eache wiki's images are stored in their corresponding file under images/[WIKIID].
In the new version, we consider all Canasta instances as wiki farms, even if there is only one wiki in that instance.Therefore, manual imports of settings and images must be placed in the corresponding wiki ID's folder.
Version Migration
To make it more convenient for users to migrate to the new version, the new Canasta CLI will automatically detect when used, and then create configuration files such as YAML, images folder, etc. If the number of wikis in the farm is more than 1, then the LocalSettings.php will be renamed to CommonSettings.php.
Next Steps:
we will initiate server tests to evaluate the practicality and performance of these updates. Your support and collaboration in this testing phase will be crucial to ensure that our modifications not only align with technical specifications but also cater to real-world usage scenarios.