Running CoLab

ColabSupport,Admin

This page shows what has been done to run MPDL's Colab wiki(s) in a more flexible and reliable way using a common service concept.

Basic Layout
The original versions of MPDL's Colab wiki had been set up using the mediawiki software, which is also used by Wikipedia.

Because the Colab site holds two different wikis - the main Colab mediawiki at http://colab.mpdl.mpg.de/mediawiki and the smaller TWR wiki at http://colab.mpdl.mpg.de/twrwiki - and also to enable additional demonstration and development wiki sites under a single address - that is colab.mpdl.mpg.de - a multi-wiki layout has been designed, that allows for an arbitrary number of wikis, distinguishable by their names - like the well-established mediawiki and twrwiki, and also new ones like test wikis.

Mediawiki Considerations
Like its big brother Wikipedia Colab should support short URLs.

Although there is more than one way to make short urls work, only an alias based approach support the intended multiple wikis design. Again, exactly this approach is used by Wikipedia also.

Available Wikis
The new structure and concepts allow to easily add as much wikis as needed without affecting the existing ones. Currently the following mediawiki instances have been set up:

The well-known standard production wikis:
 * http://colab.mpdl.mpg.de/mediawiki (to be migrated to v1.22.4 soon)
 * http://colab.mpdl.mpg.de/twrwiki (alreday migrated to v1.22.4)

There also exist minimally configured standard sample wikis:
 * http://colab.mpdl.mpg.de/mw-1.22.4 (MediaWikiAdmin/amalie33)

Furthermore copies of the production wikis are established to enable migration tests to new mediawiki versions:
 * http://colab.mpdl.mpg.de/mediawiki-new (version 1.22.4)

Old wikis set to ReadOnly:
 * http://colab.mpdl.mpg.de/twrwiki-old

System Structure
Because Colab is a LAMP-type service, it consists of PHP code - provided by the mediawiki software and appropriate extensions - and an MySQL database - to be more specific: a dedicated server instance -, which is also maintained by the mediawiki software itself.

To allow for multi-wiki support the whole structure holds its different wikis in different sub-trees or databases (that is a group of automatically maintained tables). So, new wikis can be easily created by extending existing parts of the structure (ie. by mainly unpacking the mediawiki software, creating an empty database and clone and slightly modify an existing configuration file).

Whereas the directory tree for the mediawiki instances has to be chosen to start at /srv/web/colab/inst, the MySQL databases are located under /srv/mysql/colab. As usual, the apache configuration file for the whole service is described by a single vhosts-file /etc/apache2/vhosts.d/colab.cfg.

As described by the common service concept further files related to this service may be found in the parent system's directory structure. To reflect their relation hey shall all be named after the service colab and contain service related content only.

Common Apache Configuration
The main apache2 vhost configuration file /etc/apache2/vhosts.d/colab.cfg should look like this:


 * 1) /etc/apache2/vhosts.d/colab.conf
 * 2) apache definitions for the colab mediawiki wikis
 * 1) apache definitions for the colab mediawiki wikis
 * 1) apache definitions for the colab mediawiki wikis

 ServerName colab.mpdl.mpg.de
 * 1) colab service

# one log must fit all CustomLog /var/log/apache2/colab-access.log combined ErrorLog /var/log/apache2/colab-error.log

# force FQN in URL RewriteEngine On RewriteCond %{HTTP_HOST} !^colab.mpdl.mpg.de$ [NC] RewriteCond %{HTTP_HOST} !^$ RewriteRule ^/(.*)      http://colab.mpdl.mpg.de/$1 [L,R]

# common root for all mediawikis DocumentRoot /srv/web/colab/inst

# choose the default mediawiki instance RedirectMatch ^/$ http://colab.mpdl.mpg.de/mediawiki

# define all available mediawikis Alias /mediawiki /srv/web/colab/inst/mw060/index.php5 Alias /twrwiki   /srv/web/colab/inst/mw070/index.php5 Alias /testwiki  /srv/web/colab/inst/mw080/index.php5 ..

# configure new media wiki mw099/newwiki (uncomment only for initial configuration) # Alias /newwiki/mw-config /srv/web/colab/inst/mw099/mw-config/index.php5 # Alias /newwiki          /srv/web/colab/inst/mw099/index.php5

 Options FollowSymLinks All Options -Indexes Order Allow,Deny Allow from all   

Common MySQL Instance Configuration
Assuming a mysqld-multi MySQL setup, enabled in /etc/sysconfig/mysql</TT> ..

 .. MYSQLD_MULTI="yes" </PRE>

.., which is convenient if you do not want to join or disturb an existing MySQL server instance, the MySQL instance for the colab service defined in /etc/my.cnf</TT> should look like this:

 .. [mysqld2] port      = 3308 datadir   = /srv/mysql/colab pid-file  = /srv/mysql/colab/mysql.pid socket    = /srv/mysql/colab/mysql.sock user      = mysql .. </PRE>

Note, not to set a mysqld_multi password to allow for a reliable stop of all instances without any further intervention.

To make the colab MySQL instance the default, edit /etc/my.cnf</TT> to look like ..

 .. [client] socket         = /var/lib/mysql/mysql.sock .. </PRE>

.. and you can use future mysql</TT> client commands without specifying the --socket option --socket=/srv/mysql/colab/mysql.sock</TT>.

