Coder Social home page Coder Social logo

paul-schwendenman / minecraft-server-host Goto Github PK

View Code? Open in Web Editor NEW
0.0 3.0 0.0 1.71 MB

Infrastructure Configuration For On Demand Provisioning of a Minecraft Server

License: MIT License

Shell 9.93% HCL 33.98% Python 13.37% JavaScript 33.45% CSS 1.98% HTML 1.03% Svelte 6.25%

minecraft-server-host's Introduction

Minecraft Server Host

This repository contains the blueprint for creating an automated and configurable minecraft server on-demand.

The project provides a webapp that can be used to start an ec2 instance which has been configured to run a minecraft server. The instance will autmatically shutdown after five minutes if no players are online to help to reduce costs.

Setup

  1. Install terraform

  2. Install AWS CLI

  3. Configure AWS CLI:

    $ aws configure
    AWS Access Key ID [None]: accesskey
    AWS Secret Access Key [None]: secretkey
    Default region name [None]: us-west-2
    Default output format [None]:
    
  4. Initialize terraform:

    terraform init
    
  5. Create a terraform.tfvars file:

    tee terraform.tfvars << EOF
    dns_name        = "minecraft.example.com"
    webapp_dns_name = "www.minecraft.example.com"
    region          = "us-west-1"
    EOF
    
  6. Edit the newly created tfvars file to provide your region preference and domain names.

  7. Run apply to provision the infrastructure:

    terraform apply
    
  8. Once the apply is complete your server should be running and the UI and lambda should be created to control the server.

Tearing down the server

The resources can be removed by running:

terraform destroy

Terraform state backup

Terraform has the ability to store it's state in a remote store. For more information, see the documentation for more information.

Example (i.e. backend.tf):

terraform {
    backend "remote" {
        hostname     = "app.terraform.io"
        organization = "example"

        workspaces {
            name = "minecraft-server"
        }
    }
}

Example costs (from 2020)

Since May, I've been running the server as a t3.medium instance to server about 4 active players at a time. Below I've included a chart with a couple sample months representing different levels of activity.

Use Hours Monthly Cost
Low 6 $2.71
Medium 140 $10.59
Heavy 275 $21.89

asdf - extendable version manager

The asdf tool can be used to manage your local terraform installation.

Install plugin:

asdf plugin-add terraform https://github.com/Banno/asdf-hashicorp.git

Install the tools:

asdf install

aws cli

Install:

pip install --user awscli

Configure:

aws configure

minecraft-server-host's People

Contributors

paul-schwendenman avatar

Watchers

 avatar  avatar  avatar

minecraft-server-host's Issues

Shutdown script is broken since the 1.16 update

The server no longer shuts down when no one is online.

Failing example:

last_log_line="[16:55:20] [Server thread/INFO]: There are 0 of a max of 20 players online:"
regex='There are [0-9]+ of a max [0-9]+ players online'
if [[ $last_log_line =~ $regex ]]; then echo "it matched"; else echo "it did not match"; fi

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.