Run A Small/Medium Sized Wikipedia Clone on Microsoft Azure

Mark Richards
5 min readApr 27, 2022

One of the more difficult challenges for an IT team is finding ways to share information across an organization. You need a central location that you can point all of your users to, it has to be easy to add new materials, edit the current materials, and remove old materials.

There is an added complexity when you attempt to solve these problems in small to medium sized organizations. Because they often do not have the time, money, or the staff to maintain large scale solutions.

To try and address those issues we can use a combination of Managed Services that are available on Microsoft Azure as well as the open source MediaWiki project and the containerization software Docker.

The Managed Services offered by Microsoft Azure are cloud based infrastructure (servers and databases) where Microsoft handles all of the hardware, backups, updates, etc. So your IT team only has to worry about performing the initial setup and the resource monitoring.

The MediaWiki project is a wiki engine developed for and used by Wikipedia and the other Wikimedia projects. It is freely available for anyone to use. This is what gives Wikipedia the look, feel, and features everyone is familiar with.

Docker and containers are a way to package and run an applications in an isolated environment that makes sure everything runs the exact same way every time. The analogy often used is to think of putting your application inside of a shipping container and then putting that container next to other containers. It provides uniformity and consistency that makes managing and deploying applications easier.

What Resources Are Required?

In order to fully run the wiki you need a minimum of three Azure resources.

  1. Container Instance — This is the resource that Microsoft Azure uses to run containerized applications. You tell Azure how many CPUs you want and how much RAM you want and it starts up a virtual machine with your container ready to go. There are many more options you can set but at its most basic level it exists simply to run your container.
  2. Azure Database for MySQL — This is a SQL database that lives inside of Microsoft Azure and they will manage the hardware necessary to host it, apply updates to the database software, and retain backups of your databases for you. This is what will store all of the text on your wiki pages as well as all of the user accounts and some basic settings for the wiki.
  3. File shares — These exist inside of a Microsoft Azure resource known as a Storage Account. These can be thought of network attached storage where Azure manages the hardware. They can be attached to your Container Instances which will allow you to store images and any uploaded files.

You will also need a copy of the MediaWiki container. However, it is important to know that there are several small modifications that need to be made to the base image so that it will function properly on Microsoft Azure. The webserver inside of the container requires two lines of code to be modified so that it can serve files from the file shares. The operating system inside of the container also needs to know where to locate the file shares. All of these changes are documented in my GitHub MediaWiki-Azure-CI Project page. You will be able to build the image yourself using the provided files. A copy of the modified container image is also already available on DockerHub at mediawiki-azure.

How Do You Setup and Deploy These Resources?

Most of the resources can be provisioned by using the “Create a Resource” function inside of the Azure web Portal. However the Container Instance creation through the portal will not allow you to attach file shares to your containers. To do this you must create the Container Instance using an Azure Resource Management (ARM) Template where you specify the name and location of your file shares.

To make the deployment as easy as possible I have created deployment guides, templates for all of the Azure resources you will need to get up and running, and documentation of how to use those templates and what the decision points you in each of them are. All of this can be found on my GitHub MediaWiki-Azure-CI project page.

Deployment Guides

There are two different ways you can deploy the Mediawiki container to a Container Instance. The first is to use a Container Registry in Azure. This is the recommended method as it allows you to control the image that will be used when running the application.

The second is that you can pull the modified MediaWiki image directly from DockerHub using either your own repository or mine where I share it publicly. When using the Container Instance temple to deploy from DockerHub it will default to using my repository and image. You will be able to change this to your own if you like.

Deploying From Azure Container Registry

  1. Creating a Container Registry
  2. Installing Docker Desktop, Building and Uploading the Custom Image
  3. Creating the File Shares
  4. Creating the MySQL Server
  5. Creating the Container Instance with an Azure Container Registry Image
  6. Putting the Container into Setup Mode
  7. Configure the Wiki
  8. Modify and Upload the LocalSettings.php
  9. Restarting the Container Instance

Deploying From DockerHub

  1. Creating the File Shares
  2. Creating the MySQL Server
  3. Creating the Container Instance with an Image on DockerHub
  4. Putting the Container into Setup Mode
  5. Configure the Wiki
  6. Modify and Upload the LocalSettings.php
  7. Restarting the Container Instance

Hopefully this helps others in small to medium sized organization build out a robust knowledge sharing solution that requires minimal system administration.

Further Reading:

Create Bots to Automate Tasks in MediaWiki

--

--