MediaWiki fundraising/REL1_35
|
Welcome to the MediaWiki community! Please see How to become a MediaWiki hacker for general information on contributing to MediaWiki.
MediaWiki provides an extendable local development environment based on Docker Compose.
The default environment provides PHP, Apache, XDebug and a SQLite database. (Do not run this stack in production! Bad things might happen!)
More documentation as well as example overrides and configuration recipes are available at mediawiki.org/wiki/MediaWiki-Docker.
Support is available on the Libera IRC network at #mediawiki
and on Wikimedia Phabricator at #MediaWiki-Docker.
You'll need a locally running Docker and Docker Compose:
Linux users
docker-compose
by downloading the binary release. You can also use pip
, your OS package manager, or even run it in a container, but downloading the binary release is the easiest method.Using a text editor, create a .env
file in the root of the MediaWiki core repository, and copy these contents into that file:
If you are on a Linux system, first create a
docker-compose.override.yml
containing the following:
Run the following command to add your user ID and group ID to your .env
file:
Start the environment:
Install Composer dependencies:
Install MediaWiki in the environment:
Remove or rename LocalSettings.php
, delete the cache/sqlite
directory, then re-run the installation command above. Copy over any changes from your previous LocalSettings.php
and then run maintenance/update.php
.
You can use docker-compose exec mediawiki bash
to open a bash shell in the MediaWiki container, or you can run commands in the container from your host, for example: docker-compose exec mediawiki php maintenance/update.php
Run all tests:
Run a single test:
See PHPUnit Testing on MediaWiki.org for more help.
You can use Fresh to run Selenium in a dedicated container. Example usage:
You can use Fresh to run API tests in a dedicated container. Example usage:
You can override the default services with a docker-compose.override.yml
file, and configure those overrides with changes to LocalSettings.php
.
Example overrides and configurations can be found at MediaWiki-Docker
After updating docker-compose.override.yml
, run docker-compose down
followed by docker-compose up -d
for changes to take effect.
If you need root on the container to install packages for troubleshooting, you can open a shell as root with docker-compose exec --user root mediawiki bash
.
Clone the skin to skins/Vector
:
Configure MediaWiki to use the skin:
You can override the XDebug configuration included with the default image by passing XDEBUG_CONFIG={your config}
in the .env
file at the root of the MediaWiki repository:
If you installed php-fpm on your host, that is listening on port 9000 and will conflict with XDebug. The workaround is to tell your IDE to listen on a different port (e.g. 9009) and to set the configuration in your .env
file: XDEBUG_CONFIG=remote_port=9009
The image uses host.docker.internal
as the remote_host
value which should work for Docker for Mac/Windows. On Linux hosts, you need to specify the hostname or IP address of your host. The IP address works more reliably. You can obtain it by running e.g. ip -4 addr show docker0
and copying the IP address into the config, like XDEBUG_CONFIG=remote_host=172.17.0.1
Switching on the remote log for XDebug comes at a performance cost so only use it while troubleshooting. You can enable it like so: XDEBUG_CONFIG=remote_log=/tmp/xdebug.log