Tutorial - Minecraft server running in Kubernetes on releasehub.com (free)
Tags: devops, startup, gamedev, kubernetes
Published: 2020-12-17 23:39:06

---
canonical_url: https://releasehub.com/blog/free-minecraft-server-running-on-releaseapp-io
---
# Setup your own free Minecraft Server running on releasehub.com

One of the coolest things about working at [Release](https://releasehub.com) has been figuring out all of the fun stuff that we can do with the platform. While our main use case is helping people build environments for their applications, anything that runs in Docker will run easily on Release.

Early on, I found a handful of repos that helped us build out our platform. One that has been the most fun all along is the [docker-minecraft-server from itzg](https://github.com/itzg/docker-minecraft-server). I used it in the early days because it had a little complexity and a fully working docker-compose ecosystem to play around with. It’s got the great side effect of when it runs, I let my kids test it out!

So while you’re sipping on egg nog and enjoying a 2020 Holiday season on COVID lock-down, here’s a walkthrough of how to get your very own free Minecraft server up and running on Release. 

I highly recommend following along on the video tutorial. I've included step by step instructions for anyone that learns better through reading or if you're confused about a step.

If you want to see a live version of this setup, we fired up our own Minecraft server that we built using these steps. So if you're bored over the Holidays, pop in and say hello! Here's our Server name if you want to say hi.
 
> __Play Minecraft With Us on the Release Team Minecraft Server__
> 
> __team-release-minecraft.releaseapp.io__


# Full video walkthrough of this tutorial

{% youtube cBDr5LwJb34 %}

# Detailed instructions to get your Minecraft Server up and running

## Background

At the time of this writing, we have a [“Starter” plan](https://releasehub.com/pricing-page) that’s free so you can give this a shot and have some Holiday fun on Release. Since we’re hosting all of the environments on Release on the starter plan we have a limitation of 2Gb/container. That’s sufficient for a Minecraft server for your kids and their friends.

To get started, take a look at [https://github.com/awesome-release/docker-minecraft-server](https://github.com/awesome-release/docker-minecraft-server), which we cloned from [itzg](https://github.com/itzg/docker-minecraft-server). Fork or clone this repo into your GitHub account so you’ve got your own version of it to play around with.

Once you’ve got your own repo to work with, I recommend taking a quick read through the [README](https://github.com/awesome-release/docker-minecraft-server/blob/master/README.md), there are a lot of configuration options and the documentation is extremely well done. 

We're also going to use the [Rcon Web Administrative portal. Take a look at the documentation](https://github.com/rcon-web-admin/rcon-web-admin), *specifically the environment variables that can be configured.* itzg made a version of this for Docker called [docker-rcon-web-admin](https://github.com/itzg/docker-rcon-web-admin) that we are using when when we load the rcon and rcon-ws services in this tutorial.

For this walkthrough, we’re going to bring up a vanilla Minecraft server with an Rcon administrative portal running in a standalone container. This will let you and your kids have full control over the Minecraft server and ban friends who can’t fight off Zombie Pig Men.  Here's an overview of what the system architecture looks like.

![High level overview of Minecraft with Rcon](//images.ctfassets.net/qf96nnjfyr2y/2wNwcLD1zGZRa5lebjeTtx/1f910bef3c2f3b07bdb076b6185493f9/Screen_Shot_2020-12-14_at_4.50.14_PM.png)

The master branch of this repo is already setup to work with this docker-compose file in Release. Take a look at the .release.yaml file in the root of the repo’s directory. 

    compose: examples/docker-compose-with-rcon.yml

This sets the `compose` directive to `examples/docker-compose-with-rcon.yml’ which tells Release that’s the docker-compose file you want to use. If you want to play around with a Forge server or other examples, just point the .release.yaml file at the corresponding docker-compose.

## 1. Create a new application in Release

Ok, let’s setup the server.

- Fork, clone or copy this repo: [https://github.com/awesome-release/docker-minecraft-server](https://github.com/awesome-release/docker-minecraft-server) [Here are some simple instructions on how to copy this repo over to your account.](https://docs.github.com/en/free-pro-team@latest/github/creating-cloning-and-archiving-repositories/duplicating-a-repository)
- Login or create an account on Release here: [https://releasehub.com](https://releasehub.com)
- Follow the steps to create your account. Once your account is created, click the “Create an application” button.

![Create new app button](//images.ctfassets.net/qf96nnjfyr2y/6VWjyyZyzQTIMKKOhMtDJR/968a10010225386a27a2fd8140bdf11c/Screen_Shot_2020-12-17_at_8.34.49_AM.png)

- Select your `docker-minecraft-server` repo. If you don’t see it in the list, click `Configure the Release app on Github` link to assign permissions to your repo.

![Select your repo](//images.ctfassets.net/qf96nnjfyr2y/150rdMfSZdsZNfKjAO2wnp/58321bf2af11408179188ba4af26b477/Screen_Shot_2020-12-17_at_8.37.00_AM.png)

- Add a name for your application. Note this name is used in your server hostname.
- Click Generate App Template. 

![Click Generate App Template](//images.ctfassets.net/qf96nnjfyr2y/3AKC0zgywkvWOKaMANDqE2/0f6d197f208a81718c4ef13211ba23d2/Screen_Shot_2020-12-17_at_8.38.03_AM.png)

## 2. Edit the generated application template

Release automatically detects and creates an application template from the docker-compose file but there are a few edits we need to make based on how this repo works and to make sure we can fit the server into the Starter plan. If you want to dive in, [read the documentation about Release Application Templates.](https://docs.releasehub.com/reference-guide/application-settings/application-template)

For a little background, take a look at this diagram.

![docker-minecraft-server networking architecture](//images.ctfassets.net/qf96nnjfyr2y/31tYP2pKpmfWZcrZ1BGXNP/f93c93fea06f66b3c203a3b792eb7268/Screen_Shot_2020-12-17_at_8.56.30_AM.png)

We need to make our application reflect this networking setup. 

In Release we have two different kinds of loadbalancers based on Amazon's [ELB's](https://aws.amazon.com/elasticloadbalancing/?elb-whats-new.sort-by=item.additionalFields.postDateTime&elb-whats-new.sort-order=desc) and [ALB's](https://docs.aws.amazon.com/elasticloadbalancing/latest/application/introduction.html). 

We also need to make sure we're using the correct type of port for the use case. There are two types of ports `container_port` and `node_port`. In short, a `node_port` is exposed to the Internet and a `conatiner_port` is not. Because the rcon service is only internally facing, we want to set its port to a `container_port`. For more info on setting the correct type of port, [read about ports in Release](https://docs.releasehub.com/reference-guide/application-settings/application-template#ports).

So let's make the changes necessary to setup the Application Template correctly.

### Update memory to 2Gb

![Increase to 2gi](//images.ctfassets.net/qf96nnjfyr2y/1qhpslhwNOzPwpGPUjFdpg/eeebe9a0fcb4fb89fb2117492bcd777b/Screen_Shot_2020-12-17_at_8.49.13_AM.png)

- The Minecraft server is setup to use 1Gb of max memory so we need to set the default memory limit in Release to 2Gb to leave enough room with some overhead. Edit the app template to allow the services to use up to 2Gb of memory.

### Update hostnames and ports

![Change ports settings on the minecraft service](//images.ctfassets.net/qf96nnjfyr2y/2mbzeFvsEzBbHDcZDQZfNs/7a6d72c07e0a2962d1133c72a2863e32/ports-minecraft.gif)

- Change the port `type` for 25575 to `container_port` and remove the `target_port` line.
- Add a `loadbalancer: true` for port 25565.
- Add a hostname field at the same level as ports in the file and set to `hostname: my-server-${env_id}-${domain}`. You can set `my-server` to anything you'd like. ${env_id} and ${domain} are variables that Release will automatically fill in to customize your domain.

![remove minecraft alb](//images.ctfassets.net/qf96nnjfyr2y/5Hq9WPLrep8YTOStorAv72/308cec8a27f9d421a15f151eb5168139/remove-minecraft-alb.gif)

- Remove the ALB hostname for the `minecraft` service. (We only need the `minecraft` service exposed on port 25565 via an ELB not an ALB which is for http/https).
- Click "Save and Continue".

## 3. Setup Environment Variables

We need to set a few passwords via environment variables and an [environment variable mapping](https://docs.releasehub.com/reference-guide/reference-examples/environment-variable-mappings) for the `rcon` websocket hostname. For more information about these environment variables, see the documentation/README files here:

- [Rcon environment variables for the `minecraft` service.](https://github.com/awesome-release/docker-minecraft-server/blob/master/README.md#rcon)
- [Environment variables for rcon-web-admin](https://github.com/rcon-web-admin/rcon-web-admin#environment-variables)

In this diagram we show the passwords that need to be set via environment variables.

![Passwords via environment variables](//images.ctfassets.net/qf96nnjfyr2y/3xnIcjv4BCvfY0Ho2byE2p/8f5951634c0a30eae280e3c832d47867/Screen_Shot_2020-12-17_at_10.37.01_AM.png)

### Setup passwords via environment variables

![rcon password envs](//images.ctfassets.net/qf96nnjfyr2y/3pzhiCBkhpQ8R4JLKv1YEc/7f53d78a57268a98bdf530e520760407/rcon-password.gif)

On the `minecraft` service we need to set a password for its local `rcon` service on port 25575 so other containers can connect to it. `RCON_PASSWORD` is the environment variable that needs to be set for this and on the `rcon` and `rcon-ws` service we need to set `RWA_RCON_PASSWORD` to the same value so those services can control the minecraft server.

![rcon web password](//images.ctfassets.net/qf96nnjfyr2y/3Bqx50fbcFEQo8TeLaWRB1/fb36558ae0cf90fd33ae91a01909438b/rwa-password.gif)

- Click on "Edit" for "Default Environment Variables".
- Set `RCON_PASSWORD` in the `minecraft` service and add `secret: true`. To encrypt this value in the database.
- Set `RWA_RCON_PASSWORD` to the same value as you set in step 2 on both the `rcon` and `rcon-ws` services.
- Set `RWA_PASSWORD` which will be the default password used for the RCON Web Administration tool in both the `rcon` and `rcon-ws` services. Make sure to add `secret: true` to encrypt this value.

### Setup mapping of environment variable RWA_WEBSOCKET_URL_SSL

![rwa webscoket hostname mapping](//images.ctfassets.net/qf96nnjfyr2y/H7q1NXUl6g0oZ6iYgjnMH/c49e8375ed880c46c302dbb0468f2cd2/Screen_Shot_2020-12-17_at_10.55.38_AM.png)

The last environment variable we need to add is a mapping that tells Release to map `RWA_WEBSOCKET_URL_SSL` to a dynamically created environment variable for hostnames created in Release `RCON_WS_INGRESS_HOST`.  `RWA_WEBSOCKET_URL_SSL` tells the Rcon Web Admin tool which container host url is running the websocket for this service which is on our `rcon-ws` service on port 4327. 

`RCON_WS_INGRESS_HOST` is automatically created everytime a new environment is created by Release and always conatins the correct hostname for `rcon-ws`. This value can change when new environments are created, thus we can't just hard set `RWA_WEBSOCKET_URL_SSL`.  This is where an environment variable mapping comes into play. The diagram above represents the change we need to add in our Default Environment Variables.

![set env mapping](//images.ctfassets.net/qf96nnjfyr2y/1W93m0C2YME1uskGVo6fqA/d1c09555747b8d2578f597a44c3fd3d8/env-mappings.gif)

- Add a `mapping:` directive and map `RWA_WEBSOCKET_URL_SSL` to the top of the file.

```
mapping:
  RWA_WEBSOCKET_URL_SSL: wss://${RCON_WS_INGRESS_HOST}
```
When these chages and your env passwords have been made, your file should look like this:
```
---
mapping:
  RWA_WEBSOCKET_URL_SSL: wss://${RCON_WS_INGRESS_HOST}
defaults:
- key: RWA_RCON_HOST
  value: minecraft
services:
  minecraft:
  - key: EULA
    value: 'TRUE'
  - key: MAX_MEMORY
    value: 1G
  - key: ENABLE_RCON
    value: true
  - key: RCON_PASSWORD
    value: "rcon_password"
    secret: true
  - key: VIEW_DISTANCE
    value: 15
  - key: MAX_BUILD_HEIGHT
    value: 256
  rcon:
  - key: RWA_RCON_HOST
    value: minecraft
  - key: RWA_RCON_PASSWORD
    value: "rcon_password"
    secret: TRUE
  - key: RWA_PASSWORD
    value: "rwa_password"
    secret: true
  rcon-ws:
  - key: RWA_RCON_HOST
    value: minecraft
  - key: RWA_RCON_PASSWORD
    value: "rcon_password"
    secret: TRUE
  - key: RWA_PASSWORD
    value: "rwa_password"
    secret: true
```

- Click 'Save & Deploy'

![deploy and view environment](//images.ctfassets.net/qf96nnjfyr2y/FKamQWEAPHoWSCN6y3rIJ/05f8d3e75578b3042fe253226625dc03/deploy-and-inspect.gif)

- Your environment is now deploying, you can click on the deploy and watch its progress. When it's done, navigate to the environment screen and inspect your created hostnames.


## 4. Setup the Minecraft Client to Connect to your new server and login to the RCON web admin tool.


![Setup minecraft server](//images.ctfassets.net/qf96nnjfyr2y/tsY55jHlEsGV1qQdVtJRl/3590ce1e1adde7289c182ed44d708d17/setup-minecraft-server.gif)

- Using the `minecraft` hostname that was created by Release, create a new server within the Minecraft Client.

![rcon web admin tool](//images.ctfassets.net/qf96nnjfyr2y/2bqtxnSkRmiTzFGDPe2nJw/13e466cf36005fac0ba61dd1a4501e31/rcon-web-admin.gif)

- Click on the `rcon` hostname that was created by Release to access the RCON Web Admin user interface.
- Login using the same password you set for the `RWA_PASSWORD` environment variable.
- Add the `minecraft` server.
- Add the `console` widget.
- Run admin commands on your server!


## What if it doesn't work???

If for any reason you made a mistake and something doesn't work. You can navigate to your App Settings and edit your Application Template and your Default Environment Variables. Double check you've made the proper settings. Once you've made these edits, navigate to your environments screen, delete your environment and create a new one. The beauty of Release is environments can be torn down and up whenever you want. Here are the links to the docs on how to edit your App Template and Default Environment Variables.

- [Modify Application Settings](https://docs.releasehub.com/reference-guide/application-settings)

__Delete and Create a new Environment__

![delete and create new environment](//images.ctfassets.net/qf96nnjfyr2y/690Qo5GAdls6r4zotrNRXD/09ecbd813c067044474a5e432dda5067/delete-and-create.gif)

# Conclusion

You now have your very own Minecraft Server running on the Release Starter Plan. This server was created in an Ephemeral Environment in Release and will destroy itself in 7 days. If you'd like your server to remain indefinitely, you'll need to delete the environment and re-create it as a permanent environment. 

![delete and create new environment](//images.ctfassets.net/qf96nnjfyr2y/690Qo5GAdls6r4zotrNRXD/09ecbd813c067044474a5e432dda5067/delete-and-create.gif)

Make sure you choose permanent when creating the environment.

With the RCON Web Admin tool you can control and make the server your own special place. If you have any questions, please contact the Release team at <a href="mailto:hello@releasehub.com">hello@releasehub.com</a>. Jump in and say hello on our Release Team Minecraft Server here:

> team-release-minecraft.releaseapp.io

__Happy Holidays from the Release Team!!!__