From 7a4372dfe74e3c4839385df66696afb9ba3d9ec1 Mon Sep 17 00:00:00 2001 From: Jack O'Sullivan Date: Mon, 1 Jan 2024 16:28:04 +0000 Subject: [PATCH] nixos/whale2: Add Minecraft server --- lib/constants.nix | 4 ++ nixos/boxes/colony/vms/estuary/default.nix | 3 +- nixos/boxes/colony/vms/estuary/dns.nix | 2 + .../vms/shill/containers/middleman/vhosts.nix | 5 ++ nixos/boxes/colony/vms/whale2/default.nix | 2 + .../colony/vms/whale2/minecraft/default.nix | 51 ++++++++++++++++++ .../colony/vms/whale2/minecraft/icon.png | Bin 0 -> 5516 bytes nixos/modules/firewall.nix | 2 +- 8 files changed, 67 insertions(+), 2 deletions(-) create mode 100644 nixos/boxes/colony/vms/whale2/minecraft/default.nix create mode 100644 nixos/boxes/colony/vms/whale2/minecraft/icon.png diff --git a/lib/constants.nix b/lib/constants.nix index 21aceec..7439c36 100644 --- a/lib/constants.nix +++ b/lib/constants.nix @@ -169,6 +169,10 @@ rec { port = 8448; dst = aa.middleman.internal.ipv4.address; } + { + port = 25565; + dst = aa.simpcraft-oci.internal.ipv4.address; + } { port = 2456; diff --git a/nixos/boxes/colony/vms/estuary/default.nix b/nixos/boxes/colony/vms/estuary/default.nix index d86402c..f06973c 100644 --- a/nixos/boxes/colony/vms/estuary/default.nix +++ b/nixos/boxes/colony/vms/estuary/default.nix @@ -393,7 +393,8 @@ in # Safe enough to allow all SSH tcp dport ssh accept - ${matchInet "tcp dport { http, https, 8448 } accept" "middleman"} + ip6 daddr ${aa.middleman.internal.ipv6.address} tcp dport { http, https, 8448 } accept + ip6 daddr ${aa.simpcraft-oci.internal.ipv6.address} tcp dport 25565 accept return } chain routing-udp { diff --git a/nixos/boxes/colony/vms/estuary/dns.nix b/nixos/boxes/colony/vms/estuary/dns.nix index f213a66..7748158 100644 --- a/nixos/boxes/colony/vms/estuary/dns.nix +++ b/nixos/boxes/colony/vms/estuary/dns.nix @@ -148,6 +148,8 @@ in valheim IN A ${assignments.internal.ipv4.address} valheim IN AAAA ${allAssignments.valheim-oci.internal.ipv6.address} + simpcraft IN A ${assignments.internal.ipv4.address} + simpcraft IN AAAA ${allAssignments.simpcraft-oci.internal.ipv6.address} mail-vm IN A ${net.cidr.host 0 prefixes.mail.v4} mail-vm IN AAAA ${net.cidr.host 1 prefixes.mail.v6} diff --git a/nixos/boxes/colony/vms/shill/containers/middleman/vhosts.nix b/nixos/boxes/colony/vms/shill/containers/middleman/vhosts.nix index bfef99a..77ee9b6 100644 --- a/nixos/boxes/colony/vms/shill/containers/middleman/vhosts.nix +++ b/nixos/boxes/colony/vms/shill/containers/middleman/vhosts.nix @@ -352,6 +352,11 @@ in locations."/".proxyPass = "http://git-vm.${domain}:3000"; useACMEHost = pubDomain; }; + + "mc-map.${pubDomain}" = { + locations."/".proxyPass = "http://simpcraft-oci.${domain}:8100"; + useACMEHost = pubDomain; + }; }; minio = diff --git a/nixos/boxes/colony/vms/whale2/default.nix b/nixos/boxes/colony/vms/whale2/default.nix index 6901b95..dd6b157 100644 --- a/nixos/boxes/colony/vms/whale2/default.nix +++ b/nixos/boxes/colony/vms/whale2/default.nix @@ -50,6 +50,7 @@ in }; }) { valheim-oci = 2; + simpcraft-oci = 3; }; configuration = { lib, pkgs, modulesPath, config, assignments, allAssignments, ... }: @@ -63,6 +64,7 @@ in "${modulesPath}/profiles/qemu-guest.nix" ./valheim.nix + ./minecraft ]; config = mkMerge [ diff --git a/nixos/boxes/colony/vms/whale2/minecraft/default.nix b/nixos/boxes/colony/vms/whale2/minecraft/default.nix new file mode 100644 index 0000000..7b54d01 --- /dev/null +++ b/nixos/boxes/colony/vms/whale2/minecraft/default.nix @@ -0,0 +1,51 @@ +{ lib, config, allAssignments, ... }: +let + inherit (lib) concatStringsSep; + inherit (lib.my) dockerNetAssignment; + + # devplayer0 + op = "6d7d971b-ce10-435b-85c5-c99c0d8d288c"; +in +{ + config = { + virtualisation.oci-containers.containers = { + simpcraft = { + image = "ghcr.io/itzg/minecraft-server:2023.12.2-java17-alpine"; + + environment = { + TYPE = "paper"; + + EULA = "true"; + MOTD = "§4§k----- §9S§ai§bm§cp§dc§er§fa§6f§5t §4§k-----"; + ICON = "/ext/icon.png"; + DIFFICULTY = "normal"; + + WHITELIST = concatStringsSep "," [ + op + "dcd2ecb9-2b5e-49cb-9d4f-f5a76162df56" # Elderlypug + "fcb26db2-c3ce-41aa-b588-efec79d37a8a" # Jesthral_ + "1d366062-12c0-4e29-aba7-6ab5d8c6bb05" # shr3kas0ras + "703b378a-09f9-4c1d-9876-1c9305728c49" # OROURKEIRE + "f105bbe6-eda6-4a13-a8cf-894e77cab77b" # Adzerq + "1fc94979-41fb-497a-81e9-34ae24ca537a" # johnnyscrims + ]; + OPS = op; + + MAX_MEMORY = "4G"; + MODRINTH_PROJECTS = concatStringsSep "," [ ]; + + TZ = "Europe/Dublin"; + }; + + volumes = [ + "minecraft_data:/data" + "${./icon.png}:/ext/icon.png:ro" + ]; + + extraOptions = [ + ''--network=colony:${dockerNetAssignment allAssignments "simpcraft-oci"}'' + ]; + }; + }; + }; +} diff --git a/nixos/boxes/colony/vms/whale2/minecraft/icon.png b/nixos/boxes/colony/vms/whale2/minecraft/icon.png new file mode 100644 index 0000000000000000000000000000000000000000..19829c332381142bb1f4fb2d3acef0a88e0aa65b GIT binary patch literal 5516 zcmV;76?5u|P)EX>4Tx04R}tkv&MmP!xqvQ$>-ggB?UVWT;MdQ4w*fRVYG*P%E_RVDi#GXws0R zxHt-~1qXi?s}3&Cx;nTDg5VE`vxAeOi<(uL#gLfLTOjW*Kvml!9-4-BT~sU5sb>_x)M@YTjZ%KqQVc!?cMvh^IGg zgY!Odn3ZIe_?&p$qyrK^a$WKGjdRgufoF!zOnRO;Oe_{VSm|I^GBx5U;;5?WlrLmG zRyl8R)+#mDIw!wjD6g+9bDdTMNi1Rs5=1Ddp^OS_#OSY+Vj)fY2_OH6>zBx-kgE(v zjs;YqL3aJ%Z}5AzR$+3&O9~}`?ia`T7zKKEfo9!tzK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