Thursday, April 30, 2015

Fastest idempotent way to install nodejs in Ubuntu

Originally I created a gist tailored at Ubuntu however a fastest way is just to use a Plain Old Bash script to install the binaries as presented here. This will work in any linux and MAC OSX.

Friday, April 17, 2015

run cygwin sshd under SYSTEM user - The CYGWIN sshd service on Local Computer started and then stopped. Some services stop automatically if they are not in use by other services or programs

I got this error when trying to switch cygwin sshd to run as windows SYSTEM user. This is a need if you want to allow cygwin to interact with graphical applications.
The CYGWIN sshd service on Local Computer started and then stopped. Some services stop automatically if they are not in use by other services or programs
The first thing to do is to look into the sshd logs:
$ tail -10 /var/log/sshd.log
/var/empty must be owned by root and not group or world-writable.
The reason for this error is the fact that SYSTEM user (look upper case) is not the owner of /var/empty. The exact reason why this error happens is explained here. So the solution is simple:
$ chown SYSTEM /var/empty
Even though I went pass this issue I later realized there was no way to run desktop applications remotely using this method as explained here and here.

Monday, April 13, 2015

dockerized mediawiki 1.25 upgrade

The latest version of mediawiki comes with VisualEditor which marks the beginning of real wiki visual edition thanks to the use of node parsoid project. This is a radical change when we compare with the former CKEditor which would add a lot of html tags to your wiki markup. With Visual Editor we get plain wiki markup that can be edited by those who do enjoy the keyboard more than the mouse ;-)

Here is a partial docker guideline that can be used to install this latest version.
Dockerfile.partial
==================
# Omitting apache related configuration
RUN apt-get -y update
RUN apt-get -y install imagemagick
RUN mkdir -p /var/www/wiki
RUN cd /var/www \
&& rm -fr wiki/* \
&& git clone https://gerrit.wikimedia.org/r/p/mediawiki/core.git wiki \
&& cd wiki \
&& git checkout 965b70f
RUN git clone https://gerrit.wikimedia.org/r/p/mediawiki/vendor.git \
&& cd /var/www/wiki/vendor \
&& git submodule update --init --recursive . \
&& cd /var/www/wiki/extensions/VisualEditor \
&& git submodule update --init --recursive . \
&& git checkout 970a20b \
&& cd ../../skins/Vector \
&& git submodule update --init --recursive .
RUN apt-get install -y python-software-properties software-properties-common python g++ make \
&& add-apt-repository "deb http://parsoid.wmflabs.org:8080/debian wmf-production/" \
&& apt-get update \
&& apt-get install -y --force-yes parsoid
RUN add-apt-repository -y ppa:chris-lea/node.js \
&& apt-get update \
&& apt-get install -y nodejs=0.10*
RUN cd /usr/lib/parsoid/src/ && npm install
RUN curl -sS https://getcomposer.org/installer | php
ADD ./localsettingsParsoid.js /usr/lib/parsoid/src/api/localsettings.js
RUN npm install -g forever
ADD wikiSettings.php /var/www/wiki/LocalSettings.php
CMD cd /usr/lib/parsoid/src && forever start api/server.js && apache2 -DFOREGROUND
LocalSettings.php
=================
...
$wgScriptPath = '';
$wgLogo = "/images/logo.png";
$wgSharedUploadDirectory = "/var/www/wiki/images";
$wgSMTP = array(
'host' => 'smtp.sample.com',
'IDHost' => 'sample.com',
'port' => '25',
'auth' => false
);
$wgDBserver = "$_ENV['TOOLS_MYSQL_PORT_3306_TCP_ADDR']";
$wgDBport = 3306;
$wgDBname = 'wiki';
$wgDBuser = 'dbuser';
$wgDBpassword = 'dbpassword';
$wgGroupPermissions['*']['edit'] = false;
// Latest version uses 'class' => 'JobQueueAggregatorNull' instead of 'class' => 'JobQueueAggregatorMemc'
$wgUpgradeKey = '7e95b9b39c83c613';
require_once "$IP/skins/Vector/Vector.php";
require_once "$IP/extensions/VisualEditor/VisualEditor.php";
$wgDefaultUserOptions['visualeditor-enable'] = 1;
$wgVisualEditorParsoidURL = 'http://localhost:8000';
$wgVisualEditorParsoidPrefix = 'wiki';
...
localsettingsParsoid.js
=======================
/*
* This is a sample configuration file.
*
* Copy this file to localsettings.js and edit that file to fit your needs.
*
* Also see the file ParserService.js for more information.
*/
exports.setup = function( parsoidConfig ) {
// The URL here is supposed to be your MediaWiki installation root.
// Note we use the 'wiki' identifier used in LocalSettings.php/wgVisualEditorParsoidPrefix.
// If parsoid serves requests for more than one wiki you need to add the corresponding configuration for those as well
parsoidConfig.setInterwiki( 'wiki', 'http://wiki.sample.com/api.php' );
// Use the PHP preprocessor to expand templates via the MW API (default true)
//parsoidConfig.usePHPPreProcessor = true;
// Use selective serialization (default false)
parsoidConfig.useSelser = true;
// parsoid cache url
//parsoidConfig.parsoidCacheURI = 'http://localhost:8000/';
//parsoidConfig.trace = true;
//parsoidConfig.traceFlags = 'selser,wts';
//parsoidConfig.traceFlags = 'selser';
//parsoidConfig.defaultAPIProxyURI = 'http://localhost/';
};
/* vim: set filetype=javascript noexpandtab ts=4 sw=4 cindent : */

Followers