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