Difference between revisions of "Parsoid installation"

From Biowikifarm Metawiki
Jump to: navigation, search
(document completely new installation process)
Line 1: Line 1:
see: http://www.mediawiki.org/wiki/Parsoid/Developer_Setup
+
On 2018-12-13 new versions of nodejs and parsoid were installed to finally get the VisualEditor to work. There were some difficulties installing them, which will be documented here for future references.  
 +
== Installing NodeJS ==
 +
Parsoid requires at least NodeJS 6.0 but the installation candidate for debian was still the previously installed 0.10.29
  
Check that nodejs is the right version:
+
According to the [https://www.mediawiki.org/wiki/Parsoid/Installing_Node installation guide] the following commands were required to install a newer version:
nodejs --version
+
  curl -sL https://deb.nodesource.com/setup_6.x | sudo bash -
It should be >0.10. If it's not do:
+
  sudo apt-get install -y nodejs
cd /usr/local/src/
+
  git clone https://github.com/joyent/node.git
+
  cd node
+
do "git tag" and select the latest version (here v0.12.3). Then build it:
+
git checkout v0.12.3
+
./configure
+
make
+
make install
+
(will install in /usr/local/lib, /usr/local/include)
+
  
Get the Parsoid service source:
+
This however didn't work, as it still wanted to install the old package. The trick was to give the new source priority over the default one, by creating a file <code>/etc/apt/preferences.d/nodejs</code> with the content
cd /usr/local/src/
+
  Package: *
  git clone https://gerrit.wikimedia.org/r/p/mediawiki/services/parsoid
+
Pin: origin deb.nodesource.com
 +
Pin-Priority: 1002
  
Install nodejs parsoid dependencies
+
Afterwards nodejs could be installed with the proper version
  cd /usr/local/src/parsoid
+
  sudo apt-get install -y nodejs
  npm install
+
  nodejs -v
 +
    v6.15.0
  
You can now [[Migrate_an_existing_Wiki_to_MediaWiki_1.26wmf5_and_Visual_Editor#Parsoid|configure parsoid]] to point to your wiki.
+
== Installin Parsoid ==
[[Category:Visual Editor]]
+
The following steps are the installation according to the [https://www.mediawiki.org/wiki/Parsoid/Setup#Ubuntu_/_Debian Parsoid Setup Guide]
 +
 
 +
sudo apt install dirmngr
 +
sudo apt-key advanced --keyserver keys.gnupg.net --recv-keys 90E9F83F22250DD7
 +
sudo apt-add-repository "deb https://releases.wikimedia.org/debian jessie-mediawiki main"
 +
sudo apt-get install software-properties-common
 +
echo "deb https://releases.wikimedia.org/debian jessie-mediawiki main" | sudo tee /etc/apt/sources.list.d/parsoid.list
 +
sudo apt install apt-transport-https
 +
sudo apt update && sudo apt install parsoid
 +
 
 +
This however did not work, as the package downloaded from the repository was damaged in the current version 0.10.0. An alternative was to install an older version of the package manually:
 +
wget https://people.wikimedia.org/~ssastry/parsoid/debs/parsoid_0.8.0all_all.deb
 +
sudo dpkg -i parsoid_0.8.0all_all.deb
 +
sudo apt-get install -f
 +
 
 +
This worked.
 +
 
 +
== Install VisualEditor Extension ==
 +
This was already installed in the version that fits the biowikifarm with its current version of 1.26. It had previously been installed via the [https://www.mediawiki.org/wiki/Special:ExtensionDistributor/VisualEditor Extension Distributor] and unzipped in <code>/usr/share/mediawiki26/extensions-rich-features</code>.
 +
 
 +
== Configuring Parsoid ==
 +
The parsoid configuration file is located at <code>/etc/mediawiki/parsoid/settings.js</code>. In order for a wiki to work with parsoid the wiki, the wiki API path has to be registered using a format like this:
 +
parsoidConfig.setMwApi({ uri: 'https://biowikifarm.net/metawiki/api.php', domain: 'metawiki' });
 +
 
 +
All of the working wikis from the [https://biowikifarm.net/metawiki/index.php?title=Member_wikis&oldid=6303  current version of the Member Wiki table] have been added. The section called "domain" is always identical to <code>$wgDBname</code>, as this allows for easy enabling of the VisualEditor in different wikis, by just adding one line.
 +
 
 +
If new wikis are added to the Biowikifarm in the future, they need to be added here as well, in order to work with the Visual Editor. After adding the corresponding line, parsoid needs to be restarted:
 +
sudo service parsoid restart

Revision as of 16:46, 13 December 2018

On 2018-12-13 new versions of nodejs and parsoid were installed to finally get the VisualEditor to work. There were some difficulties installing them, which will be documented here for future references.

Installing NodeJS

Parsoid requires at least NodeJS 6.0 but the installation candidate for debian was still the previously installed 0.10.29

According to the installation guide the following commands were required to install a newer version:

curl -sL https://deb.nodesource.com/setup_6.x | sudo bash -
sudo apt-get install -y nodejs

This however didn't work, as it still wanted to install the old package. The trick was to give the new source priority over the default one, by creating a file /etc/apt/preferences.d/nodejs with the content

Package: *
Pin: origin deb.nodesource.com
Pin-Priority: 1002

Afterwards nodejs could be installed with the proper version

sudo apt-get install -y nodejs
nodejs -v
    v6.15.0

Installin Parsoid

The following steps are the installation according to the Parsoid Setup Guide

sudo apt install dirmngr
sudo apt-key advanced --keyserver keys.gnupg.net --recv-keys 90E9F83F22250DD7
sudo apt-add-repository "deb https://releases.wikimedia.org/debian jessie-mediawiki main"
sudo apt-get install software-properties-common
echo "deb https://releases.wikimedia.org/debian jessie-mediawiki main" | sudo tee /etc/apt/sources.list.d/parsoid.list
sudo apt install apt-transport-https
sudo apt update && sudo apt install parsoid

This however did not work, as the package downloaded from the repository was damaged in the current version 0.10.0. An alternative was to install an older version of the package manually:

wget https://people.wikimedia.org/~ssastry/parsoid/debs/parsoid_0.8.0all_all.deb
sudo dpkg -i parsoid_0.8.0all_all.deb
sudo apt-get install -f

This worked.

Install VisualEditor Extension

This was already installed in the version that fits the biowikifarm with its current version of 1.26. It had previously been installed via the Extension Distributor and unzipped in /usr/share/mediawiki26/extensions-rich-features.

Configuring Parsoid

The parsoid configuration file is located at /etc/mediawiki/parsoid/settings.js. In order for a wiki to work with parsoid the wiki, the wiki API path has to be registered using a format like this:

parsoidConfig.setMwApi({ uri: 'https://biowikifarm.net/metawiki/api.php', domain: 'metawiki' }); 

All of the working wikis from the current version of the Member Wiki table have been added. The section called "domain" is always identical to $wgDBname, as this allows for easy enabling of the VisualEditor in different wikis, by just adding one line.

If new wikis are added to the Biowikifarm in the future, they need to be added here as well, in order to work with the Visual Editor. After adding the corresponding line, parsoid needs to be restarted:

sudo service parsoid restart