VisualEditor/Testing in user space without dæmons

From mediawiki.org

TL;DR[edit]

Run three servers in three different terminal windows:

  • Mediawiki on port 8888: cd src/mediawiki-core && php5 -S localhost:8888
  • Parsoid on port 8000: cd src/parsoid && node bin/server.js
  • Mediawiki on port 8889: cd src/mediawiki-core && php5 -S localhost:8889

Browse to the mediawiki instance on localhost:8888. It calls parsoid on localhost:8000 which calls mediawiki on localhost:8889. This is necessary because php5 -S is single-threaded.

Details[edit]

Install everything[edit]

apt-get install nodejs npm php5-cli php5-sqlite php5-curl
mkdir -p ~/src/mw-extensions
cd ~/src
git clone https://gerrit.wikimedia.org/r/mediawiki/core.git mediawiki-core
git clone https://gerrit.wikimedia.org/r/mediawiki/services/parsoid.git
cd ~/src/mw-extensions
git clone https://gerrit.wikimedia.org/r/mediawiki/extensions/VisualEditor.git
cd VisualEditor && git submodule update --init

You might want other extensions too, e.g.:

cd ~/src/mw-extensions
git clone https://gerrit.wikimedia.org/r/mediawiki/extensions/UniversalLanguageSelector.git

Set up MediaWiki[edit]

cd ~/src/mediawiki-core
php5 -S localhost:8888

Browse to http://localhost:8888/ and follow the install instructions to use sqlite and generate LocalSettings.php Append the following to src/mediawiki-core/LocalSettings.php:

require_once "$IP/extensions/UniversalLanguageSelector/UniversalLanguageSelector.php";
require_once "$IP/extensions/VisualEditor/VisualEditor.php";
$wgDefaultUserOptions['visualeditor-enable'] = 1;
$wgVirtualRestConfig['modules']['parsoid'] = array(
  // URL to the Parsoid instance
  // Use port 8142 if you use the Debian package
  'url' => 'http://localhost:8000',
  // Parsoid "domain", see below (optional)
  'domain' => 'localhost',
  // Parsoid "prefix", see below (optional)
  'prefix' => 'localhost'
);
$wgResourceLoaderDebug = true;

Set up Parsoid[edit]

Edit ~/src/parsoid/localsettings.js to ensure the following URI set:

parsoidConfig.setMwApi({
    // …
    uri: 'http://localhost:8889/w/api.php'
});

Execute[edit]

Then run the three servers as shown in the summary, and browse to localhost:8888.