How I set up a wiki for "Game of Rôles", the French better "Critical Role"
Tags: docker, wiki, devops, tutorial
Published: 2021-06-15 04:58:53

There is a show I love on Twitch on the channel of [MisterMV](https://www.twitch.tv/mistermv): Game of Rôles. It is an actual play of an original table RPG created by [FibreTigre](https://www.fibretigre.com/). To help the show, I decided at the time to create a wiki for it: [https://gameofroles.wiki](https://gameofroles.wiki). And here is how I did it.

Prerequisites: 
* [Docker](https://www.docker.com/) 
* A server with yourdomain.com already pointing at it
* 5-10 minutes

Everybody knows Wikipedia. But few know that Wikipedia is actually running on open-source software. The Wikimedia Foundation develops its own wiki engine. And they use it for all their projects, including Wikipedia, Wiktionary, and others. This wiki engine is named [MediaWiki](https://en.wikipedia.org/wiki/MediaWiki). That being said now, that's what we are going to use here to set up our own wiki :-)

First, you need a server with Docker installed on it. So obviously I would recommend a Linux server for that matter. For example, Digital Ocean proposes a Droplet image with Docker preinstalled on Ubuntu. With a couple of clicks, you can get a Droplet setup with Ubuntu and Docker ready to go. AWS and others have likely similar images in their inventory too. 

In Docker Hub, you can find this Docker image: https://hub.docker.com/mediawiki/. This is the official docker image from the Wikimedia Foundation itself. This is definitely what we want to use. 

Then, considering your wiki project, decide whether you need a MySQL-like database or the default embedded SQLite. In my case, I decided to use SQLite. Why? I knew the community watching the show was not huge. Hence, I did not need the database to scalable, and a simple SQLite is pretty enough. The show had regularly 2-4K viewers at the time I created the wiki in 2018. Actually nowadays in 2021, it has 16-20K viewers. And the wiki is still standing pretty well. 

Now to warn you, there's a little trick to deploy your MediaWiki with Docker. First, create a folder wherever you want to store all the files related to the wiki. Then, start the wiki. Visit your wiki at http://yourdomain.com. Do the setup. And download the `LocalSettings.php` generated for you. 

Here is the code I used to start the wiki:
```bash
# Create the folder
mkdir wiki; cd wiki
# Start the wiki setup
docker run --name my-wiki -d -v /wiki/data:/var/www/data -v /wiki/images:/var/www/html/images -v /wiki/extensions:/var/www/html/extensions  mediawiki
```

Once you have the file `LocalSettings.php`, upload it into your wiki folder. Finally, delete the current container. And restart a new container with this `LocalSettings.php` mounted, and you are ready to go.
```bash
docker rm -f my-wiki
echo -e "docker run --name my-wiki -d -v /wiki/data:/var/www/data -v /wiki/images:/var/www/html/images -v /wiki/extensions:/var/www/html/extensions -v /wiki/LocalSettings.php:/var/www/html/LocalSettings.php --restart=always mediawiki" > start.sh
chmod +x start.sh 
./start.sh
```

The command to start the container is kinda long. So I suggest saving it in a `start.sh` to avoid typing it ever again. 

Voilà, then visit yourdomain.com and your wiki is ready to use.