Jump to navigation Jump to search

Follow the Quickstart instructions at MediaWiki-Docker, then follow along with mediawiki/ MediaWiki should now be running at http://localhost:8080.

Adding the extension[edit]

You can add the WikiLambda extension as follows:

cd mediawiki

git clone ssh:// extensions/WikiLambda
echo "wfLoadExtension( 'WikiLambda' );" >> LocalSettings.php

docker-compose exec mediawiki php maintenance/update.php
docker-compose exec mediawiki php maintenance/update.php
docker-compose exec mediawiki php maintenance/update.php

You can check whether this worked by navigating to http://localhost:8080/wiki/Special:CreateZObject, or to http://localhost:8080/wiki/Special:ApiSandbox and looking for wikilambda_fetch in the action dropdown. If they are there, all is well.

Adding the services[edit]

To add the orchestrator and executor back-end services, first copy the contents of the services block in WikiLambda's docker-compose.sample.yml file to the analogous `services` block in your mediawiki/docker-compose.override.yml file. Replace the <TAG> 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 ApiFunctionCallTest.php to remove @group: Broken, and running the PHPUnit test suite as described in the MediaWiki install instructions.

You can now manually evaluate a function call by navigating to http://localhost:8080/wiki/Special:EvaluateFunctionCall, 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 wikilambda_function_call here – "Invoke Z802 (If) with false predicate" makes a call using the built-in function If (Z802), and "Invoke native code" which uses a user-defined python snippet to add two numbers.

🎉 Congratulations! 🎉

Special configurations[edit]

Having the services with different configuration[edit]

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 'mediawiki', you must over-ride the $wgWikiLambdaOrchestratorLocation or $wgWikiLambdaEvaluatorLocation configuration values from their defaults in your LocalSettings file.

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

$wgWikiLambdaOrchestratorLocation = 'core_function-orchestrator_1:6254';

Building local versions of the services[edit]

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:
  2. Clone the service you wish to alter:
    1. (For the orchestrator): git clone --recurse-submodules --remote-submodules ssh:// function-orchestrator
    2. (For the evaluator): git clone --recurse-submodules --remote-submodules ssh:// function-evaluator
  3. From the root of the service you wish to alter, run either:
    • (For the orchestrator): blubber .pipeline/blubber.yaml development | docker build -t local-orchestrator -f - .
    • (For the evaluator): blubber .pipeline/blubber.yaml development | docker build -t local-evaluator -f - .
  4. Then update your mediawiki/docker-compose.override.yml file to change the service stanza to point to your new local image, with image: local-orchestrator:latest or image: local-evaluator:latest.