Containerisation with Docker Part Two

Having successfully got WordPress and MariaDB running in Docker containers and talking to each other so they could host this very website my attention turned to what else I could run in a Docker container that might be useful.

My son is, like most children his age, interested in Minecraft. Minecraft can be played on a variety of different platforms from mobiles to laptops to games consoles. Generally these games are played in isolation or via a direct invitation between two or more players but there is another option which is to have a server that one or more players can connect to. That doesn’t rely on any one player having to host a game.

Interestingly there are several pre-built Docker containers for Minecraft servers. The most popular seems to be Note that I’ve chosen one that mentions “bedrock”. There are two types of server one for Java edition which can only be used from the Java version of Minecraft which runs on PC and the other is used by the console, Windows 10 and mobile editions and that is the one known as Bedrock edition.

As I had done previously I created a folder on the host VPS server that would hold the data for the Minecraft container so that we could control settings on it and enable it to persist across container restarts. I mapped this folder to the container using the settings in the Plesk control panel and then set an environment variable called EULA and set the value to True which is required to make a Minecraft server start successfully. I also configured the appropriate port and allowed it through the Plesk and IONOS firewalls.

I started up the container and watched the logs report a successful startup. Then it was time to try and connect to it. This was surprisingly difficult because Microsoft don’t allow users to specify servers on Xbox One edition. However as is often the case someone ingenious on the internet had provided a workaround and we were soon able to find a way to connect to our server and my son was able to start doing some work on the world generated on the server.

The next task was to prevent the entire internet from connecting to the server. There is an in-built way of doing this by using a file named whitelist.json which contains a list of known Minecraft users who can access the server but this relies on all users having Microsoft / Mojang accounts which not all of my son’s friends had. This meant we had to go slightly old school and use a firewall restriction in the Plesk control panel so after teaching some 12 year olds how to use What’s my IP we had a list that we could use to restrict access to only those that were permitted to connect.

Containerisation with Docker – Part One

Running applications and services in their own containers has become popular recently. Containers have several advantages over virtual machines including the lack of requirement of another licence and no need to dedicate resources to the virtual machine.

Docker is a tool that allows us to create containers.

I recently obtained a VPS server from IONOS to use to do a little bit of research on various topics and decided that Docker would be a good starting point. The VPS server administration panel included Plesk and I was able to install Docker using Plesk.

Using the GUI in Plesk I created containers for MariaDB and WordPress because my first intention was to create a WordPress website that I could use to host a blog (wonder how that turned out?!).

Whilst the GUI allowed me to do a certain amount of configuration of the containers for each of the applications it soon became apparent that I would need to use the command line to really get the most out of Docker.

As an aside it’s interesting how much more prevalent the use of command line tools is these days, when I started working in IT command line tools were already practically out of fashion but they are back with a vengeance these days. I guess Powershell might have kickstarted that in the Microsoft stack and obviously working with Linux or Unix based systems has always been easier with the command line.

The first thing that I needed to do was to create folders on the host machine that could be mapped across into the containers to provide persistent storage. A container effectively starts from scratch each time it is started so for anything to persist it needs to be stored on the host machine and the location of that storage needs to be mapped into the container. Using an SSH connection to the VPS I created directories that could be used to hold data for the MariaDB and WordPress containers.

I could then use the environment variables configuration in Plesk to map these new directories so that they were available to the Docker containers. Starting the containers everything seemed to be good but WordPress needs to know where the database it can use is as it starts up and currently I had two containers and needed to get them to talk to each other.

The way to establish connection between the two containers was to create a network and then add the two containers into that network using the following three commands:

docker network create [networkname]
docker network connect [networkname] [dbcontainername]
docker network connect [networkname] [wordpresscontainername]

Now both containers can talk to each other using the logical names attributed to them in the environment variables.

All that was left was to configure a rule in Plesk to forward requests to the domain name through to the WordPress Docker container and to then start both containers. When I accessed the domain name I was then able to complete the WordPress installation.

The final test was to stop both containers and check that when they restarted the installation was still all set up – I tested it and it was so my first Docker containers were up and running.

SQL Server Encryption – A problem solving journey

Working in Software Development you always tend to rely a bit on your search engine of choice to help you out from time to time. There’s no way anyone can remember every single piece of syntax that they might need so being able to quickly lookup how to do something is very useful. It’s also generally the case that someone else has already suffered through the same experience you currently are and took the time to post about it so that you can get the benefit of their experience.

