Parsoid

From SME Server
Revision as of 05:54, 29 June 2017 by Unnilennium (talk | contribs) (→‎configure startup using deamontools)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search
Warning.png Work in Progress:
This page is a Work in Progress. The contents off this page may be in flux, please have a look at this page history the to see list of changes.


this how to is to install wikimedia parsoid server on a SME9

install

install epel repo

yum install nodejs npm vim-enhanced git policycoreutils-python --enablerepo=epel
cd ~

Download the latest Parsoid form the Git:

git clone https://gerrit.wikimedia.org/r/p/mediawiki/services/parsoid


Copy the Paroid to /opt:

cp -rv ~/parsoid /opt/


Go to /opt/parsoid/

cd /opt/parsoid/


Install Parsoid in node.js:

npm install


Create the file local settings :

mkdir /opt/parsoid/etc
cp /opt/parsoid/config.example.yaml /opt/parsoid/etc/config.yaml
vim /opt/parsoid/etc/config.yaml

set the required parameters

uri: 'http://wiki.medi.com/api.php'

and optionals as per example

domain: 'wiki.medi.com'  # optional

configure startup using deamontools

mkdir -p /var/services/parsoid/supervise
mkdir -p /var/services/parsoid/log/supervise
mkdir /var/log/parsoid
chown www:www /var/log/parsoid
touch /var/services/parsoid/down
cat  >/var/services/parsoid/run <<- EOM
#!/bin/sh
exec 2>&1
exec \
   /usr/local/bin/setuidgid www \
   /usr/bin/node /opt/parsoid/parsoid.js \
   -c /opt/parsoid/etc/config.yaml \
   -n 1
# /usr/bin/node /opt/parsoid/parsoid.js --help
#Usage: /opt/parsoid/parsoid.js [command] [options]
#
#Commandes:
#  docker-start  starts the service in a Docker container
#  docker-test   starts the test process in a Docker container
#  build         builds the service's package and deploy repo
#
#Options:
#  -n, --num-workers  number of workers to start                     [default: -1]
#  -c, --config       YAML-formatted configuration file
#                                 [string] [default: "./config.yaml"]
#  -f, --force        force the operation to execute    [boolean] [default: false]
#  -d, --deploy-repo  build only the deploy repo        [boolean] [default: false]
#  -r, --review       send the patch to Gerrit after building the repo
#                                                       [boolean] [default: false]
#  --verbose          be verbose                        [boolean] [default: false]
#  -v, --version      print the service's version and exit
#                                                       [boolean] [default: false]
#  -h, --help         Display help                                 [boolean]    
EOM
chmod +x /var/services/parsoid/run
cat  >/var/services/parsoid/log/run <<- EOM
#!/bin/sh
exec 					\
   /usr/local/bin/setuidgid www 	\
   /usr/local/bin/multilog t s5000000  \
   /var/log/parsoid
EOM
chmod +x /var/services/parsoid/log/run

then add link

pushd /services
ln -s /var/services/parsoid 
popd
pushd /etc/init.d/supervise/
ln -s ../daemontools parsoid
popd
pushd /etc/rc.d/rc7.d/
ln -s  /etc/rc.d/init.d/e-smith-service S99parsoid
popd

and set service

db configuration set parsoid service status enabled access localhost

Sources

  1. https://www.mediawiki.org/wiki/Parsoid/Setup
  2. https://www.centos.org/forums/viewtopic.php?f=47&t=53223&p=225372#p225372