Parsoid

< Setup:Installation Manual‎ | Services and system configuration

The installation of Parsoid requires the installation of Node.js.

The installation can be verified by

$ nodejs --version
$ node -v
$ npm -v

Installation and Configuration

Linux

Install Parsoid

There is no installation from package sources of the distribution. Parsoid is installed under /usr/local.

For this we move to

$ cd /usr/local

Getting Parsoid:

$ git clone --depth 1 --branch v0.10.0 https://gerrit.wikimedia.org/r/p/mediawiki/services/parsoid parsoid

Installing Parsoid:

$ cd parsoid
$ npm install

Checking the installation:

$ npm test

Default configuration:

$ cp config.example.yaml config.yaml

Configuring Parsoid

Opening the file config.yaml:

$ vi /usr/local/parsoid/config.yaml

For the basic installation of Parsoid it is sufficient to adjust the URL to the MediaWiki api (uri:) and the domain (domain:). We strongly recommend never to work with "localhost" but with the actual vhost alias, with which the MediaWiki can also be reached from outside. This avoids additional Apache configurations.

Hint.jpg
When using the alias, it is essential to store it with a loopback IP (127.0.0.1) in /etc/hosts! Please also make sure that the web server does not bind to the external IP.

Start Parsoid manually

Parsoid can be started manually with console output:

$ npm start

Start Parsoid as Daemon

There are several ways to do this. Most likely pm2 is the best choice, because it combines several applications/services in nodejs.

Installation of pm2:

$ npm install -g pm2

Starting Parsoid as Daemon via pm2:

$ pm2 start /usr/local/parsoid/bin/server.js

Save the pm2 process list - this will add Parsoid to the pm2 services:

$ pm2 save

pm2 in den System-Autostart legen:

# Render startup-script for a specific platform, the [platform] could be one of:
#   ubuntu|centos|redhat|gentoo|systemd|darwin|amazon
$ pm2 startup [platform]

Windows

Open a console with administrator permissions and change to the installation directory of Node.js (if you followed our recommendations for the folder structure under Windows \bluespice\bin\nodejs). Execute the command npm install parsoid there.

The configuration of Parsoid under Windows is almost identical to Parsoid under Linux. In this manual, however, there is a distinction between the corresponding articles due to the different paths in the file system. Here, too, we adhere to the above folder structure and assume the paths in this documentation accordingly.

Creating the configuration file

Create the file \bluespice\etc\parsoid.yaml. Copy the following content into it:

worker_heartbeat_timeout: 300000

logging:
    level: info

services:
  # Enter the absolute path of the index.js in "module".
  # in the subfolder "lib" of the parsoid module of nodejs
  # The first "/" represents the top level of your drive.
  # Don't user "\" but "/"
  - module: /bluespice/bin/nodejs/node_modules/parsoid/lib/index.js
    entrypoint: apiServiceWorker
    conf:
        mwApis:
        # For "uri", enter the URL where you want the api.php of your MediaWiki  
        # installation. This must not be a public address, you can use it with
        # "localhost", provided that your web server is configured accordingly.
        - uri: 'http://localhost/api.php'
          domain: 'bluespice'

The two relevant changes that you have to adjust yourself ("module" and "uri") are explained in the corresponding comment above.

Save and close the file.

Activating VisualEditor in BlueSpice

Change to the directory <installpath-bluespice>/settings.d. Open the files

020-BlueSpiceVisualEditorConnector.php and

020-VisualEditor.php

in a text editor.

In the second line you will find a code that deactivates both extensions:

return; // Disabled. Needs Parsoid

Add a comment character (#) to the beginning of this line or delete this line completely, save the two files and exit them again.

Now open a command line and change to the folder <installpath-bluespice>. Execute the following command there:

php maintenance/update.php (Linux)
php maintenance\update.php (Windows))
Hint.jpg
On Windows, make sure that the environment variables are set correctly to access the php command.
Hint.jpg
Note that under Linux, after you run update.php, you must re-customize the file system permisisons.

As soon as the script is completed with the message "Done", the VisualEditor is successfully activated.

Attachments

Discussions