Browse Source

Minecraft config with graphs and reverse proxy

main
Leonora Tindall 9 months ago
parent
commit
0f3d5963b4
  1. 12
      common/fragments/grafana.nix
  2. 28
      common/fragments/infrared-reverse-proxy.nix
  3. 9
      common/fragments/minecraft-server.nix
  4. 6
      include/infrared-home.nora.codes.json

12
common/fragments/grafana.nix

@ -19,6 +19,12 @@
targets = ["crimespoon:9002"];
}];
}
{
job_name = "crimespoon_minecraft";
static_configs = [{
targets = ["crimespoon:25585"];
}];
}
{
job_name = "felonyspork";
static_configs = [{
@ -32,6 +38,12 @@
}];
}
{
job_name = "felonyspork_infrared";
static_configs = [{
targets = ["felonyspork:9136"];
}];
}
{
job_name = "akina";
static_configs = [{
targets = ["stats.akina.nora.codes"];

28
common/fragments/infrared-reverse-proxy.nix

@ -0,0 +1,28 @@
{ pkgs, ... }:
{
nixpkgs.config.allowUnfree = true;
virtualisation.oci-containers.containers = {
"infrared" = {
image = "haveachin/infrared:latest";
environment = {
INFRARED_CONFIG_PATH = "/configs/";
INFRARED_PROMETHEUS_ENABLED = "true";
INFRARED_PROMETHEUS_BIND = ":9136";
};
autoStart = true;
ports = ["25565:25565" "9136:9136"];
volumes = [
"/etc/infrared/configs/:/configs/"
];
};
};
environment.etc."infrared/configs/home.nora.codes" = {
mode = "0666";
source = ../../include/infrared-home.nora.codes.json;
};
# Port 9136 is for the prom exporter.
networking.firewall.allowedTCPPorts = [ 9136 25565 ];
networking.firewall.allowedUDPPorts = [ 25565 ];
}

9
common/fragments/minecraft-server.nix

@ -6,24 +6,25 @@
image = "itzg/minecraft-server";
environment = {
EULA = "TRUE";
VERSION = "1.19";
VERSION = "1.19.2";
TYPE = "FABRIC";
INIT_MEMORY = "1G";
MAX_MEMORY = "8G";
ALLOW_NETHER = "TRUE";
SEED = "-573947210";
SEED = "-7159392300545500356";
MOTD = "Minecraft with Fabric on CRIMESPOON via Docker";
ICON = "https://nora.codes/favicon.ico";
SPAWN_PROTECTION="FALSE";
DIFFICULTY="easy";
MODRINTH_PROJECTS="fabric-api,fabric-biome-api,fallingtree,bluemap,lithium,betterend,betternether,waystone-towers,balm,waystones,immersive_structures,essential-commands,towns-and-towers,tectonic,paradise-lost:beta";
};
autoStart = true;
ports = ["25565:25565" "8100:8100"];
ports = ["25565:25565" "25585:25585" "8100:8100"];
volumes = ["/var/games/minecraft:/data"];
};
};
# Port 8100 is for BlueMap.
networking.firewall.allowedTCPPorts = [ 25565 8100 ];
networking.firewall.allowedTCPPorts = [ 25565 25585 8100 ];
networking.firewall.allowedUDPPorts = [ 25565 ];
}

6
include/infrared-home.nora.codes.json

@ -0,0 +1,6 @@
{
"domainName": "home.nora.codes",
"listenTo": "0.0.0.0:25565",
"proxyTo": "crimespoon:25565",
"disconnectMessage": "Sorry {{username}}, but the server appears to be broken. Let Nora know!"
}
Loading…
Cancel
Save