;

hosting a minecraft server in windows azure using resource manager templates

Posted : Saturday, 19 March 2016 21:10:00

My eldest child is 5 and like so many other parents of children of that age, Minecraft has become part of my life (by proxy at least). While up until this point it was purely a conversational presence with minimal technical input required, my son recently asked if he could play online with his school friends. Reading up on this there are plenty of service providers out there as well as plenty of guides on how to self host….I figured that it couldn't be that hard so I’d give self hosting a go.

Originally I planned to run it on my home server but after a bit of thought I decided that a cloud based approach would make the most sense (reliability, availability, support etc.) especially as I get regular monthly Azure credits by virtue of my employer being part of the BizSpark program. So how to go about this...

I found a VM Image on the Marketplace:

https://azure.microsoft.com/en-us/marketplace/partners/microsoft/minecraftserver/

Going through the setup process I noted that this image relies on the Classic deployment model so might possibly be a bit old...

image

 

I ran through the setup process, clicked create and after about 10 minutes the VM was up and running, I fired up the Minecraft client and tried to connect to the server via the DNS name on the settings page of the VM in the Azure portal...

image

Rats! The Minecraft client on my PC is 1.9 and the VM server in the image is 1.8 - based on that message 1.9 is not backwards compatible. I considered setting up a VNC client and trying to remote in or using SSH to upgrade the server both of which sounded a bit fiddly...after a bit of Googling I found this post:

https://msftstack.wordpress.com/2015/09/05/creating-a-minecraft-server-using-an-azure-resource-manager-template/

This post uses a different approach, namely scripting the Minecraft server via an Azure Resource Manager template. This approach is preferable for a number of reasons including the fact that it uses the currently favoured Azure Resource Management API. I followed the blog post which said to go to this GitHub project:

https://github.com/Azure/azure-quickstart-templates/tree/master/minecraft-on-ubuntu

and hit this button:

image

This button took me to the Azure portal where I filled in a few details as per the post, accepted some Ts+Cs and bosch! I was done – RIDICULOUSLY easy!

10 or so minutes later and my server was up and running, as before I grabbed the DNS name for the VM and connected my Minecraft client to it:

image

Slightly disappointing but I figured this would be easier to upgrade than the VM image I had used before. I went back to the GitHub repo and of the five files listed:

image

I figured that “install_minecraft.sh” would probably be the place to look...

image

Sure enough lines 50, 52 and 74 looked good candidates to update, I made sure that the 1.9 server jar was located where I guessed it should be, https://s3.amazonaws.com/Minecraft.Download/versions/1.9/minecraft_server.1.9.jar, which it was. I forked the repo, edited the file via the GitHub user interface and committed. I had a quick review of the other files and noted a couple of additional required changes:

1) README.md – this is the page that contains the magical “Deploy to Azure” button, I had to update this use the template from my fork

image

2) azuredeploy.json – I had to alter this file to use the updated “install_minecraft.sh” script from my fork

image

I committed both these changes and the clicked “Deploy to Azure” button on the home page of my fork (the one I updated in 1) above. I filled out the fields as before, hit create and 10 minutes later my updated server was up and running. I grabbed the DNS name for the VM from the Azure portal:

image

Connected to it from my Minecraft client (fingers crossed)…

image

 

TA DA!!! ace! – my son, his friends and my nephews are all able to connect and play Smile.

For the record I knew nothing about Azure Resource Manager templates before this post and without any prior reading was able to jump straight into modifying them (thanks to GitHub) and seeing the results pretty much instantly. Azure just keeps getting better!

The only other thing I did was add the Minecraft version as a parameter to the script which allows the choice of Minecraft version via the template so future upgrades should now be easier to support. The whole thing was really easy, really satisfying and as a bonus I have submitted my first pull request too – sweet!

  • (This will not appear on the site)