Parsoid/JS/Setup

– If you are using the MediaWiki-Vagrant virtual machine, the  role sets up a working Parsoid.

Get the code
If you want to do an anonymous checkout: git clone https://gerrit.wikimedia.org/r/p/mediawiki/services/parsoid

Or if you plan to hack Parsoid, then please follow the Gerrit 'getting started' docs and use an authenticated checkout url instead, such as

git clone ssh:// @gerrit.wikimedia.org:29418/mediawiki/services/parsoid

First, you need to install node 0.8 or 0.10. On Debian and Ubuntu: For other systems, see http://nodejs.org/download/.

Next, install the JS dependencies. Run this command in the Parsoid directory:

Configuration
If you would like to point the Parsoid web service to your own wiki, go to the  directory and create a   file based on. Use  to point to the MediaWiki instance(s) you want to use. Currently Parsoid only supports public wikis, and private wikis using cookie forwarding.

Run the server
You should be able to run the Parsoid web service using:

node api/server.js

This will start the Parsoid HTTP service on port 8000. To test it, point your browser to http://localhost:8000/. If you configured the 'localhost' prefix correctly, you should be able to parse pages via http://localhost:8000/localhost/.

Starting the Parsoid service automatically
There are many ways to start services automatically, consult your server's operating system documentation.

On Ubuntu and other operating systems using Upstart, one approach is where /etc/init/parsoid.conf contains configuration similar to MediaWiki-Vagrant's :

On recent versions of Fedora and other operating systems using systemd, use a parsoid.service unit file similar to the following template (modify the file paths as appropriate): The optional  directive above can specify the path to a file similar to the following template:

See bug 53723 for packaging plans that should make the general installation easier.

Windows Setup
Parsoid has a nested dependency on a node module called contextify (parsoid → html5 → jsdom → contextify). Contextify has to compile something, and has external dependencies on Python and a C compiler. To install Parsoid on Windows:


 * 1) Install Git for Windows (pick Run Git from the Windows command prompt) http://git-scm.com/download/win
 * 2) Install Visual C++ 2010 Express (you can uncheck the SQL part) http://www.visualstudio.com/downloads/download-visual-studio-vs
 * 3) Install Python27 (not Python33) http://www.python.org/
 * 4) If you install Python27 to the default folder (c:\Python27), you will need to add this directory to the System Variable PATH. Go to Control Panel→Sysetm→Advanced system settings→Environment Variables...→PATH→Edit... and add ;c:\Python27 to the end of the current Variable value:.
 * 5) Install nodeJS x86 edition http://nodejs.org/download/

To test that everything will work, open a command prompt and run: npm install contextify If it fails the output will tell you if you tried build='x64' or if python was missing. If everything succeeds you can do the following (same as Linux install now): git clone https://gerrit.wikimedia.org/r/p/mediawiki/services/parsoid cd parsoid npm install

When the installation is complete, configure parsoid and run: node api\server.js

To run parsoid in the backgroud, create a cmd file in the parsoid directory called parsoid.cmd. Setup a scheduled task to run the task on startup. Alternatively several "run batch file as a service" commands exist on the internet. @echo off "%ProgramFiles(x86)\nodejs\node.exe" api\server.js

Troubleshooting
If things are still not working, then see our troubleshooting page.