minecraft

Technical resources

Disaster Recovery of Minecraft Server from ROSA to ARO

February 27, 2023
5 minute read
Related products: Red Hat OpenShift

Red Hat OpenShift cloud services help you automate the deployment and management of Red Hat OpenShift clusters so that you can build, deliver and maintain applications across every major public cloud environment—in less time. Red Hat OpenShift Service on AWS (ROSA) and Microsoft Azure Red Hat OpenShift (ARO ) are two services that Red Hat co-manages with AWS and Microsoft. 

Application data protection on ARO/AWS is critical for businesses. Though Open Source Tools such as Velero provides kubernetes backup and restore functionality, Trilio provides enterprise-level features such as 24x7x365 support, scalable performance, hooks, operation visualization, and so on.

Our goal here is to demonstrate as a partner how you can execute seamless disaster recovery by backing up a Minecraft server in ROSA and restoring it in ARO. Minecraft is the best-selling video game in history, with over 238 million copies sold and nearly 140 million monthly active players as of 2021 and has been ported to several platforms." We thought it is the most renowned game in the world, and it is the perfect example of stateful application, while having some fun at the same time.

Prerequisites

Backing Up Application on ROSA

Create Trilio Backup Plan

The ansible playbook automates the following tasks to backup Minecraft server data to an AWS S3 bucket. 

[st@rtrek ansibledr]$ ansible-playbook backupsite.yaml

Backup is ready:

Image
Screen showing monitored results

Deploy Minecraft Server Application

The following commands deploy the Minecraft Server through a helm chart. The application provides a Load Balancer Service that maps to an AWS Elastic Load Balancer Service. Minecraft Client uses the Load Balancer IP to connect to the server.

oc project demo-minecraft

oc adm policy add-scc-to-user anyuid -z default -n demo-minecraft

helm repo add itzg https://itzg.github.io/minecraft-server-charts/

helm upgrade --install minecraft -f ./values.yaml --set minecraftServer.eula=true,minecraftServer.white-list=rodolfo itzg/minecraft

Get the IP address of your Minecraft server by running these commands in the
same shell:

!! NOTE: It may take a few minutes for the LoadBalancer IP to be available. !!

You can watch for EXTERNAL-IP to populate by running:
  kubectl get svc --namespace demo-minecraft -w minecraft-minecraft
 

 

Image
Minecraft edit server info screen

Create the backup

Now generate some stateful data and states by playing Minecraft !. Ansible Playbook backs up the data to the S3 target.

[st@rtrek ansibledr]$ ansible-playbook createbackup.yaml

Restore Application to ARO

Ansible Playbook automated the process. This playbook creates an empty namespace, “demo-minecraft-restore”, a secret for the target, a target that holds the AWS S3 secret.

After a few minutes, everything will be restored in that namespace. ARO will create a LoadBalancer service in that the Minecraft client uses the external IP to connect to the server.

