Extension:MediaWikiFarm/Quick start

This page is a quick start guide to install and configure a farm of wikis using the Mediawiki extension MediaWikiFarm in multi-versions mode. The installation is made on Ubuntu 16.04, with Nginx and MySQL (other backends are supported but not covered here). The guide does not cover the installation and general configuration of these softwares, nor topics such as security. It is advised to read the Concepts page beforehand.

Farm
In multi-versions mode, covered by this guide, MediaWikiFarm allows you to manage farms of wikis with different versions of Mediawiki. At the end of this guide, a farm of two wikis will be set, with these Mediawiki versions: Note that MediaWikiFarm is compatible with any MediaWiki version, hence you can use any you want.
 * : 1.27.3 (last LTS version)
 * : 1.29.0 (last stable version at the writing of this guide)

Directories
Mediawiki and MediaWikiFarm will be installed using these directories:


 * Mediawiki Configuration directory:
 * Cache directory:
 * Code directory:
 * MediaWikiFarm directory:
 * MediaWikiFarm configuration directory:
 * Mediawiki 1.27.3 directory:
 * Mediawiki 1.29.0 directory:

Make sure that the following directories exist and create them if needed:

mkdir /etc/mediawiki mkdir /tmp/mediawiki mkdir /opt/mediawiki

Hosts
As wikis created by this guide are fictional, you should add these entries into your  file:

127.0.0.1 tintin.moulinsart.example 127.0.0.1 milou.moulinsart.example

Nginx
Make sure that PHP is activated and that the  directive is set to. Then reload nginx service:

service nginx reload

MySQL
You will create a database by wiki, and a MySQL user by database (it is also possible to share a database and a MySQL user for several wikis). Here are the SQL commands to do so:

CREATE DATABASE tintinmoulinsart; CREATE USER tintinmoulinsart@localhost IDENTIFIED BY 'tintin'; GRANT ALL ON tintinmoulinsart.* TO tintinmoulinsart@localhost; CREATE DATABASE miloumoulinsart; CREATE USER miloumoulinsart@localhost IDENTIFIED BY 'milou'; GRANT ALL ON miloumoulinsart.* TO miloumoulinsart@localhost;

Mediawiki
Mediawiki versions are stored in subdirectories of the code directory. You can use any name for these subdirectories, but it is advised to use meaningful ones.

You start by downloading Mediawiki 1.27.3 using Git:

cd /opt/mediawiki mkdir 1.27.3 && cd 1.27.3 git clone https://gerrit.wikimedia.org/r/p/mediawiki/core.git. git checkout tags/1.27.3 composer install --no-dev

Then, you can download Mediawiki 1.29.0:

cd /opt/mediawiki mkdir 1.29.0 && cd 1.29.0 git clone https://gerrit.wikimedia.org/r/p/mediawiki/core.git. git checkout tags/1.29.0 composer install --no-dev

When you download Mediawiki with Git, you also need to download desired skins and extensions. For now, you only need the default skin, Vector:

cd /opt/mediawiki/1.27.3/skins git clone -b REL1_27 https://gerrit.wikimedia.org/r/p/mediawiki/skins/Vector cd /opt/mediawiki/1.29.0/skins git clone -b REL1_29 https://gerrit.wikimedia.org/r/p/mediawiki/skins/Vector

Installation
You can use the latest available version of MediaWikiFarm in Git, as it is compatible with any version of Mediawiki:

cd /opt/mediawiki mkdir mediawikifarm && cd mediawikifarm git clone https://gerrit.wikimedia.org/r/mediawiki/extensions/MediaWikiFarm. composer install --no-dev

Directories configuration
You need to create the file. A sample is available in the directory. Copy it and check that directories are those in Directories overview.

cp /opt/mediawiki/mediawikifarm/docs/config/MediaWikiFarmDirectories.php /opt/mediawiki/mediawikifarm/config/. vi /opt/mediawiki/mediawikifarm/config/MediaWikiFarmDirectories.php

Farms configuration
The file  describes your farms:

myfarm: server: '(? [a-z]+)\.(? [a-z]+)\.example' variables: - variable: 'family' - variable: 'wiki' suffix: '$family' wikiID: '$wiki$family' versions: 'versions.yml' config: - file: 'conf/$family/$wiki.yml' key: '$wiki$family'

You can have several farms, but only one is configured here:. Paths are relative to the configuration file.


 * Available Mediawiki versions for the farm are listed in the file.
 * Wikis of the farm have the following format for their URLs:.
 * Each wiki has a configuration file . You can also set up configuration files by farm, suffix or wiki, in YAML, JSON or PHP syntax.

Mediawiki versions configuration
Here is an example of the file  that will work for the farm that you are setting up (several formats are possible):

miloumoulinsart: 1.29.0 default: 1.27.3

Wikis configuration
Here is an example of the configuration file :

wgDBtype: 'mysql' wgDBserver: 'localhost' wgDBname: 'tintinmoulinsart' wgDBuser: 'tintinmoulinsart' wgDBpassword: 'tintin' wgScriptPath: ''

And similarly for the configuration file :

wgDBtype: 'mysql' wgDBserver: 'localhost' wgDBname: 'miloumoulinsart' wgDBuser: 'miloumoulinsart' wgDBpassword: 'milou' wgScriptPath: ''

This example contains only database configuration, but you can add any Mediawiki configuration that you want.

Databases initializations
You need to initialize the databases using the following commands:

cd /opt/mediawiki php 1.27.3/maintenance/install.php --confpath=/dev/null --dbtype=mysql --dbserver=localhost --dbuser=tintinmoulinsart --dbpass=tintin --dbname=tintinmoulinsart --lang=en --pass=mdpwiki "Tintin's wiki" "Tintin" php 1.29.0/maintenance/install.php --confpath=/dev/null --dbtype=mysql --dbserver=localhost --dbuser=miloumoulinsart --dbpass=milou --dbname=miloumoulinsart --lang=en --pass=mdpwiki "Milou's wiki" "Milou"

Outcome
Your wikis are now available at:
 * http://tintin.moulinsart.example/
 * http://milou.moulinsart.example/