A Configuration Package is a collection of MineCloud configuration pre-sets which allow users to quickly spin up a new game server. For instance, people can use the minecraft_vanilla_1.19.4.zip
package to spin up a Minecraft server or use the terraria_vanilla_1449.zip
package to spin up a Terraria one.
People can also create and publish their own configuration packages for others to use.
If there's no existing Configuration Package for your favorite games or mods - here're are some guides for you to create and publish one:
-
Fork and clone the repository. Check out the
main
branch. -
Open additional ports that are required for the game server (e.g. which port number?, TCP or UDP?) by editing
minecloud_configs/advanced_configs/port-configs.ts
. -
Deploy MineCloud by following the typical deployment workflow. A placeholder Minecraft server should be spun up.
-
Connect to the terminal and run
sudo systemctl stop minecloud.service
to stop the placeholder Minecraft server- Please check out the "Managing the Server after Deployment" section in the main README.md for how to interact with the server after deployment.
-
Set up the game server and notes down the commands and files required. We will need this for our EC2 init configs later.
-
Prepare the
get_connection_count.sh
script:- This script is to help MineCloud determine whether there are still players online.
- The default
get_connection_count.sh
determine how many players are online by checking the TCP connection on port25565
. If the game is also using TCP (e.g.Minecraft
,Terraria
) as the network protocol, modify the port number and the script should work. - If the game is using UDP (e.g.
Factorio
). Copy theget_connection_count_udp_template.sh
template into theget_connection_count.sh
file and edit the port number. - Test out the script:
- On the server, type
sudo su
to switch to root user and typesource get_connection_count.sh; get_current_connection_count
to run and print out the return value of the script. - Have the game client connect/disconnect to the server:
- Run the script to confirm the return value is expected.
- It should return 0 when no one is connected and >=1 when there're players connected
- Type
exit
to exit the root user mode
- On the server, type
- Once done, we can start preparing the configuration package files
-
Edit EC2 initialization commands in
minecloud_configs/advanced_configs/custom-instance-init.ts
.- Commands are made of CDK APIs
- Some useful APIs are:
- InitCommand to execute Linux commands
- Check out this section on the wiki for useful Linux commands.
- InitFile.FromXXX to setup files
- We can use these methods/classes to set up files from the local disk or with Web URLs.
- Other than using this to setup files, we can also replace
minecloud_configs/server/server.zip
with a custom server file and setDEPLOY_LOCAL_SERVER_EXECUTABLE
inminecloud_configs/MineCloud-Configs.ts
to true. Theserver.zip
will be extracted to/opt/minecloud/server
after deployment. Commands incustom-instance-init.ts
will be executed after theserver.zip
is extracted - this can be helpful if we need to grant execution permission to certain scripts in theserver.zip
.
- InitPackage: This can be used to install packages (ex: Java package) require for the game server
- InitCommand to execute Linux commands
-
Edit the
minecloud_configs/server/start_server.sh
andminecloud_configs/server/stop_server.sh
script:- These scripts are being used to start and stop the game server
- This script will be executed from the
/opt/minecloud/server
directory by the MineCloud service.
-
Edit
minecloud_configs/advanced_configs/backup-folders.txt
to specify the folders we want to back up. -
Edit
minecloud_configs/MineCloud-Configs.ts
to specify parameters like instance type, disk size...etc -
Type
npx cdk list
andnpx cdk deploy
to deploy with the new configs. -
Troubleshooting if something went wrong:
- If the deployment failed due to EC2 initialization, consider setting
IGNORE_FAILURE_ON_INSTANCE_INIT
totrue
inminecloud_configs/advanced_configs/other-configs.ts
to prevent rollback. - If there's an issue with the server start-up, follow the "Manually Start/Stop the Game Server" section in the main README.md for troubleshooting.
- If the deployment failed due to EC2 initialization, consider setting
-
Once we have everything working, it's time to publish your configuration package!
-
To do so:
- Edit
config-pack-info.json
- Zip everything except
README.md
inminecloud_configs/
. Rename and move it tominecloud_configuration_packages/<game_name>/releases/
- Move the config files into
minecloud_configuration_packages/<game_name>/dev/<config_package_name>/
- Update or create
minecloud_configuration_packages/<game_name>/README.md
if needed - Edit
minecloud_configuration_packages/RELEASES.md
to add your configuration package download link to the list. - If it's a new game being supported, also edit the main README.md to add it to the support list
- Edit
-
You are all set now! Just commit, create a pull request to the MineCloud's
origin/main
branch, and wait for it to be merged!