Background: I wanted to provide my kids a way to play Minecraft in the cloud but not cost a fortune. Jenkins allows my kids to turn on Minecraft with a simple webhook and pipelines, and allows me to keep my pocketbook closed to the Google Cloud gods.
Goals: The ultimate goal was to maintain pipelines that my family could easily kick-off to spin up our personal Minecraft server running on GCP. The Minecraft instance is preemptive so it shuts off when not in use.
Solution & Results: After I had a working model, I wanted to automate it. I also wanted to set the compute to be preemptive, so I don't have a run-away bill, but I also didn't like to log into GCP each time to start it.
That being said, I leveraged Jenkins to turn on the instance (if offline), mount the drive, and start the service. Furthermore, I have additional pipelines to stop the instance (if desired), pull the status of the compute, and even upgrade Minecraft if it's out of date.
Great community and a large set of plugins made our work easier and more comfortable. Also, Jenkins helped us save money and time.
After setting all this automation up, I realized that my kids would have to log into Jenkins, so I set up webhooks with Discord and Slack and even created a little batch file to quickly start it wherever they are.
To meet these challenges, I created a handful of pipelines to do the job: one to start the instance, one to stop the instance, one to obtain the server's status, and one to upgrade Minecraft. These pipelines use shared methods and libraries and are primarily driven by gcloud commands.
All of the Jenkins Groovy code is stored in GitHub. There is an option to store the code inside the pipeline itself, but I've been burned too much by systems failing or upgrades breaking things. Now that this is mature and the kids know how to operate it, I'll move to the next phase and set up the infrastructure utilizing Terraform and Jenkins to orchestrate.
Here are the tools I used most:
Results: