Skip to content

cs220s22/MMSaboMinecraftServer

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

27 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

MMSaboMinecraftServer

Overview:

This project consists of hosting the same paper Minecraft server in three different ways. The first way to host the server is to run the server locally on a computer. This can be done using a simple command, as long as the user has a recent version of Java (17 or newer) and the server file (paper-1.17.1-408.jar) downloaded locally. The second way to run the server is to host the server in a docker container using a Dockerfile and a docker-compose.yml. This can be run with the command docker-compose up and taken down using the command docker-compose down. The final way to run the server is hosted on an AWS EC2 instance. Scripts were written to handle all the commands to host the Minecraft server on the EC2 instance as well as take down the server. A few tutorials were used to help setup the Minecraft server using docker and the AWS instance (listed in background). To modify the basic server, we added a few plugins (Essentials, PlayerWarps, Vault, and WorldEdit) which give the user in game capabilities that would otherwise be unavailable. In order to let the user use the plugins, we also had to implement mcrcon. Mcrcon allows an external command line to communicate with the Minecraft server console. This lets the user give themselves operator permissions to use the added plugins aswell as other additional in game capabilities. The Minecraft server is saved and can be transfered between all three host options. This means we can start the server locally, in Docker, or on AWS, and the in game data will be saved and seen on the other host options. The .server-data directory stores all the server data and properties. The AwsCommands directory holds scripts for doing each process of loading the server to the AWS instance separately (later combined into main scripts). The mcrcon-0.7.2 directory holds the necessary files to connect mcrcon to the Minecraft server console. The .env file holds environment variables. Dockerfile and docker-compose.yml hold the necessry docker container information, server information, and commands to host the server in a docker container locally. The up, down, save, and initialUP scripts each server a specific purpose in hosting the Minecraft server on an AWS EC2 instance.

Setup:

To Run Locally:

  1. From the main directory MMSaboMincraftServer, cd into the .server-data directory: cd .server-data
  2. Run the command in the .server-data directory to start the server (need Java 17 or newer installed): java -Xmx4G -jar paper-1.17.1-408.jar nogui
  3. To use plugins, give user operator permissions in the server console that comes up after the server is up: op PLAYER_USERNAME
  4. To take down the server, type the command "stop" in the server console

To Run On Local Docker Container:

  1. Make sure docker desktop is running
  2. Type " docker-compose up " in MMSaboMincraftServer directory's command line to build and run the server on docker
  3. To begin to connect to the Minecraft server console hosted in docker, cd into mcrcon-0.7.2 from the main MMSaboMincraftServer directory
  4. To compile rcon, run the command (need a C compiler installed on computer): cc -std=gnu99 -Wpedantic -Wall -Wextra -Os -o mcrcon mcrcon.c
  5. To connect rcon to server, run the command (localhost if docker container is running locally, otherwise -H IP_OF_HOST): ./mcrcon-0.7.2/mcrcon -H localhost -p password123 -P 25575
  6. To use plugins, give user operator permissions in the server console that comes up after running the previous command: op PLAYER_USERNAME
  7. To take down the server and docker container, run the command in the MMSaboMincraftServer directory's command line: docker-compose down

To Run On AWS EC2 Instance:

  • If no previous AWS EC2 instance has been configured:
    1. Create a t2.large ec2 instance using the Amazon Linux 2 AMI and 64-bit (x86) architecture
    2. specify a key login pair
    3. create a security group with the following rules:
      • Inbound: SSH on port 22 with with the source being anywhere IPv4
      • Inbound: TCP Custon on port 25565 with with the source being anywhere IPv4
      • Outbound: All traffic on all port ranges
    4. Run the instance
    5. Copy the Public IPv4 DNS into the export line of each script (up, down, save, initialUP)
    6. To setup the instance with the necessary files and run the server, run the initialUP script in the MMSaboMincraftServer directory's command line: ./initalUP
    7. To take down the server run the down script in the MMSaboMincraftServer directory's command line: ./down
  • If an AWS EC2 instance has already been configured:
    1. Run the instance
    2. To start the server, run the up script in the MMSaboMincraftServer directory's command line: ./up
    3. To take down the server, run the down script in the MMSaboMincraftServer directory's command line: ./down
  • NOTE (scripts):
    • initalUP script configures the AWS EC2 instance (fresh instance) for a Minecraft server, then starts the Minecraft server with the data from the previous time the server was run
    • up script starts the Minecraft server (using previously configured AWS instance) with the data from the previous time the server was run
    • down script takes down the Minecraft server and saves the server data locally in the .server-data directory within the MMSaboMincraftServer directory
    • save script downloads the server data from the AWS instance locally in the .server-data directory within the MMSaboMincraftServer directory (only from a local command line)

Technologies Used:

  1. Local:
  2. Docker:
  3. AWS:
  4. Included Plugins:

Background:

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published