feat: setup minecraft for both us and gsoc
This commit is contained in:
parent
d3dba7891d
commit
883a6b239c
1 changed files with 59 additions and 47 deletions
|
@ -2,6 +2,8 @@
|
|||
with lib;
|
||||
let
|
||||
cfg = config.services.skynet_games_minecraft;
|
||||
|
||||
short_domain = "${cfg.domain.sub}.${cfg.domain.base}.${cfg.domain.tld}";
|
||||
in {
|
||||
|
||||
imports = [
|
||||
|
@ -52,29 +54,43 @@
|
|||
skynet_dns.records = {
|
||||
external = [];
|
||||
cname = [
|
||||
"config.${cfg.domain.sub} CNAME ${cfg.host.name}"
|
||||
|
||||
# create a sub-subdomain for each game
|
||||
# compsoc_classic.minecraft.games.skynet.ie
|
||||
"compsoc_classic.${cfg.domain.sub} CNAME ${cfg.host.name}"
|
||||
"compsoc.${cfg.domain.sub} CNAME ${cfg.host.name}"
|
||||
|
||||
"map.compsoc_classic.${cfg.domain.sub} CNAME ${cfg.host.name}"
|
||||
#"compsoc.minecraft.games CNAME games"
|
||||
# gsoc.minecraft.games.skynet.ie
|
||||
"gsoc.${cfg.domain.sub} CNAME ${cfg.host.name}"
|
||||
|
||||
];
|
||||
};
|
||||
|
||||
networking.firewall.allowedTCPPorts = [
|
||||
# for the proxy
|
||||
25565
|
||||
|
||||
# the servers
|
||||
20000
|
||||
|
||||
20001
|
||||
];
|
||||
|
||||
services.nginx.virtualHosts."compsoc_classic.${cfg.domain.sub}.${cfg.domain.base}.${cfg.domain.tld}" = {
|
||||
services.nginx.virtualHosts = {
|
||||
|
||||
# https://config.minecraft.games.skynet.ie
|
||||
"config.${short_domain}" = {
|
||||
forceSSL = true;
|
||||
useACMEHost = "skynet";
|
||||
locations."/map/".alias = "/etc/games/minecraft/compsoc/classic/config/plugins/dynmap/web/";
|
||||
locations."/" = {
|
||||
proxyPass = "https://localhost:8443";
|
||||
proxyWebsockets = true;
|
||||
};
|
||||
};
|
||||
|
||||
# https://compsoc_classic.minecraft.games.skynet.ie/map/
|
||||
"compsoc_classic.${short_domain}" = {
|
||||
forceSSL = true;
|
||||
useACMEHost = "skynet";
|
||||
locations."/map/".alias = "/etc/games/minecraft/craftycontrol/servers/f4c5eb33-c6d6-421c-81ab-ded31f6e8750/plugins/dynmap/web/";
|
||||
};
|
||||
|
||||
};
|
||||
|
||||
# arion is one way to use docker on nixos
|
||||
|
@ -84,46 +100,42 @@
|
|||
backend = "docker";
|
||||
projects = {
|
||||
|
||||
minecraft_proxy.settings.services.mc_proxy.service = {
|
||||
minecraft.settings.services = {
|
||||
mc_proxy.service = {
|
||||
image = "itzg/mc-router:1.18.0";
|
||||
ports = [ "25565:25565/tcp" ];
|
||||
expose = [ "25565" ];
|
||||
command = [
|
||||
"--mapping=compsoc_classic.minecraft.games.skynet.ie=172.17.0.1:20000,compsoc.minecraft.games.skynet.ie=172.17.0.1:20001"
|
||||
"--mapping=compsoc_classic.${short_domain}=mc_config:20000,compsoc.${short_domain}=mc_config:20001,gsoc.${short_domain}=mc_config:20002"
|
||||
];
|
||||
};
|
||||
|
||||
minecraft_compsoc_classic.settings.services.compsoc_classic.service = {
|
||||
image = "nimmis/spigot:latest";
|
||||
# setting these here as they arent special
|
||||
mc_config.service = {
|
||||
image = "registry.gitlab.com/crafty-controller/crafty-4:4.1.1";
|
||||
|
||||
environment = {
|
||||
# this is what it last ran on
|
||||
SPIGOT_VER="1.18.2";
|
||||
EULA="true";
|
||||
TZ="Etc/UTC";
|
||||
};
|
||||
|
||||
# where the config files are stored
|
||||
volumes = [ "/etc/games/minecraft/compsoc/classic/config:/minecraft" ];
|
||||
volumes = [
|
||||
"/etc/games/minecraft/craftycontrol/backups:/crafty/backups"
|
||||
"/etc/games/minecraft/craftycontrol/logs:/crafty/logs"
|
||||
"/etc/games/minecraft/craftycontrol/servers:/crafty/servers"
|
||||
"/etc/games/minecraft/craftycontrol/config:/crafty/app/config"
|
||||
"/etc/games/minecraft/craftycontrol/import:/crafty/import"
|
||||
];
|
||||
|
||||
ports = [
|
||||
"20000:25565/tcp"
|
||||
# this ius https only
|
||||
"8443:8443/tcp"
|
||||
# compsoc classic
|
||||
"20000:20000/tcp"
|
||||
# compsoc
|
||||
"20001:20001/tcp"
|
||||
# games
|
||||
"20002:20002/tcp"
|
||||
];
|
||||
};
|
||||
|
||||
minecraft_compsoc.settings.services.compsoc_test.service = {
|
||||
image = "nimmis/spigot:latest";
|
||||
environment = {
|
||||
# this is what it last ran on
|
||||
SPIGOT_VER="1.18.2";
|
||||
EULA="true";
|
||||
};
|
||||
|
||||
# where the config files are stored
|
||||
volumes = [ "/etc/games/minecraft/compsoc/current/config:/minecraft" ];
|
||||
|
||||
ports = [
|
||||
"20001:25565/tcp"
|
||||
];
|
||||
};
|
||||
};
|
||||
};
|
||||
|
|
Loading…
Reference in a new issue