But what happens when the particular problem you’ve come across doesn’t seem to have a solution that you can find? That’s when you need to reach out to a community and try and get some additional help.

This happened to me recently – we were trying to produce a proof of concept to migrate a database from an on-premise SQL Server 2008R2 instance to Azure SQL Database. Ordinarily this is a fairly straightforward task but this particular database used column level encryption and no matter what we did we were unable to get the encrypted data to decrypt correctly at the Azure destination. I posted a question on SQL Server Central and soon found myself engaging with the site owner, Steve Jones. Steve’s help and a couple of seemingly unrelated articles lead us to a solution and when I explained it to him Steve asked me to write it up as an article for the website.

I did so and now maybe documenting my pain will prevent someone else having the same issue. The long and short of the solution is that the encryption algorithm used by SQL Server changed from version 2017 onwards which means you can’t recreate a certificate on a version prior to that on those versions. Here’s my full article on the topic.

Pride of Anglia Bar Chart Race

I’ve recently seen several animated graphs appearing on my Twitter feed depicting various different types of data such as the most populous cities in the world and brand names by income. After the initial wow factor at data being shown this way I decided I wanted to find out how they are done and, as always, the best way of learning is by doing. So this article describes the process I went through.

The first thing that you need is a data source and I decided that I’d use my interest in football to create a bar chart race showing the most successful team in East Anglia based on their final league position in each football season since the end of the World War Two. I used Wikipedia as my source, probably not the best source for this kind of data but it came up first in a Google search so I used it.

The first challenge was to translate the league positions in each division to an overall place in the league structure this meant being aware of when divisions were restructured. I decided not to include a team until they first entered the four league divisions but did include positions for teams if they dropped into non-league having already entered the league structure.

The end result after a fairly complicated formula in the spreadsheet gave me a number for each team for each season after they first entered the league. The next task was to find a way to generate my bar chart race.

I looked at a few ways of creating the final product and settled on Flourish as one that seemed to have the easiest path to entry. I created a new Visualisation and found the bar chart race template. A default set of data loads but I then switched to the Data section and deleted what was already there. I then used the Upload data file option to upload my spreadsheet. My spreadsheet had columns for each team to show their league position for each season with the seasons in column A. This didn’t map to the bar chart race but fortunately Flourish includes an option to switch rows and columns which was exactly what was needed to structure the data correctly. The next thing was to do some formatting to make it look a bit better. Flourish makes this easy by allowing you to dedicate a column of data that can be used to categorise data by colour and another that can be used to hold an image. I chose to represent the main colour of the team’s shirts in the Category column and to store their badge in the Image column. Having done what was necessary on the Data section I switched back to the Preview window and saw the fruits of my labour which wasn’t too bad for a first attempt. There were a few options that I tweaked, for example slowing down the transitions and adjusting font sizes. Here’s the final output:

Overall Ipswich finished higher in 46 seasons and Norwich higher in 25 seasons. Both Colchester United and Southend United actually finished highest in one season but because of the transition speed they never quite take their place at the top – perhaps I’ll try and slow the transitions down further in a future update.

Blurring part of an image

I’m very much from a software development background not a graphic design one but from time to time it is necessary to have to do a little bit of dabbling in the dark arts of graphic design.

The task this time was to blur out a section of the image I wanted to post online. It was taken at a local zoo with a Lorikeet on my head but there were other people in the picture who probably didn’t want to become world famous by appearing over my shoulder on a photo on my blog so I decided I should blur them.

I used FireAlpaca ( because it’s free and who doesn’t like to have a bow tie wearing Llama who seems to be in the fiery pits of hell helping you with your graphic design needs?!

I opened up the photo in FireAlpaca and then used the Lasso tool to carefully select the section of the image I wanted to blur. This took a couple of attempts because using my trusty Toshiba laptop’s trackpad lead to accidentally selecting most of my ear the first time around which might have made me look a little strange.

Having selected the portion of the image to be blurred I then clicked on the Filter menu and selected Gaussian Blur. I selected a value of 20 to ensure the faces were sufficiently blurred. I then saved the file as a png format to upload to the blog.

It’s not a masterpiece but it’s a useful technique so I’m committing it to this blog.