[[st@rtrek ansibledr]$ oc get all 

NAME READY STATUS RESTARTS AGE  pod/aws-sa-demo4-target-browser-l7ztek-6b5575db7-g5sl6 1/1 Running 0 6m49s  pod/minecfqnu-minecraft-6447d44cb5-v7qhh 0/1 Running 0 27s

NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE  service/minecfqnu-minecraft LoadBalancer 172.30.184.128 20.102.37.28 25565:31879/TCP 28s  service/tb-aws-sa-demo4-target-browser-l7ztek ClusterIP 172.30.154.178 <none> 80/TCP 6m50s

NAME READY UP-TO-DATE AVAILABLE AGE  deployment.apps/aws-sa-demo4-target-browser-l7ztek 1/1 1 1 6m50s  deployment.apps/minecfqnu-minecraft 0/1 1 0 28s

NAME DESIRED CURRENT READY AGE  replicaset.apps/aws-sa-demo4-target-browser-l7ztek-6b5575db7 1 1 1 6m50s  replicaset.apps/minecfqnu-minecraft-6447d44cb5 1 1 0 28s

NAME HOST/PORT PATH SERVICES PORT TERMINATION WILDCARD  route.route.openshift.io/tb-aws-sa-demo4-target-browser-l7ztek-f2zzf trilio-system.apps.nvsgu1at.eastus.aroapp.io /aws-sa-demo4-target.demo-minecraft-restore tb-aws-sa-demo4-target-browser-l7ztek http edge/Redirect None

Image
Minecraft edit server info screen
Image
An in game image from minecraft

Restore using Trilio UI

In restoring the Minecraft server to ARO, what we do is access the Trilio UI ( which is running inside ARO, and expose a route.

Don’t be surprised if the IPs or Minecraft screenshots look different, as I recorded different videos and restores for this blog post.

We see in the screenshot that the Trilio UI is a multi-cluster UI, so we took the backup in the Rosa instance, and now we are going to access the backup target from the ARO instance and start restoring from there. The source cluster could be down or inaccessible, and that would not prevent us from being able to restore it anyway:

We go to targets and select the aws-sa-demo4-target, where the backup was saved from Rosa

Image
Screen capture of step 1

Then we click on launch browser:

Image
Screen capture of Step 2

We could select any backup on that backup target, but we choose the one we know the backup is:

Image
Screen capture of step 3

And then the backup we want to restore, in this case, we only have one backup, but we could have one full and several incremental, and we could choose any of those:

Image
Screen capture of step 4

Then we enter a name for the restore, and the namespace where we want to restore. If the namespace where we want to restore does not exist, we can create it here:

Image
Screen capture of step 5

The restore will start at this point.

We can then go to ARO, and check that everything is being restored, like the Persistent Volume where the data is stored:

Image
image of the Persistent Volume

Here, we can see how the Helm release was just created:

Image
Screen capture of step 6

And if we go to the service, we will find the LoadBalancer created in ARO:

Image
Load balancer screen shot

Then we grab the LoadBalancer IP and use it in the Minecraft client. At this point we are in the same step as when we restored through Ansible. We only have to enter the IP, and connect to the Minecraft server:

Image
Screen capture of the new server info
Image
Screen capture of Minecraft server select

And we can check that all our Minecraft inventory is where we left it! :

Image
Screen capture of minecraft inventory

Summary

Managed OpenShift Clusters provide a seamless hybrid cloud experience on AWS and Microsoft Azure. Along with Certified TrilioVault Operator and Trilio vendor support,  it provides rich features of disaster recovery and application mobility on multi-cloud.

Thank you for getting there! I hope it was interesting for you.

The GitHub repo where you can find the supporting files to test this demo is in the following URL:

https://github.com/trilio-demo/rosatoarodr

You can watch all this on Youtube! 

 

Useful Links:

1.    http://github.com/itzg/minecraft-server-charts

2.    http://github.com/itzg/minecraft-server-charts/tree/master/charts/minecraft

3.    http://github.com/gilesknap/k3s-minecraft

4.    http://artifacthub.io/packages/helm/minecraft-server-charts/minecraft

5.     Default values.yaml file  http://github.com/itzg/minecraft-server-charts/blob/master/charts/minecraft/values.yaml

6.    https://www.plural.sh/blog/how-to-run-a-minecraft-server-on-a-kubernetes-cluster/

 

rodolfo
Rodolfo Casás
Senior Solutions Architect
Rodolfo Casás is a Senior Solutions Architect from Madrid working for Trilio with a special focus on cloud-native computing, hybrid cloud strategies, telco and data protection. He started working with Solaris back in 1998, and GNU/Linux back in 2001 and developed a passion for Open Source software. His main fields of interest are cloud computing, data protection, automation, and systems performance tuning. He was a former Technology Instructor, teaching many classes about GNU/Linux, OpenStack, Ansible and Kubernetes. He is an active member of the Open Source and Kubernetes community, and is often featured in thought leadership discussions and event
Ding
Shaozhen Ding
Senior Black Belt, Managed OpenShift
Shaozhen Ding is a Senior Managed OpenShift Black Belt at Red Hat, Inc. specializes in Cloud Operations, Agile Development, Continuous Integrations and Deployments, and Application Cloud-Native Architecture. Shaozhen collaborates with major cloud vendors such as Amazon AWS, Google GCP, and Microsoft Azure to advocate, promote, and clear enterprise adoption blockers of Managed OpenShift, which is a kubernetes-based application platform.