nixos-servers/kubenix-modules/nextcloud.nix

158 lines
3.7 KiB
Nix
Raw Normal View History

{ myLib, ... }: {
2024-03-28 20:44:21 +00:00
kubernetes.resources = {
secrets.database.stringData.databasePassword = "ref+sops://secrets/kubernetes.yaml#/nextcloud/databasePassword";
2024-03-29 11:04:16 +00:00
deployments = {
server.spec = {
selector.matchLabels = {
app = "nextcloud";
component = "server";
};
strategy = {
type = "RollingUpdate";
2024-03-29 11:04:16 +00:00
rollingUpdate = {
maxSurge = 0;
maxUnavailable = 1;
};
};
template = {
metadata.labels = {
app = "nextcloud";
component = "server";
};
2024-03-29 11:04:16 +00:00
spec = {
volumes.data.persistentVolumeClaim.claimName = "data";
containers.nextcloud = {
2024-07-30 19:28:35 +00:00
image = myLib.globals.images.nextcloud;
ports.web.containerPort = 80;
2024-03-29 11:04:16 +00:00
env = {
POSTGRES_USER.value = "nextcloud";
POSTGRES_DB.value = "nextcloud";
POSTGRES_HOST.value = "lewis.dmz";
2024-04-14 19:00:15 +00:00
POSTGRES_PASSWORD.valueFrom.secretKeyRef = {
name = "database";
key = "databasePassword";
};
2024-04-14 19:00:15 +00:00
};
2024-03-29 11:04:16 +00:00
volumeMounts = [{
name = "data";
mountPath = "/var/www/html";
2024-03-29 11:04:16 +00:00
}];
};
securityContext = {
fsGroup = 33;
fsGroupChangePolicy = "OnRootMismatch";
};
affinity.nodeAffinity.preferredDuringSchedulingIgnoredDuringExecution = [{
weight = 1;
preference.matchExpressions = [{
key = "storageType";
operator = "In";
values = [ "fast" ];
}];
}];
};
};
};
2024-05-21 20:35:46 +00:00
database.spec = {
selector.matchLabels = {
app = "nextcloud";
component = "database";
};
template = {
metadata.labels = {
app = "nextcloud";
component = "database";
};
spec = {
containers.postgres = {
image = myLib.globals.images.postgres15;
imagePullPolicy = "IfNotPresent";
ports.postgres.containerPort = 5432;
env = {
POSTGRES_DB.value = "nextcloud";
POSTGRES_USER.value = "nextcloud";
PGDATA.value = "/pgdata/data";
POSTGRES_PASSWORD.valueFrom.secretKeyRef = {
name = "database";
key = "databasePassword";
};
};
volumeMounts = [{
name = "database";
mountPath = "/pgdata";
}];
};
volumes.database.persistentVolumeClaim.claimName = "database";
2024-03-29 11:04:16 +00:00
};
};
};
};
services = {
server.spec = {
type = "LoadBalancer";
loadBalancerIP = myLib.globals.nextcloudIPv4;
selector = {
app = "nextcloud";
component = "server";
};
ports.web = {
port = 80;
targetPort = "web";
};
};
2024-03-29 11:04:16 +00:00
database.spec = {
selector = {
app = "nextcloud";
component = "database";
};
ports.postgres = {
port = 5432;
targetPort = "postgres";
};
2024-04-14 19:43:31 +00:00
};
2024-03-29 11:04:16 +00:00
};
};
2024-03-29 11:04:16 +00:00
lab = {
tailscaleIngresses.tailscale = {
host = "nextcloud";
service.name = "server";
2024-03-29 11:04:16 +00:00
};
longhorn.persistentVolumeClaim = {
data = {
volumeName = "nextcloud";
storage = "50Gi";
};
database = {
volumeName = "nextcloud-db";
storage = "400Mi";
};
};
2024-03-28 20:44:21 +00:00
};
}