SELinux and Parosid

General support questions
PKDixPD
Posts: 7
Joined: 2016/08/10 04:16:01

Re: SELinux and Parosid

Post by PKDixPD » 2016/09/30 20:43:10

EDIT: 2016.10.04 - made it work

Hello,
First off, thanks to all above posters for the instructions and the effort!
I too did have the same issue with missing api folder, server.js in bin instead of api, parsoid misconfiguration and other misc issues.
After a few days of head-to-wall relationship, I made it work properly without errors. Below are the steps I compiled that worked for me. Hopefully, it will be useful to others.

My environment:
  • CentOS7.2.1511 with default LAMP stack minus the php, which is php7 from remi repo
  • MediaWiki 1.27.1
  • SElinux = enforcing

    Based off the steps posted by thomei (thank you!) viewtopic.php?f=47&t=53223#p225372 here is what I did starting at Step 9. I omitted steps that worked fine for me.

    Step 9) omitted the creation of api folder and localsettings.js which is required only for backward compatibility and for me, well, wasn't needed at all.

    Instead, I configured config.yaml file (thanks hananrok) as follows:

    Code: Select all

    cd /opt/parsoid/
    cp config.example.yaml config.yaml
    
    edited(vim, nano, etc) config.yaml and located line starting with:

    Code: Select all

    mwApis:
    The important lines to change were:

    Code: Select all

    uri: 'http://yourwikiurl/api.php'
    and

    Code: Select all

    domain: 'localhost'  # optional
    Step 10) did not use, since localsettings.js wasn't needed

    Step 13) did not use (needs experimentation)

    Step 13.5) created policy and applied httpd_sys_content_t label to /var/www/html directory. (i use the default "html" directory). I really should have done this during LAMP install.

    Code: Select all

    cd /var/www
    semanage fcontext -a -t httpd_sys_content_t "/html(/.*)?"
    restorecon -R -v html
    
    Step 16) httpd_can_network_connect was already off for me

    Step 18) I modified ExecStart directive to point to where the server.js is currently located for me: /opt/parsoid/bin/server.js (as mentioned by above poster)

    Code: Select all

    [Unit]
    Description=Mediawiki Parsoid web service on node.js
    Documentation=http://www.mediawiki.org/wiki/Parsoid
    Wants=local-fs.target network.target
    After=local-fs.target network.target
    
    [Install]
    WantedBy=multi-user.target
    
    [Service]
    Type=simple
    User=root
    Group=root
    WorkingDirectory=/opt/parsoid
    # EnvironmentFile=-/etc/parsoid/parsoid.env
    ExecStart=/usr/bin/node /opt/parsoid/bin/server.js
    KillMode=process
    Restart=on-success
    PrivateTmp=true
    StandardOutput=syslog
    
    Step 19 - 20) I was able to start parsoid service and pull it's page successfully at this point

    Step 21 - 25) Installed correct version of VisualEdior and UniversalLanguageSelector
    This had me stumbled at first but then I realized that Git pulls VE and ULS for the latest version of MediaWiki 1.28
    In my case, I am running the 1.27 so I had to get the correct version:

    Code: Select all

    cd ~
    
    wget https://extdist.wmflabs.org/dist/extensions/VisualEditor-REL1_27-9da5996.tar.gz
    tar -xvzf VisualEditor-REL1_27-9da5996.tar.gz
    cp -rv VisualEditor /var/www/mediawiki-installation/extensions/
    
    wget https://extdist.wmflabs.org/dist/extensions/UniversalLanguageSelector-REL1_27-a274928.tar.gz
    tar -xvzf UniversalLanguageSelector-REL1_27-a274928.tar.gz
    cp -rv UniversalLanguageSelector /var/www/mediawiki-installation/extensions/
    Step 26 - 27) pasted the VisualEditor code into LocalSettings.php
    One change I had to do was remove the * from. Otherwise, i'd be getting a blank page when going to my wiki.

    Code: Select all

    # Namespces for VE
    $wgVisualEditorNamespaces = array_merge(
            $wgContentNamespaces,
            array( * )
    );
    so it became:

    Code: Select all

    # Namespces for VE
    $wgVisualEditorNamespaces = array_merge(
            $wgContentNamespaces,
            array()
    );
    I restarted Parsoid and Apache services for good measure.
    Now, editing pages seem to be using VisualEditor.

    I tested this on a Public Wiki and Private.
    For Private Wiki I had to use additional lines in LocalSettings.php as per https://www.mediawiki.org/wiki/User:And ... oid_Server
