nixos-servers/kubenix-modules/nextcloud.nix

161 lines
3.8 KiB
Nix
Raw Normal View History

2024-03-28 20:44:21 +00:00
{
kubernetes.resources = {
configMaps = {
nextcloud.data = {
POSTGRES_USER = "nextcloud";
POSTGRES_DB = "nextcloud";
POSTGRES_HOST = "lewis.dmz";
};
nextcloud-db-env.data = {
POSTGRES_DB = "nextcloud";
POSTGRES_USER = "nextcloud";
2024-06-15 20:27:07 +00:00
POSTGRES_PASSWORD = "ref+sops://secrets/kubernetes.yaml#/nextcloud/databasePassword";
PGDATA = "/pgdata/data";
};
2024-03-29 11:04:16 +00:00
};
2024-06-15 20:27:07 +00:00
secrets.nextcloud.stringData.databasePassword = "ref+sops://secrets/kubernetes.yaml#/nextcloud/databasePassword";
2024-03-29 11:04:16 +00:00
deployments = {
nextcloud = {
metadata.labels = {
app = "nextcloud";
component = "website";
};
spec = {
selector.matchLabels = {
app = "nextcloud";
component = "website";
};
2024-03-29 11:04:16 +00:00
strategy = {
type = "RollingUpdate";
rollingUpdate = {
maxSurge = 0;
maxUnavailable = 1;
};
};
2024-03-29 11:04:16 +00:00
template = {
metadata.labels = {
app = "nextcloud";
component = "website";
};
spec = {
volumes.data.persistentVolumeClaim.claimName = "nextcloud";
2024-03-29 11:04:16 +00:00
containers.nextcloud = {
image = "nextcloud:28";
envFrom = [{ configMapRef.name = "nextcloud"; }];
ports.web.containerPort = 80;
2024-04-14 19:00:15 +00:00
env.POSTGRES_PASSWORD.valueFrom.secretKeyRef = {
name = "nextcloud";
key = "databasePassword";
};
volumeMounts = [{
name = "data";
mountPath = "/var/www/html";
}];
};
2024-03-29 11:04:16 +00:00
securityContext = {
fsGroup = 33;
fsGroupChangePolicy = "OnRootMismatch";
2024-04-14 19:00:15 +00:00
};
2024-03-29 11:04:16 +00:00
affinity.nodeAffinity.preferredDuringSchedulingIgnoredDuringExecution = [{
weight = 1;
preference.matchExpressions = [{
key = "storageType";
operator = "In";
values = [ "fast" ];
}];
2024-03-29 11:04:16 +00:00
}];
};
};
};
};
2024-05-21 20:35:46 +00:00
nextcloud-db = {
metadata.labels = {
app = "nextcloud";
component = "database";
};
spec = {
selector.matchLabels = {
app = "nextcloud";
component = "database";
};
template = {
metadata.labels = {
app = "nextcloud";
component = "database";
2024-05-21 20:35:46 +00:00
};
spec = {
containers.postgres = {
image = "postgres:15";
imagePullPolicy = "IfNotPresent";
ports.postgres.containerPort = 5432;
envFrom = [{ configMapRef.name = "nextcloud-db-env"; }];
volumeMounts = [{
name = "data";
mountPath = "/pgdata";
}];
};
volumes.data.persistentVolumeClaim.claimName = "nextcloud-db";
};
2024-03-29 11:04:16 +00:00
};
};
};
};
services = {
nextcloud.spec = {
selector = {
app = "nextcloud";
component = "website";
};
ports.web = {
port = 80;
targetPort = "web";
};
};
2024-03-29 11:04:16 +00:00
nextcloud-db.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 = {
ingresses.nextcloud = {
host = "cloud.kun.is";
service = {
name = "nextcloud";
portName = "web";
};
2024-03-29 11:04:16 +00:00
};
2024-03-28 20:44:21 +00:00
};
}