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 .direnv
.terraform.lock.hcl
.terraform
.deploy-gc/ .deploy-gc/

View file

@ -1,11 +1,6 @@
{ {
kubernetes.resources = { kubernetes.resources = {
configMaps = { configMaps.minecraft-env.data.EULA = "TRUE";
minecraft-env.data = {
EULA = "TRUE";
};
};
deployments.minecraft = { deployments.minecraft = {
metadata.labels.app = "minecraft"; metadata.labels.app = "minecraft";
@ -20,14 +15,42 @@
containers.minecraft = { containers.minecraft = {
image = "itzg/minecraft-server"; image = "itzg/minecraft-server";
envFrom = [{ configMapRef.name = "minecraft-env"; }]; envFrom = [{ configMapRef.name = "minecraft-env"; }];
ports = [{ ports = [{
containerPort = 25565; containerPort = 25565;
protocol = "TCP"; 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 = { services.minecraft.spec = {

View file

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