MediaWiki-Docker/Extension/WikiLambda

This page instructs you to install Extension:WikiLambda inside MediaWiki-Docker.

Follow the Quickstart instructions at MediaWiki-Docker page. Once MediaWiki is running and available at, then continue with instructions on this page.

All commands should be run in the directory where you installed MediaWiki. All mentioned files are also located there.

Clone the repository and its sub-module, and its dependencies
Though you can use gerrit authenticating with ssh rather than https, it is recommended you get the code with an SSH key instead. Follow these instructions to do so.

Add our composer dependencies
Extend MediaWiki's composer dependencies to use ours by adding a  file in your   directory with the following: … and then run:

Modify LocalSettings.php
If not already there, add this to the end of.

Check that MediaWiki side is installed correctly
You can check whether this worked by navigating to, or to   and looking for   in the   dropdown. If they are there, all is well.

Setting up the back-end services
WikiLambda uses two back-end services for running user-defined and built-in functions in a secure, scalable environment; an "evaluator" that runs user-defined native code, and an "orchestrator" that recieves execution requests and determines what to run.

On install, the extension will try to use the orchestrator and evaluator services of the Beta Cluster version of Wikifunctions. This default configuration will let you do rudimentary tests with the built-in objects, but not with custom on-wiki content (as they are pointed at the content of Beta Wikifunctions).

To add the orchestrator and executor back-end services, first copy the contents of the  block in WikiLambda's   file to the analogous `services` block in your   file, including the   part. Replace the  entries in the stanza you just copied with the latest builds from the Docker registry for the orchestrator and the evaluator.

You can automatically test your installation by running the   PHPUnit test suite by using the following command (or as described in the MediaWiki install instructions if your setup is unusual):  You can manually evaluate a function call by navigating to ,  selecting a function from the wiki, and choosing your inputs. If successful, the function response will be presented, having traversed the orchestrator and the evaluator to be run in one of the code executors.

You can also visit http://localhost:8080/wiki/Special:ApiSandbox and try out one or more tests as follows:


 * In the  drop-down menu, select
 * Switch from the  to the   section on the left sidebar
 * Click on {} Examples, and select any of the listed examples
 * Click the blue  button
 * In the Results box, look for the word "success".

🎉 Congratulations! 🎉

Having the services with different configuration
If you wish to use the orchestrator under a different name or port, you must over-ride the  configuration value from its default (as set in  ). To override the orchestrator location variable, you should add in your  file:

If you wish to use the evaluator under a different name or port, you must change the docker compose environmental variable  environmental configuration value from its default which you copied from. To override the evaluator location environmental variables, you should change in your  file:

You can find out the exact container names by going to your MediaWiki installation directory and running.

Note that if your checkout of MediaWiki is not in a directory called ' ' you will need to set both of these, and also.

Building local versions of the services
If you would instead like to use a local version of the function orchestrator or evaluator, e.g. because you wish to make local development changes and test them, there are three steps:


 * 1) The compose command is now included in the docker CLI via docker-compose-plugin. If you are using docker-compose instead (now deprecated), ensure that you are using version 2.x or above (i.e., not 1.x). (If you have 1.x, you will need to upgrade, or, if using Docker Dashboard, you may be able to select a preference for "Use Composer v2".)
 * 2) Install Blubber: https://wikitech.wikimedia.org/wiki/Blubber/Download#Blubber_as_a_(micro)Service
 * 3) Clone the service you wish to alter:
 * 4) (For the orchestrator):
 * 5) (For the evaluator):
 * 6) From the root of the service you wish to alter, run either:
 * 7) * (For the orchestrator):
 * 8) * (For the evaluator):
 * 9) Then update your   file to change the service stanza to point to your new local image, with   or.