0

Tips & Tricks : Install Node.js on Debian 7.0 “Wheezy”

-

As on Debian 7.0 Node.js is not included in standard repositories, if you want to install it login to server as a root and issue following commands:

apt-get install curl
curl -sL https://deb.nodesource.com/setup | bash -
apt-get install -y nodejs
0

How-To : Autostart Parsoid on openSUSE 13.1

-

Once Parsoid is installed on openSUSE it might be handy to have is started automatically once system is restarted.

First we have to create startup script.

/etc/init.d/parsoid

#!/bin/sh

#
# description: Node.js /srv/parsoid/api/server.js
#

. /etc/rc.status

USER="root"

DAEMON="/usr/bin/node"
ROOT_DIR="/srv/parsoid/api"
LOG_ROOT="/var/log/nodejs"

SERVER="$ROOT_DIR/server.js"
LOG_FILE="$LOG_ROOT/parsoid.log"

LOCK_FILE="/var/lock/subsys/node-server"

WORKERS_NUMBER=8

do_start()
{
if [ ! -f "$LOCK_FILE" ] ; then
echo -n $"Starting $SERVER: "
runuser -l "$USER" -c "$DAEMON $SERVER -n $WORKERS_NUMBER >> $LOG_FILE &" && echo || echo
RETVAL=$?
echo
[ $RETVAL -eq 0 ] && touch $LOCK_FILE
else
echo "$SERVER is locked."
RETVAL=1
fi
}
do_stop()
{
echo -n $"Stopping $SERVER: "
pid=`ps -aefw | grep "$DAEMON $SERVER" | grep -v " grep " | awk '{print $2}'`
kill -9 $pid > /dev/null 2>&1 && echo || echo
RETVAL=$?
echo
[ $RETVAL -eq 0 ] && rm -f $LOCK_FILE
}

case "$1" in
start)
do_start
;;
stop)
do_stop
;;
restart)
do_stop
do_start
;;
*)
echo "Usage: $0 {start|stop|restart}"
RETVAL=1
esac

exit $RETVAL
Remember to adjust all paths and number of worker processes accordingly to your installation.

Once startup script is in place we have to enable Parsoid to be automatically started:

chkconfig parsoid on

From now on Parsoid will be automatically started after each restart.

0

Tips & Tricks : Apache2 autostart on openSUSE 13.1

-

In order to have Apache2 started automatically after reboot use:


systemctl enable apache2.service

0

How-To : Deploy VisualEditor extension for MediaWiki 1.24.2 on openSUSE 13.1 x64

-

In previous article I described how-to Deploy Parsoid on openSUSE 13.1 (which turns out to be quite a challenging task). Parsoid is component required for VisualEditor. Now it’s time for VisualEditor deployment.

Downloading VisualEditor

At the moment, when I’m doing deployment, stable version of MediaWiki is 1.24.2. VisualEditor is an extension written for certain version of MediaWiki, hence we can’t just download latest version and use it. It has to be specific release for specific MediaWiki version.

So, first we download VisualEditor for MediaWiki 1.24.2:

git clone -b REL1_24 https://github.com/wikimedia/mediawiki-extensions-VisualEditor.git
cd mediawiki-extensions-VisualEditor/
git submodule update --init

Once it’s done we need to place content of mediawiki-extensions-VisualEditor in extensions/VisualEditor folder under MediaWiki folder structure.

Finally, once we have all files in proper places it’s time to inform MediaWiki about VisualEditor.

Changes to LocalSettings.php

Changes which have to be applied to LocalSettings.php:

# VISUAL Editor
require_once("$IP/extensions/VisualEditor/VisualEditor.php");
$wgDefaultUserOptions['visualeditor-enable'] = 1;
$wgHiddenPrefs[] = 'visualeditor-enable';
$wgVisualEditorParsoidURL = 'http://localhost:8000';
$wgVisualEditorParsoidPrefix = 'localhost';
Remember to adjust Parsoid URL and Prefix accordingly to setup of your Parsoid service.

From now on you can enjoy VisualEditor until you decide to upgrade to newer version of MediaWiki.
Prior to that I would suggest to check if there is VisualEditor available for new release and test it prior to live deployments.

1

How-To : Deploy Parsoid for MediaWiki on openSUSE 13.1 x64

-

I took a challenge of running MediaWiki with Visual Editor extension on openSUSE 13.1 x64. Task sounds maybe easy, but turned out to be little madness, so once I got this working I think it might be nice to share my steps.

Operating system has been deployed from ISO image: openSUSE-13.1-NET-x86_64.iso.

Installing Node.js

Basically Node.js package which is included in distro doesn’t work properly. For that reason first step is to add new repository for Node.js:

sudo zypper ar http://download.opensuse.org/repositories/devel:/languages:/nodejs/openSUSE_13.1/ Node.js
sudo zypper in nodejs nodejs-devel
yast -i nodejs

 

Updating NPM

Once Node.js is installed it’s not quite fully working yet and any attempt of using npm fails. Some symlinks are missing, so to fix it we can just update npm:

curl -L https://npmjs.org/install.sh | sudo sh

 

Parsoid deployment

Now we can download Parsoid and make it work:

cd /srv
git clone https://gerrit.wikimedia.org/r/p/mediawiki/services/parsoid
cd parsoid
npm install
npm test
npm start
Parsoid will be located in /srv/parsoid folder. Do not forget to modify /srv/parsoid/api/localsettings.js for your system.

This is quite brief description, however saves lot of time and fight with Node.js and npm on openSUSE.