Coder Social home page Coder Social logo

mcserver's Introduction

mcserver

Terraform scripts to run a Minecraft server on a HETZNER Cloud server.

Cloud based Minecraft Server

This project contains Terraform scripts that create a Minecraft server using HETZNER Cloud hosting.

  • Creates a virtual cloud machine to host the Minecraft server
  • World data is stored on a separate data volume. This allows the server to be expanded or removed when not in use, saving costs.
  • Uses the popular docker image itzg/minecraft-server to deploy Minecraft

Getting Started

In order to create a server the following steps need to be followed.

  1. Get a copy of this repo
git clone https://github.com/nehemming/mcserver
  1. Install Terraform CLI

  2. Open a HETZNER Cloud Hosting account

  3. Create a SSH Public Key

  4. Register your public key with your HETZNER account

  5. Generate a HETZNER API token and a DNS API Token. Remember to copy the token as only shown once. (Will need shortly)

  6. Create a file called terraform.tfvars in the minecraft folder (use the 'sample-terraform.tfvars' as a template)

hcloud_token = "<PASTE TOKEN HERE>"
hetznerdns_token "<PASTE DNS TOKEN HERE>"
server_ssh_keys = ["<SSH KEY NAME IN HETZNER (not the public key just the NAME)>"]
  1. Copy the file also into the storage folder.

  2. Create the storage volume. At a command prompt go to the storage and run the commands below. The Volume size is by default 10Gb, this can be increased see volume sizing below

terraform init
terraform apply

==> when prompted type yes

  1. Create the server (at last!) Move back to the minecraft folder and run
terraform init
terraform apply

==> when prompted type yes

If you successfully followed the steps above the server should have been created.

The IP Address of the server will be near the final output on the screen.

The server will be starting once you see the IP Address. Please allow a couple of minutes for it to complete the start up process

Server Sizing

The size of the server deployed in HETZNER depends on the settings defined in terraform.tfvars

By default the smallest lowest cost server is used. To scale to a bigger server add the following entry to the file. In this case we want to uses a "cx21" server

server_type = "cx21"

Volume Sizing

The default storage volume is 10Gb.

If this needs to be increased by editing the storage terraform.tfvars file.

If the volume already exists it will be resized by terraform apply but the space available will not increase. (Google how to extend ext4 file systems to solve)

DNS Support

The deployment supports registering DNS entries with HETZNER DNS. To use this facility you will need a free domain that can be be registered with delegated admin by HETZNER. To do this the domains name servers need to be registered as

  hydrogen.ns.hetzner.com
  oxygen.ns.hetzner.com
  helium.ns.hetzner.de

The dnszone sub folder contains a terraform script to create the DNS Zone for top level domain.

In order to use, add a terraform.tfvars file containing

hetznerdns_token = "<DNS API TOKEN>"
dns_zone         = "<THE DOMAIN>"

In dnszone run

terraform init
terraform apply

==> when prompted type yes

The in the minecraft folder update terraform.tfvars to include

dns_enabled = true
dns_zone  = "<THE DOMAIN>"

Terraform will then register the IP Address or the server against the domain.

Mods support

Mods can be added to the subfolder mods. These will be imported into the server.

Contributing

We would welcome contributions to this project. Please read our CONTRIBUTION file for further details on how you can participate or report any issues.

License

his software is licensed under the MIT license. See LICENSE for more details.

Acknowledgments

This project is heavily indebted to the work done by the following open source contributors.

mcserver's People

Contributors

nehemming avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.