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 : */

No comments:

Followers