Difference between revisions of "Visual Editor Install"

From SETV Springfield Technical Wiki
Jump to: navigation, search
Line 2: Line 2:
  
 
After you have MediaWiki installed (to a users' account NOT <code>/var/www/mediawiki</code> and working, do the following
 
After you have MediaWiki installed (to a users' account NOT <code>/var/www/mediawiki</code> and working, do the following
# <code>cd extensions  git clone https://gerrit.wikimedia.org/r/p/mediawiki/extensions/VisualEditor.git</code> cd VisualEditor</code>   git submodule update --init</code>
+
# <code>cd extensions</code> <code>git clone https://gerrit.wikimedia.org/r/p/mediawiki/extensions/VisualEditor.git</code>   <code>cd VisualEditor</code>     <code>git submodule update --init</code>
 
# Run This as Root from within the base wiki directory <code>curl --silent --location https://rpm.nodesource.com/setup_4.x | bash -</code>
 
# Run This as Root from within the base wiki directory <code>curl --silent --location https://rpm.nodesource.com/setup_4.x | bash -</code>
# Next we need to install Parsiod   <code>cd /opt</code> <code>mkdir src</code> <code>cd src</code>   <code>clone [https://gerrit.wikimedia.org/r/p/mediawiki/services/parsoid&#x3C;/code https://gerrit.wikimedia.org/r/p/mediawiki/services/parsoid]</code> <code>cp -rv ~/parsoid /opt/</code>  <code>cd /opt/parsoid/</code> <code>npm install</code> <code>nano config.example.yaml</code>  FIND  
+
# Next we need to install Parsiod   <code>cd /opt</code>   <code>mkdir src</code>   <code>cd src</code>   <code>clone https://gerrit.wikimedia.org/r/p/mediawiki/services/parsoid</code> <code>cp -rv ~/parsoid /opt/</code>  <code>cd /opt/parsoid/</code>   <code>npm install</code>   <code>nano config.example.yaml</code>  FIND and EDIT below:
 
  mwApis:
 
  mwApis:
  # This is the only required parameter,
+
  <nowiki>#</nowiki> This is the only required parameter,
  # the URL of you MediaWiki API endpoint.
+
  <nowiki>#</nowiki> the URL of you MediaWiki API endpoint.
 
  uri: 'http://wiki.ssdcougars.tv/api.php'
 
  uri: 'http://wiki.ssdcougars.tv/api.php'
  # The "domain" is used for communication with Visual Editor
+
  <nowiki>#</nowiki> The "domain" is used for communication with Visual Editor
  # and RESTBase.  It defaults to the hostname portion of
+
  <nowiki>#</nowiki> and RESTBase.  It defaults to the hostname portion of
  # the `uri` property below, but you can manually set it
+
  <nowiki>#</nowiki> the `uri` property below, but you can manually set it
  # to an arbitrary string.
+
  <nowiki>#</nowiki> to an arbitrary string.
 
  domain: 'wiki.ssdcougars.tv'  # optional
 
  domain: 'wiki.ssdcougars.tv'  # optional
  # To specify a proxy (or proxy headers) specific to this prefix
+
  <nowiki>#</nowiki> To specify a proxy (or proxy headers) specific to this prefix
  # (which overrides defaultAPIProxyURI). Alternatively, set `proxy`
+
  <nowiki>#</nowiki> (which overrides defaultAPIProxyURI). Alternatively, set `proxy`
  # to `null` to override and force no proxying when a default proxy
+
  <nowiki>#</nowiki> to `null` to override and force no proxying when a default proxy
  # has been set.
+
  <nowiki>#</nowiki> has been set.
  #proxy:
+
  <nowiki>#</nowiki>proxy:
  #    uri: 'http://my.proxy:1234/'
+
  <nowiki>#</nowiki>   uri: 'http://my.proxy:1234/'
  #    headers:  # optional
+
  <nowiki>#</nowiki>   headers:  # optional
  #        'X-Forwarded-Proto': 'https'
+
  <nowiki>#</nowiki>       'X-Forwarded-Proto': 'https'
 +
CTL+X, Y, and rename the file to <code>config.yaml</code>
 +
 
 +
Next we need to add a parsoid user and group.
 +
 
 +
<code>groupadd parsoid</code>
 +
 
 +
<code>useradd -gparsoid parsoid</code>
 +
 
 +
<code>cd /opt/</code>
 +
 
 +
<code>chown -Rv parsoid:parsoid parsoid</code>
 +
 
 +
<code>chmod -Rv u+rw,g+r,o+r parsoid</code>
 +
 
 +
<code>chcon -Rv --type=system_u:object_r:usr_t:s0 parsoid</code>
 +
 
 +
Port 8000 should already be open on the hosted server, so we'll continue.
 +
 
 +
Create init.d service
 +
 
 +
cd /etc/init.d/
 +
 
 +
nano parsoid
 +
 
 +
paste the following:<blockquote>#! /bin/bash</blockquote><blockquote>#</blockquote><blockquote># parsoid start</blockquote><blockquote>#</blockquote><blockquote># chkconfig: 345 86 14</blockquote><blockquote># description: parsoid</blockquote><blockquote>#</blockquote><blockquote>### BEGIN INIT INFO</blockquote><blockquote># Provides: $parsoid</blockquote><blockquote>### END INIT INFO</blockquote><blockquote># Source function library.</blockquote><blockquote>. /etc/init.d/functions</blockquote><blockquote>rc=0</blockquote><blockquote># See how we were called.</blockquote><blockquote>case "$1" in</blockquote><blockquote>start)</blockquote><blockquote>echo    starting parsoid</blockquote><blockquote>cd /opt/parsoid</blockquote><blockquote>/sbin/runuser parsoid -s /bin/bash -c "nohup node /opt/parsoid/bin/server.js > /dev/null 2>&1 &"</blockquote><blockquote>$0 status</blockquote><blockquote>;;</blockquote><blockquote>stop)</blockquote><blockquote>process=`ps -ef | grep 'node /opt/parsoid/bin/server.js'| grep -v grep | awk '{print $2}'`</blockquote><blockquote>if [ "${process}" != <nowiki>''</nowiki> ]</blockquote><blockquote>then</blockquote><blockquote>echo    stopping parsoid</blockquote><blockquote>killall -9 node</blockquote><blockquote>fi</blockquote><blockquote>$0 status</blockquote><blockquote>;;</blockquote><blockquote>status)</blockquote><blockquote>proc_find=`ps -ef | grep 'node /opt/parsoid/bin/server.js'| grep -v grep`</blockquote><blockquote>if [ "${proc_find}" = <nowiki>''</nowiki> ]</blockquote><blockquote>then</blockquote><blockquote>echo    parsoid is not running</blockquote><blockquote>else</blockquote><blockquote>echo parsoid is running: ${proc_find}</blockquote><blockquote>fi</blockquote><blockquote>;;</blockquote><blockquote>restart|reload)</blockquote><blockquote>cd "$CWD"</blockquote><blockquote>$0 status</blockquote><blockquote>$0 stop</blockquote><blockquote>$0 start</blockquote><blockquote>;;</blockquote><blockquote>*)</blockquote><blockquote>echo $"Usage: $0 {start|stop|restart|reload|status}"</blockquote><blockquote>exit 1</blockquote><blockquote>esac</blockquote><blockquote>exit $rc</blockquote><blockquote></blockquote>

Revision as of 07:25, 19 August 2016

Mediawiki's Visual Editor is not included with Mediawiki. It is an external add-on that requires a LOT of work to get working.

After you have MediaWiki installed (to a users' account NOT /var/www/mediawiki and working, do the following

  1. cd extensions git clone https://gerrit.wikimedia.org/r/p/mediawiki/extensions/VisualEditor.git cd VisualEditor git submodule update --init
  2. Run This as Root from within the base wiki directory curl --silent --location https://rpm.nodesource.com/setup_4.x | bash -
  3. Next we need to install Parsiod cd /opt mkdir src cd src clone https://gerrit.wikimedia.org/r/p/mediawiki/services/parsoid cp -rv ~/parsoid /opt/ cd /opt/parsoid/ npm install nano config.example.yaml FIND and EDIT below:
mwApis:
# This is the only required parameter,
# the URL of you MediaWiki API endpoint.
uri: 'http://wiki.ssdcougars.tv/api.php'
# The "domain" is used for communication with Visual Editor
# and RESTBase.  It defaults to the hostname portion of
# the `uri` property below, but you can manually set it
# to an arbitrary string.
domain: 'wiki.ssdcougars.tv'  # optional
# To specify a proxy (or proxy headers) specific to this prefix
# (which overrides defaultAPIProxyURI). Alternatively, set `proxy`
# to `null` to override and force no proxying when a default proxy
# has been set.
#proxy:
#    uri: 'http://my.proxy:1234/'
#    headers:  # optional
#        'X-Forwarded-Proto': 'https'

CTL+X, Y, and rename the file to config.yaml

Next we need to add a parsoid user and group.

groupadd parsoid

useradd -gparsoid parsoid

cd /opt/

chown -Rv parsoid:parsoid parsoid

chmod -Rv u+rw,g+r,o+r parsoid

chcon -Rv --type=system_u:object_r:usr_t:s0 parsoid

Port 8000 should already be open on the hosted server, so we'll continue.

Create init.d service

cd /etc/init.d/

nano parsoid

paste the following:
#! /bin/bash
#
# parsoid start
#
# chkconfig: 345 86 14
# description: parsoid
#
### BEGIN INIT INFO
# Provides: $parsoid
### END INIT INFO
# Source function library.
. /etc/init.d/functions
rc=0
# See how we were called.
case "$1" in
start)
echo    starting parsoid
cd /opt/parsoid
/sbin/runuser parsoid -s /bin/bash -c "nohup node /opt/parsoid/bin/server.js > /dev/null 2>&1 &"
$0 status
;;
stop)
process=`ps -ef | grep 'node /opt/parsoid/bin/server.js'| grep -v grep | awk '{print $2}'`
if [ "${process}" != '' ]
then
echo    stopping parsoid
killall -9 node
fi
$0 status
;;
status)
proc_find=`ps -ef | grep 'node /opt/parsoid/bin/server.js'| grep -v grep`
if [ "${proc_find}" = '' ]
then
echo    parsoid is not running
else
echo parsoid is running: ${proc_find}
fi
;;
restart|reload)
cd "$CWD"
$0 status
$0 stop
$0 start
;;
*)
echo $"Usage: $0 {start|stop|restart|reload|status}"
exit 1
esac
exit $rc