mediawiki-docker-dev in mwcli
The original mediawiki-docker-dev environment was created by accident and without much design back in 2017.
In 2020 I started working on a new branch with some intentional design and quite liked the direction.
And now finally, the all of the mediawiki-docker-dev functionality exists in a new home, with more intentional design, tests, stability, releases and more.
I’ve already written a brief history of the tool in a previous post so now I’ll focus on what mediawiki-docker-dev looks like in the mwcli environment for the current version 0.8.0.
The docker / dev commands
docker command, which by default will have a
dev alias, is the entry point to this docker based development environment.
It lists a few high level commands, as well as all of the services that are by default provided by the environment.
custom– interacts with a custom docker-compose file that you may want to provide (similar to docker-compose.overrides)
docker-compose– passes commands straight through to the correct docker-compose context, allowing raw command execution
env– modify the environment variables that make up part of the environment
hosts– automatic modification or building of a hosts file to use locally if needed
destroy– deletes all containers and volumes
resume– restart suspended containers
suspend– suspend containers
where– lets you know where the docker-compose files actually are
The services are quire self explanatory so I won’t dive into detail here.
Each service set
Each set of services is backed by a docker-compose file of the same name, including, the custom set. And each set of services comes with a few default commands.
- create – creates containers related to the set of services
- destroy – destroys the containers and any persistence
- exec – execute a command in the main container (including bash)
- suspend – temporarily suspend the containers
- resume – resume suspended containers
Some service sets will have additional commands. For example redis also has a dedicated
cli command that will run
The MediaWiki service set includes commands for
quibble. These run Wikimedia managed images and services with the MediaWiki code you are developing from mounted. These extra containers also have access to the same MediaWiki services and network. So you can for example use
fresh to run browser tests against your development wikis.
Exposed web services
Many of the services contained within the development environment are web services, such as MediaWiki, Adminer and more. These are all exposed at subdomains of localhost for ease of access through modern browsers. An additional
hosts command exists to help you update your
/etc/hosts file for older browsers of command line tools that do not resolve localhost domains automatically.
Right now you’ll find the current web services are as follows…
Entry level guide
The development environment is intended to to be flexible. Both easy to get to grips with for new users, with a simple wizard and built in documentation. But also flexible allowing advanced users to add custom services, use custom images for existing services and alter all needed settings.
The initial wizard will guide you through the process of locating, and downloading if needed, your MediaWiki code. Choosing a port to expose the services on, using a composer cache in images, and more.
The MediaWiki install process is also currently abstracted behind a command (though you can run install.php manually if you want). This abstracted command will ensure the needed
LocalSettings.php is in place, run a
composer update or
install if needed. And then run
Multiple databases are supported, and multiple wikis can be installed and running at once. If you create the mysql service set, the same sequence of commands can be used to create more wikis, just use different options!
This project is still a work in progress and a collaboration between the Wikimedia Release Engineering team and me. You can find the current documentation on mediawiki.org, git repository on the Wikimedia GitLab install and task tracker on the Wikimedia Phabricator instance. You can read more about the CI setup for the repository in my previous post.
The mwcli tool currently includes more functionality, such as basic Gerrit integration, a GitLab CLI, Codesearch ability and ToolHub querying. I’ll be following up on that functionality in a new blog post soon.