add persistent storage to minecraft

This commit is contained in:
Pim Kunis 2024-04-13 22:21:26 +02:00
parent 843810dced
commit 76bd5c9276
3 changed files with 30 additions and 8 deletions

2
.gitignore vendored
View file

@ -1,4 +1,2 @@
.direnv
.terraform.lock.hcl
.terraform
.deploy-gc/

View file

@ -1,11 +1,6 @@
{
kubernetes.resources = {
configMaps = {
minecraft-env.data = {
EULA = "TRUE";
};
};
configMaps.minecraft-env.data.EULA = "TRUE";
deployments.minecraft = {
metadata.labels.app = "minecraft";
@ -20,14 +15,42 @@
containers.minecraft = {
image = "itzg/minecraft-server";
envFrom = [{ configMapRef.name = "minecraft-env"; }];
ports = [{
containerPort = 25565;
protocol = "TCP";
}];
volumeMounts = [{
name = "data";
mountPath = "/data";
}];
};
volumes = [{
name = "data";
persistentVolumeClaim.claimName = "minecraft";
}];
};
};
};
};
persistentVolumes.minecraft.spec = {
capacity.storage = "1Mi";
accessModes = [ "ReadWriteMany" ];
nfs = {
server = "lewis.dmz";
path = "/mnt/data/nfs/minecraft";
};
};
persistentVolumeClaims.minecraft.spec = {
accessModes = [ "ReadWriteMany" ];
storageClassName = "";
resources.requests.storage = "1Mi";
volumeName = "minecraft";
};
services.minecraft.spec = {

View file

@ -28,6 +28,7 @@ let
"/prowlarr/config"
"/sonarr/config"
"/bazarr/config"
"/minecraft"
];
nfsExports = lib.strings.concatLines (