Configuring MediaWiki to use NodeJS and Parsoid
Note: This post references an old version of NodeJS. You can install the latest version of NodeJS and self compile it. to do so, for full details just follow this post.
First you need to download NodesJS, download from
http://nodejs.org/dist/v0.10.20/node-v0.10.20-sunos-x64.tar.gz
Extract to /opt/node and add node to the path
export PATH=/opt/node/bin:$PATH
To get GNU make to work with
export PATH=/usr/gnu/bin:$PATH
Install git and g++ (included in gcc-45
pkg install git gcc-45
Install the extra modules
/wiki/Parsoid/js/api cp localsettings.js.example localsettings.js
Modify the Parsoid file
parsoidConfig.setInterwiki( 'localhost', 'http://devtech101.com/api.php' );
Start the nodes demon
node api/server.js
Now configure the MediaWiki by modifying the LocalSettings.php
//Allow read only access $wgGroupPermissions['*']['read'] = true; ######################################################## // New visual editor AND Parsoid ######################################################## require_once("$IP/extensions/VisualEditor/VisualEditor.php"); // OPTIONAL: Enable VisualEditor in other namespaces // By default, VE is only enabled in NS_MAIN //$wgVisualEditorNamespaces[] = NS_PROJECT; // Enable by default for everybody $wgDefaultUserOptions['visualeditor-enable'] = 1; // Don't allow users to disable it $wgHiddenPrefs[] = 'visualeditor-enable'; // OPTIONAL: Enable VisualEditor's experimental code features //$wgVisualEditorEnableExperimentalCode = true; $wgVisualEditorParsoidURL = 'http://localhost:8000'; $wgVisualEditorParsoidPrefix = 'localhost';
Create a startup script, like the below.
cat /etc/init.d/parsoid
#!/bin/bash # /etc/init.d/parsoid description="Start Parsoid extension for MediaWiki" # Some things that run always export VCAP_APP_PORT="8000" export NODE_PATH="/wiki/Parsoid/js/node_modules" # Carry out specific functions when asked to by the system case "$1" in start) cd "/wiki/Parsoid/js" /opt/node/bin/node /wiki/Parsoid/js/api/server.js >> nohup.out 2>&1 & ;; restart) echo "Stopping Parsoid..." echo "pkill -9 node, could do more here..." pkill -9 node ;; 'reload'|'force-reload') echo "Could fail..." cd "/wiki/Parsoid/js" /opt/node/bin/node /wiki/Parsoid/js/api/server.js >> nohup.out 2>&1 & ;; stop) echo "Stopping Parsoid..." pkill -9 node ;; *) echo "Usage: $0 {start|stop|restart|reload|force-reload}" exit 1 ;; esac exit 0
You might also like
Solaris NodeJS Zone Install