wrote minecraft

This commit is contained in:
Snorre 2025-02-05 18:05:01 +01:00
parent bd08342cc5
commit b3d92709bf
4 changed files with 43 additions and 2 deletions

View file

@ -11,6 +11,12 @@
"footer2 footer"
;
grid-template-columns: 1fr 1fr;
max-width: 120ch;
}
#content>.content {
text-align: justify;
text-justify: auto;
}
img {
@ -20,13 +26,15 @@
}
img.enlarged {
position: absolute;
position: fixed;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
height: 80%;
max-width: 80%;
max-width: 90%;
object-fit:contain;
border-radius: 0px;
background: transparent;
}
#content>.footer {

View file

@ -0,0 +1,33 @@
Minecraft Rust Async Networking Proxy CRIU
# Minecraft servers are HUNGRY
They hunger for your ram and your cpu. This makes it either expensive or laggy to try and host multiple servers at once.
This was something I encountered when my friend built a homeserver out of spare computer parts that was barely powerful enough to run a minecraft server.
The problem was that soon multiple people wanted a minecraft server hosted by him, including ourselves with modded experiences.
It was a hassle to ssh into the server and start and stop the various servers depending on who wanted to play,
especially since a lot of people only played very rarily.
I remembered that I'd seen [a project](https://github.com/gekware/minecraft-server-hibernation) that claimed to be able to hibernate a minecraft server if nobody was playing on it.
This worked by starting and stopping the server, leading to noticeable join delays when joining modded servers.
Another nice-to-have was being able to join through a subdomain. After having messed around with nginx to help my friend set up various services like nextcloud
on subdomains we wanted to do the same for the minecraft servers.
Being able to join the vanilla server through `vanilla.domain.com` and the modded through `modded.domain.com` would simply be really cool.
# Minecraft Server Hibernation Proxy Manager Rs (Name WIP)
I ended up writing [a Rust program](https://gitlab.com/SpoodyTheOne/minecraft-server-hibernation-proxy-rust) that could do this and more. It listens on the default minecraft server port of `25565` and parses any incoming data as minecraft packets.
If the data contains a url that matches `*.domain.com` then it uses the subdomain to look up a configured server, and if found redirects all future traffic to that port.
![Image of a server displaying the startup message](/posts/minecraft-proxy/starting.png "A server that is waiting to be started")
If the server is stopped or hibernating then the command to start it is automatically run. Likewise if all players leave a configurable countdown is started.
Once it reaches 0 the server is hibenated using CRIU, which writes the entire memory and all open file descriptors of the server program to disk.
![Hibernating server](/posts/minecraft-proxy/hibernating.png "Hibernating server")
This means that joining a hibernated server only takes a few seconds, and any server currently hibernating will only take up disk space.
It can also be restored even after system restarts, so it would be possible to halt systemd shutdowns until all servers are hibernated.
<marquee>Marq**WEE**</marquee>

Binary file not shown.

After

Width:  |  Height:  |  Size: 27 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 46 KiB