Note: This is only useful, if colab is the only mysql client service on the host.

Now, an new and empty database server instance common to the all future wikis of the colab service can be set up ..

 </PRE>
 * 1) mysql_install_db --datadir=/srv/mysql/colab

.. and cleaned from unwanted default entries:

 </PRE>
 * 1) mysql mysql -e "drop database test;"

Add a new Mediawiki Instance
An additional mediawiki mw007</TT> available as mywiki</TT> can be set up easily following these steps.

After having downloaded and unpacked the latest mediawiki software into a new and empty directory /srv/web/colab/inst/mw007</TT>, the following entries must or should be be made to the mediawiki configuration file LocalSettings.php</TT> to make the above apache configuration work:

 .. $wgSitename = "CoLab MyWiki MediaWiki"; $wgMetaNamespace = "Project";

$wgScriptPath = "/mw007"; $wgArticlePath = "/mywiki/$1"; $wgScriptExtension = ".php5";
 * 1) The URL base path to the directory containing the wiki;
 * 2) defaults for all runtime URL paths are based off of this.
 * 3) For more information on customizing the URLs
 * 4) (like /w/index.php/Page_title to /wiki/Page_title) please see:
 * 5) http://www.mediawiki.org/wiki/Manual:Short_URL

..

$wgEmergencyContact = "colab-support@mpdl.mpg.de"; $wgPasswordSender = "colab-support@mpdl.mpg.de";

..

$wgDBtype = "mysql"; $wgDBserver = "localhost\\:3308"; $wgDBname = "mw007"; $wgDBuser = "mw007_user"; $wgDBpassword = "mw007_pass"; $wgDBprefix = ""; .. </PRE>
 * 1) Database settings

Prior to put the wiki mywiki</TT> online a new MySQL database has to be created:

<PRE> mysql> create database mw007; mysql> grant all on mw007.* to mw007_user@localhost identified by 'mw007_pass'; mysql> flush privileges; mysql> exit Bye </PRE>
 * 1) mysql [--socket=/srv/mysql/colab/mysql.sock] mysql

Now you can add an un-commented copy of the newwiki lines in the above apache configuration file and replace all occurences of mw099/newwiki there by mw007/mywiki ..

<PRE> # configure new media wiki newwiki (uncomment only for initial configuration) # Alias /newwiki/mw-config /srv/web/colab/inst/mw099/mw-config/index.php5 # Alias /newwiki          /srv/web/colab/inst/mw099/index.php5

# configure mywiki Alias /mywiki/mw-config /srv/web/colab/inst/mw007/mw-config/index.php5 Alias /mywiki          /srv/web/colab/inst/mw007/index.php5 .. </PRE>

.. to allow for an guided initialization of the newly created mediawiki <TT>mywiki</TT> by visiting <TT> http://colab.mpdl.mpg.de/mywiki </TT> and answering the questions given there.

Be sure to use exactly the same settings as given in the configuration files in your answers. After successful initialization the temporary lines, which have been added for configuring the new wiki only, have to be replaced by a permanent entry:

<PRE> .. Alias /mywiki     /srv/web/colab/inst/mw007/index.php5 .. </PRE>

Clone an existing Mediawiki Instance
If an existing mediawiki instance <TT>mw008/awiki</TT> shall be cloned to <TT>mw018/bwiki</TT> the following steps are neccessary.

<PRE> </PRE> <PRE> .. $wgSitename = "Colab bWiki MediaWiki"; .. $wgScriptPath = "/mw018"; $wgArticlePath = "/bwiki/$1"; .. $wgDBname = "mw018"; $wgDBuser = "mw018_user"; $wgDBpassword = "mw018_pass"; .. </PRE> There should be no other files containing the old names, but if so, edit them accordingly. <PRE> Alias /bwiki     /srv/web/colab/inst/mw018/index.php5 </PRE> <PRE> mysql> create database mw018; mysql> grant all on mw018.* to mw018_user@localhost identified by 'mw018_pass'; mysql> flush privileges; mysql> exit Bye
 * copy mw008's instance directory to mw018:
 * 1) cd /srv/web/colab/inst
 * 2) cp -rp mw008 mw018
 * edit mw018's configuration file <TT>LocalSettings.php</TT>:
 * 1) vi mw018/LocalSettings.php
 * prepare the apache configuration file <TT>/etc/apache2/vhosts.d/colab.conf</TT> by adding an appropriate entry:
 * create mw018's database by cloning mw008's
 * 1) mysql [--socket=/srv/mysql/colab/mysql.sock] mysql

</PRE>
 * 1) mysqldump [--socket=/srv/mysql/colab/mysql.sock] mw008 > /tmp/dump-of-mw008.sql

Now the dump file <TT>/tmp/dump-of-mw008.sql</tt> may be treated with an text or stream editor to modify the old database content to fit the new one, which includes to rename at least:


 * mw008 to mw018
 * awiki to bwiki

It is also possible to replace things like account names, passwords or URLs in this step. Now the resulting file may be loaded into the new database.

<PRE> </PRE> <PRE> </PRE>
 * 1) mysql [--socket=/srv/mysql/colab/mysql.sock] mw018 < /tmp/dump-of-mw008.sql
 * 2) rm /tmp/dump-of-mw008.sql
 * reload the apache service:
 * 1) /etc/init.d/apache2 reload