games: split it up into 3 different services for easier management

This commit is contained in:
silver 2023-04-26 01:52:47 +01:00
parent 733b867f47
commit 3eac87bbd8

View file

@ -9,17 +9,24 @@
]; ];
}; };
networking.firewall.allowedTCPPorts = [ 25565 ]; networking.firewall.allowedTCPPorts = [
# for the proxy
25565
# the servers
20000
20001
];
# arion is one way to use docker on nixos # arion is one way to use docker on nixos
# see https://gitlab.com/c2842/computer_society/nixos/-/blob/733b867f4782afa795848135a83e97a5cafaf16a/applications/games/minecraft.nix
# for an example of a single compose file with multiple services
virtualisation.arion = { virtualisation.arion = {
backend = "docker"; backend = "docker";
projects = { projects = {
# this is basically one single docker-compose file minecraft_proxy.settings = {
minecraft.settings = {
docker-compose.raw.networks.default.name = "minecraft";
services = { services = {
mc_proxy = { mc_proxy = {
service = { service = {
@ -38,8 +45,12 @@
]; ];
}; };
}; };
};
};
mc_compsoc = { minecraft_compsoc_classic.settings = {
services = {
compsoc_classic = {
service = { service = {
image = "nimmis/spigot:latest"; image = "nimmis/spigot:latest";
# setting these here as they arent special # setting these here as they arent special
@ -51,10 +62,19 @@
# where the config files are stored # where the config files are stored
volumes = [ "/etc/games/minecraft/compsoc/test/config:/minecraft" ]; volumes = [ "/etc/games/minecraft/compsoc/test/config:/minecraft" ];
ports = [
"20000:25565/tcp"
];
}; };
}; };
mc_compsoc2 = { };
};
minecraft_compsoc_test.settings = {
services = {
compsoc_test = {
service = { service = {
image = "nimmis/spigot:latest"; image = "nimmis/spigot:latest";
environment = { environment = {
@ -65,6 +85,10 @@
# where the config files are stored # where the config files are stored
volumes = [ "/etc/games/minecraft/compsoc/test2/config:/minecraft" ]; volumes = [ "/etc/games/minecraft/compsoc/test2/config:/minecraft" ];
ports = [
"20001:25565/tcp"
];
}; };
}; };