MediaWiki-Docker/Extension/WikiLambda

Follow the Quickstart instructions at MediaWiki-Docker, then follow along with. MediaWiki should now be running at.

Adding the extension
You can add the WikiLambda extension as follows:

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

Adding the services
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. 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 editing your local copy of  to remove , and running the PHPUnit test suite as described in the MediaWiki install instructions.

You can now 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. Two examples are given for the ApiSandbox with action  here – "[http://localhost:8080/wiki/Special:ApiSandbox#action=wikilambda_function_call&format=json&wikilambda_function_call_zobject=%7B%22Z1K1%22%3A%7B%22Z1K1%22%3A%22Z9%22%2C%22Z9K1%22%3A%22Z7%22%7D%2C%22Z7K1%22%3A%7B%22Z1K1%22%3A%7B%22Z1K1%22%3A%22Z9%22%2C%22Z9K1%22%3A%22Z8%22%7D%2C%22Z8K1%22%3A%7B%22Z1K1%22%3A%7B%22Z1K1%22%3A%22Z9%22%2C%22Z9K1%22%3A%22Z10%22%7D%2C%22Z10K1%22%3A%7B%22Z1K1%22%3A%7B%22Z1K1%22%3A%22Z9%22%2C%22Z9K1%22%3A%22Z17%22%7D%2C%22Z17K1%22%3A%7B%22Z1K1%22%3A%22Z9%22%2C%22Z9K1%22%3A%22Z40%22%7D%2C%22Z17K2%22%3A%7B%22Z1K1%22%3A%22Z6%22%2C%22Z6K1%22%3A%22Z902K1%22%7D%2C%22Z17K3%22%3A%7B%22Z1K1%22%3A%7B%22Z1K1%22%3A%22Z9%22%2C%22Z9K1%22%3A%22Z12%22%7D%2C%22Z12K1%22%3A%7B%22Z1K1%22%3A%7B%22Z1K1%22%3A%22Z9%22%2C%22Z9K1%22%3A%22Z10%22%7D%7D%7D%7D%2C%22Z10K2%22%3A%7B%22Z1K1%22%3A%7B%22Z1K1%22%3A%22Z9%22%2C%22Z9K1%22%3A%22Z10%22%7D%2C%22Z10K1%22%3A%7B%22Z1K1%22%3A%7B%22Z1K1%22%3A%22Z9%22%2C%22Z9K1%22%3A%22Z17%22%7D%2C%22Z17K1%22%3A%7B%22Z1K1%22%3A%22Z9%22%2C%22Z9K1%22%3A%22Z1%22%7D%2C%22Z17K2%22%3A%7B%22Z1K1%22%3A%22Z6%22%2C%22Z6K1%22%3A%22Z902K2%22%7D%2C%22Z17K3%22%3A%7B%22Z1K1%22%3A%7B%22Z1K1%22%3A%22Z9%22%2C%22Z9K1%22%3A%22Z12%22%7D%2C%22Z12K1%22%3A%7B%22Z1K1%22%3A%7B%22Z1K1%22%3A%22Z9%22%2C%22Z9K1%22%3A%22Z10%22%7D%7D%7D%7D%2C%22Z10K2%22%3A%7B%22Z1K1%22%3A%7B%22Z1K1%22%3A%22Z9%22%2C%22Z9K1%22%3A%22Z10%22%7D%2C%22Z10K1%22%3A%7B%22Z1K1%22%3A%7B%22Z1K1%22%3A%22Z9%22%2C%22Z9K1%22%3A%22Z17%22%7D%2C%22Z17K1%22%3A%7B%22Z1K1%22%3A%22Z9%22%2C%22Z9K1%22%3A%22Z1%22%7D%2C%22Z17K2%22%3A%7B%22Z1K1%22%3A%22Z6%22%2C%22Z6K1%22%3A%22Z902K3%22%7D%2C%22Z17K3%22%3A%7B%22Z1K1%22%3A%7B%22Z1K1%22%3A%22Z9%22%2C%22Z9K1%22%3A%22Z12%22%7D%2C%22Z12K1%22%3A%7B%22Z1K1%22%3A%7B%22Z1K1%22%3A%22Z9%22%2C%22Z9K1%22%3A%22Z10%22%7D%7D%7D%7D%2C%22Z10K2%22%3A%7B%22Z1K1%22%3A%7B%22Z1K1%22%3A%22Z9%22%2C%22Z9K1%22%3A%22Z10%22%7D%7D%7D%7D%7D%2C%22Z8K2%22%3A%7B%22Z1K1%22%3A%22Z9%22%2C%22Z9K1%22%3A%22Z1%22%7D%2C%22Z8K3%22%3A%7B%22Z1K1%22%3A%7B%22Z1K1%22%3A%22Z9%22%2C%22Z9K1%22%3A%22Z10%22%7D%7D%2C%22Z8K5%22%3A%7B%22Z1K1%22%3A%22Z9%22%2C%22Z9K1%22%3A%22Z902%22%7D%7D%2C%22Z902K1%22%3A%7B%22Z1K1%22%3A%7B%22Z1K1%22%3A%22Z9%22%2C%22Z9K1%22%3A%22Z40%22%7D%2C%22Z40K1%22%3A%7B%22Z1K1%22%3A%22Z6%22%2C%22Z6K1%22%3A%22Z42%22%7D%7D%2C%22Z902K2%22%3A%7B%22Z1K1%22%3A%7B%22Z1K1%22%3A%22Z9%22%2C%22Z9K1%22%3A%22Z10%22%7D%2C%22Z10K1%22%3A%7B%22Z1K1%22%3A%22Z6%22%2C%22Z6K1%22%3A%22arbitraryZObject%22%7D%2C%22Z10K2%22%3A%7B%22Z1K1%22%3A%7B%22Z1K1%22%3A%22Z9%22%2C%22Z9K1%22%3A%22Z10%22%7D%7D%7D%2C%22Z902K3%22%3A%7B%22Z1K1%22%3A%7B%22Z1K1%22%3A%22Z9%22%2C%22Z9K1%22%3A%22Z40%22%7D%2C%22Z40K1%22%3A%7B%22Z1K1%22%3A%22Z6%22%2C%22Z6K1%22%3A%22Z42%22%7D%7D%7D Invoke Z802 (If) with false predicate]" makes a call using the built-in function If (Z802), and "[http://localhost:8080/wiki/Special:ApiSandbox#action=wikilambda_function_call&format=json&wikilambda_function_call_zobject=%7B%22Z1K1%22%3A%7B%22Z1K1%22%3A%22Z9%22%2C%22Z9K1%22%3A%22Z7%22%7D%2C%22Z7K1%22%3A%7B%22Z1K1%22%3A%7B%22Z1K1%22%3A%22Z9%22%2C%22Z9K1%22%3A%22Z8%22%7D%2C%22Z8K1%22%3A%7B%22Z1K1%22%3A%7B%22Z1K1%22%3A%22Z9%22%2C%22Z9K1%22%3A%22Z10%22%7D%2C%22Z10K1%22%3A%7B%22Z1K1%22%3A%7B%22Z1K1%22%3A%22Z9%22%2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1%22%3A%22Z9%22%2C%22Z9K1%22%3A%22Z10%22%7D%2C%22Z10K1%22%3A%7B%22Z1K1%22%3A%7B%22Z1K1%22%3A%22Z9%22%2C%22Z9K1%22%3A%22Z14%22%7D%2C%22Z14K1%22%3A%7B%22Z1K1%22%3A%22Z9%22%2C%22Z9K1%22%3A%22Z1000%22%7D%2C%22Z14K2%22%3A%7B%22Z1K1%22%3A%22Z9%22%2C%22Z9K1%22%3A%22Z1000%22%7D%2C%22Z14K3%22%3A%7B%22Z1K1%22%3A%7B%22Z1K1%22%3A%22Z9%22%2C%22Z9K1%22%3A%22Z16%22%7D%2C%22Z16K1%22%3A%7B%22Z1K1%22%3A%7B%22Z1K1%22%3A%22Z9%22%2C%22Z9K1%22%3A%22Z61%22%7D%2C%22Z61K1%22%3A%7B%22Z1K1%22%3A%22Z6%22%2C%22Z6K1%22%3A%22python-3%22%7D%7D%2C%22Z16K2%22%3A%7B%22Z1K1%22%3A%22Z6%22%2C%22Z6K1%22%3A%22Z1000K0%3Dstr(int(Z1000K1)%2Bint(Z1000K2))%22%7D%7D%2C%22Z14K4%22%3A%7B%22Z1K1%22%3A%22Z6%22%2C%22Z6K1%22%3A%22Z1000%22%7D%7D%2C%22Z10K2%22%3A%7B%22Z1K1%22%3A%7B%22Z1K1%22%3A%22Z9%22%2C%22Z9K1%22%3A%22Z10%22%7D%7D%7D%2C%22Z8K5%22%3A%7B%22Z1K1%22%3A%22Z9%22%2C%22Z9K1%22%3A%22Z1000%22%7D%7D%2C%22Z1000K1%22%3A%7B%22Z1K1%22%3A%22Z6%22%2C%22Z6K1%22%3A%225%22%7D%2C%22Z1000K2%22%3A%7B%22Z1K1%22%3A%22Z6%22%2C%22Z6K1%22%3A%228%22%7D%7DInvoke&#x20;native&#x20;code Invoke native code]" which uses a user-defined python snippet to add two numbers.

🎉 Congratulations! 🎉

Having the services with different configuration
If you wish to use the orchestrator or evaluator under a different name or port, or your checkout of MediaWiki is not in a directory called ' ', you must over-ride the  or   configuration values from their defaults in your LocalSettings file.

For example, if you MediaWiki checkout is called ' ', you should add:

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) Install Blubber: https://wikitech.wikimedia.org/wiki/Blubber/Download#Blubber_as_a_(micro)Service
 * 2) Clone the service you wish to alter:
 * 3) (For the orchestrator):
 * 4) (For the evaluator):
 * 5) From the root of the service you wish to alter, run either:
 * 6) * (For the orchestrator):
 * 7) * (For the evaluator):
 * 8) Then update your   file to change the service stanza to point to your new local image, with   or.