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.
To Run Locally:
- From the main directory MMSaboMincraftServer, cd into the .server-data directory: cd .server-data
- 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
- To use plugins, give user operator permissions in the server console that comes up after the server is up: op PLAYER_USERNAME
- To take down the server, type the command "stop" in the server console
To Run On Local Docker Container:
- Make sure docker desktop is running
- Type " docker-compose up " in MMSaboMincraftServer directory's command line to build and run the server on docker
- To begin to connect to the Minecraft server console hosted in docker, cd into mcrcon-0.7.2 from the main MMSaboMincraftServer directory
- To compile rcon, run the command (need a C compiler installed on computer): cc -std=gnu99 -Wpedantic -Wall -Wextra -Os -o mcrcon mcrcon.c
- 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
- To use plugins, give user operator permissions in the server console that comes up after running the previous command: op PLAYER_USERNAME
- 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:
- Create a t2.large ec2 instance using the Amazon Linux 2 AMI and 64-bit (x86) architecture
- specify a key login pair
- 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
- Run the instance
- Copy the Public IPv4 DNS into the export line of each script (up, down, save, initialUP)
- Example: export ECTOO_INSTANCE=ec2-user@ec2-184-72-89-44.compute-1.amazonaws.com
- To setup the instance with the necessary files and run the server, run the initialUP script in the MMSaboMincraftServer directory's command line: ./initalUP
- 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:
- Run the instance
- To start the server, run the up script in the MMSaboMincraftServer directory's command line: ./up
- 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)
- Local:
- Java: https://www.java.com/en/
- Server jar file (paper-1.17.1-408.jar): https://minecraftversion.net/downloads/paper/
- Mcrcon: https://github.com/Tiiffi/mcrcon
- Docker:
- Docker Desktop: https://www.docker.com/products/docker-desktop/
- Docker Compose: https://docs.docker.com/compose/install/
- Java, server file, and mcrcon (same as local)
- AWS:
- AWS EC2 Instance (t2.large): https://us-east-1.console.aws.amazon.com/console/home?region=us-east-1#
- Java, server file, and mcrcon (same as local)
- Included Plugins:
- Essentials: https://www.spigotmc.org/resources/essentialsx.9089/
- PlayerWarps: https://www.spigotmc.org/resources/%E2%AD%90-player-warps-%E2%AD%90-%E2%9E%A2-let-your-players-set-warps-1-7-1-18.66692/
- Vault: https://www.spigotmc.org/resources/vault.34315/
- WorldEdit: https://dev.bukkit.org/projects/worldedit
- Minecraft server with docker tutorial: https://www.youtube.com/watch?v=TxjvC6GRjkU
- Minecraft server on AWS tutorial: https://www.youtube.com/watch?v=huDe-YSEVx4&t=477s
- How to copy files between local and server: https://unix.stackexchange.com/questions/188285/how-to-copy-a-file-from-a-remote-server-to-a-local-machine