Skip to content

Latest commit

 

History

History
122 lines (74 loc) · 2.74 KB

README.md

File metadata and controls

122 lines (74 loc) · 2.74 KB

Minecraft Server Provisioner

Objective

  • Provision an Minecraft server where you and your friends can connect and play.

Prerequisites

AWS

Hetzner

Which resources does Terraform will provision?

AWS

Instance Type OS RAM vCPUs
t2.medium Ubuntu 22.04 4GB 2

Hetzner

Instance Type OS RAM vCPUs
CPX21 Ubuntu 22.04 4GB 3

How to

Customization

If you want, you can customize some options on your Minecraft Server. To do it, you need to edit ./ansible/playbook.yml minecraft-server role.

  • server_jar_url: The server.jar file that will run the server. The version of this file must match the version of the Minecraft Client. (Default 1.20.1)

The other variables are self-explainable.

Provision and Configure

  1. Init terraform:
cd terraform/<aws | hetzner> && terraform init
  1. Create, if not existent, an SSH key:
ssh-keygen
  1. Config your credentials on ./env/.env.<aws | hetzner>

  2. Provision your server:

./provision.sh <aws | hetzner>

Just Configure

If you already have a server, you can only run the ansible playbook that install and configure a Minecraft Server on your server.

  1. Write the user that ansible will user and your IP address on ./ansible/hosts.ini

  2. Install ansible community.general collection:

ansible-galaxy collection install community.general
  1. Run:
cd ansible && ansible-playbook -i hosts.ini -v playbook.yml

Destroy

If you want to destroy your Minecraft Server instances, just run:

./destroy.sh <aws | hetzner>

Playing

  • Grab your server IP address (output.json)
  • Go to Multiplayer on your Minecraft Client
  • Add your brand new server and start playing!

Managing

  1. SSH into your server:
ssh minecraft@<server ip address>
  1. Your Minecraft Server simply is a systemd process, that you can manage with:
sudo /bin/systemctl (status | start | stop | restart | enable | disable)

Costs

AWS

TODO

Hetzner

~ 7.00€ / month