Last edited by PKDixPD on 2016/10/04 04:05:32, edited 2 times in total.

anlag
Posts: 1
Joined: 2017/01/04 12:57:16

Re: SELinux and Parosid

Post by anlag » 2017/01/04 13:18:04

Thanks everyone who contributed to this topic and especially thomei for an excellent walkthrough. Apart from the comments already made since this guide was posted, I wanted to add that as I was installing the latest Parsoid (in Jan 2017) and VisualEditor for Mediawiki 1.27 LTS on RHEL 7.2, the Parsoid test in step 20 did not work as expected for me.
thomei wrote:20) Test, if Parsoid is working: Go to a users computer and open in a browser http://base-url-of-your-wiki.com:8000/_wikitext/. (Replace base-url-of-your-wiki.com to the base url that the users use in the browser.)
You should now be able to enter some Wiki-code in the form and Parsoid should render in to a correct HTML-page after a click on "Send data".
Going to http://base-url-of-your-wiki.com:8000/_wikitext/ produced an error reading "Cannot GET /_wikitext/". I spent some time mucking around with settings and other things before realizing that simply loading http://base-url-of-your-wiki.com:8000 DID work, showing a "Welcome to the Parsoid web service" message (but no input form or send button.) I continued with the installation steps and found everything worked fine. I guess something has changed in the setup since the guide was written, regardless this is just to help others avoid getting stuck on the same test.

dheeru6923
Posts: 4
Joined: 2016/08/02 21:11:04

Re: SELinux and Parosid

Post by dheeru6923 » 2017/02/07 19:29:25

I followed the below steps but, I am getting the below error,

[root@gn-webserver-test parsoid]# systemctl start parsoid
[root@gn-webserver-test parsoid]# systemctl status parsoid
● parsoid.service - Mediawiki Parsoid web service on node.js
Loaded: loaded (/etc/systemd/system/parsoid.service; disabled; vendor preset: disabled)
Active: failed (Result: exit-code) since Tue 2017-02-07 14:33:59 EST; 4s ago
Docs: http://www.mediawiki.org/wiki/Parsoid
Process: 29279 ExecStart=/usr/bin/node /opt/parsoid/api/server.js (code=exited, status=8)
Main PID: 29279 (code=exited, status=8)

Feb 07 14:33:59 gn-webserver-test node[29279]: ^
Feb 07 14:33:59 gn-webserver-test node[29279]: Error: Cannot find module '/opt/parsoid/api/server.js'

dheeru6923
Posts: 4
Joined: 2016/08/02 21:11:04

Re: SELinux and Parosid

Post by dheeru6923 » 2017/02/07 20:15:53

Hi All,

I am facing the same issue, api directory, But

I tried putting the below entry by manually creating a directory in /opt/parsoid/

$] mkdir api
$] vim server.js
#!/usr/bin/env node

"use strict";

var ServiceRunner = require('service-runner');
new ServiceRunner().start();

:wq
$] vim localsettings.js

'use strict';
exports.setup = function(parsoidConfig) {

parsoidConfig.setMwApi('mediawiki', { uri: 'http://xxx.xxxx.com/api.php' });

};

Then parsoid started working but, getting the below error trying to edit on webpage:

curl: cannot load server 404

dheeru6923
Posts: 4
Joined: 2016/08/02 21:11:04

Re: SELinux and Parosid

Post by dheeru6923 » 2017/02/07 21:05:23

Hello All,

I am now getting the below error:

error loading data froms erver (curl error:60) Peer certificate cannot be authenticated with given CA certificates:


Please help

User avatar
TrevorH
Site Admin
Posts: 33220
Joined: 2009/09/24 10:40:56
Location: Brighton, UK

Re: SELinux and Parosid

Post by TrevorH » 2017/02/07 22:09:19

Please start a new topic if you want to continue to discuss this - that's a completely different error and to do with your SSL certificate.
The future appears to be RHEL or Debian. I think I'm going Debian.
Info for USB installs on http://wiki.centos.org/HowTos/InstallFromUSBkey
CentOS 5 and 6 are deadest, do not use them.
Use the FAQ Luke

Locked