MediaWiki-Docker

MediaWiki-Docker is a Docker based development environment included with MediaWiki core.

Example file
Below is a complete override file that provides a Redis and ElasticSearch containers, along with overriding the user mapping and the XDebug configuration for the app container.

Alternative databases
The default configuration uses SQLite for the database backend, but you can use MySQL or Postgres instead.

Use MySQL
These instruction assume a new installation (no LocalSettings.php).



To install the MediaWiki database tables, use:

Use Postgres
These instruction assume a new installation (no LocalSettings.php).



To install the MediaWiki database tables, use:

Disable XDebug for better performance
If you are not working on backend code or don't need to set breakpoints, you can use a Docker image that has XDebug disabled, which can boost performance.



Mail handling
You can capture outgoing email with MailHog. The mail interface is accessible at http://localhost:8025/





ElasticSearch





 * Setup commands

EventLogging





 * Setup commands


 * 1) Clone the Extension:EventLogging extension into
 * 2) You can tail the output to the   container with , or, pipe it to   with   or simply startup with   (no   flag).
 * 3) For client-side logging to work properly, you need to modify your system's  file with an entry that looks like this:

Ngrok
You can use ngrok to share your local site with others. After installing, run. Whatever URL is shown to you needs to be set in your.



Performance profiling with XHProf
You can use XHProf to profile requests.

TODO: Adapt something from https://github.com/perftools/xhgui/blob/master/docker-compose.yml



Redis
You can use Redis for performance gains or if you want to test using Redis as a cache backend.





VS Code
To debug PHP code in VS Code, do the following:


 * 1) In VS Code, install the PHP Debug extension
 * 2) Open the MediaWiki codebase in VS Code. Go to the Run tab (play button with a little bug), click "create a launch.json file" and select PHP as the environment. (If you already have a launch.json file, select "add configuration" from the dropdown.) The launch.json file should look something like this:
 * 1) The important things are 1)the "pathMappings" configuration is defined and 2) the port number corresponds to the the XDEBUG_CONFIG port number in your .env file (9000 by default)
 * 2) Set your Xdebug browser extension of choice to listen for the debugger. In the MediaWiki codebase, place a breakpoint in the PHP code you'd like to step through. Visit your local site in the browser and, if the breakpoint is placed on a line of code that's run, the debugger will pause on that line and allow you to step through the code.

Notes:
 * 1) If the debugger stops on errors or exceptions unexpectedly, in VS Code, uncheck "Everything" in the Breakpoints window within the Run tab.
 * 2) This won't work for extension codebases opened in VS Code; you must run the debugger from the MediaWiki core codebase (but you can place breakpoints in extension code there).