Configure MediaWiki on QNAP with Docker

This post is over a year old, the information may no longer be up to date.

I recently bought a new QNAP to replace my old one as it 8 years old and was starting to struggle with basic tasks. It also never had any virtualization ability or QNAP Container Station so there was quite a lot of things I wasn’t able to do that I would have liked. I did try configuring MediaWiki on my previous QNAP NAS but because it was being installed along side everything else I had, the PHP versions were conflicting with something else and it was just a mess.

Screenshot of Container Station on QTS 5.0

My understanding of Container Station is it’s meant to be noob friendly but it actually feels the complete opposite. I spent hours today and last night trying to get MediaWiki working on it but was getting every problem under the sun, mostly to do with apache and volume mounts. I did some googling around and found that docker compose will also work and store the containers in Container Station (although you can’t actually do anything with them in container station apart from see them), so I decided to go down that route.

From reading online it was recommended to store your non-persistent data in an easy to access location for yourself, but also someplace where it won’t get nuked every time your container stops or your QNAP gets restarted. I decided to create a shared directory under my Data Volume called AppData and ‘symlink’ the data to these locations, this also makes it easier for me to run backups offsite and manual if I want. This isn’t required, but I highly recommend doing it as that’s how I’ll be explaining it with my docker compose file.

Screenshot of File Station on QTS 5.0

# Tutorial

Connect to your QNAP via your chosen browser and open File Station. Once open right click on your Data Volume and create a new shared directory, the name doesn’t matter but I called mine AppData as that’s what will be in there.

Under that directory create another directory called ‘Wiki’, and then two directories under it called ‘database’ and ‘images’, again, the names don’t matter but if you do use something else you’ll need to make sure to change the path in the docker-compose.yml file. If you click the link just before this sentence it will download the docker-compose file that I have used and contains comments on what each line does and is for.

Screenshot of Docker Compose file

You’re going to want to upload that docker-compose file to your previously created Wiki directory and then open CMD on Windows or Terminal on macOS and SSH into your QNAP Server. Once you’re SSH’d into your QNAP server you’re going to want to go to your previously created AppData directory. It might be a bit of a pain to find this, but for myself the path was /share/CACHEDEV1_DATA/AppData/. Within here you should be able to see your Wiki directory, change into that directory and then list the contents, you should see something similar to the below (minus the LocalSettings.php file).

Screenshot of SSH

Assuming everything went to plan, you’re now going to run docker-compose up -d which will create the MediaWiki container on the port that you specified in the docker-compose file, if you left it the way I had it the port will be 4441. Once it’s finished creating the container, you’re going to want to go to http://nasip:4441 and you will be welcomed with the MediaWiki configuration page. Go through that process and download the LocalSettings.php file at the end.

Now that you’ve got the LocalSettings.php file, you need to place it in the AppData/Wiki directory next to the database and images directories. Download the docker-compose file from your File Station and uncomment the line that mentions LocalSettings. It should look similar to the below.

Screenshot of Wiki Directory in File Station

You now want to go back to SSH and run docker-compose stop and then run docker-compose up -d again. MediaWiki should now be configured for use based on what you put in during the configuration screen.

Any issues, feel free to contact me.

Good Tune via Spotify