2024-05-09 19:03:27 +00:00
|
|
|
{ lib, ... }: {
|
2024-03-29 09:24:54 +00:00
|
|
|
kubernetes.resources = {
|
2024-07-14 14:20:24 +00:00
|
|
|
configMaps.hedgedoc-config.data.config = lib.generators.toJSON { } {
|
|
|
|
useSSL = false;
|
2024-03-29 09:24:54 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
secrets.hedgedoc.stringData = {
|
2024-06-15 20:27:07 +00:00
|
|
|
databaseURL = "ref+sops://secrets/kubernetes.yaml#/hedgedoc/databaseURL";
|
|
|
|
sessionSecret = "ref+sops://secrets/kubernetes.yaml#/hedgedoc/sessionSecret";
|
2024-03-29 09:24:54 +00:00
|
|
|
};
|
|
|
|
|
2024-05-25 14:07:11 +00:00
|
|
|
deployments = {
|
2024-07-14 14:20:24 +00:00
|
|
|
server.spec = {
|
|
|
|
selector.matchLabels = {
|
2024-05-25 14:07:11 +00:00
|
|
|
app = "hedgedoc";
|
|
|
|
component = "website";
|
|
|
|
};
|
2024-03-29 09:24:54 +00:00
|
|
|
|
2024-07-14 14:20:24 +00:00
|
|
|
template = {
|
|
|
|
metadata.labels = {
|
2024-05-25 14:07:11 +00:00
|
|
|
app = "hedgedoc";
|
|
|
|
component = "website";
|
|
|
|
};
|
2024-03-29 09:24:54 +00:00
|
|
|
|
2024-07-14 14:20:24 +00:00
|
|
|
spec = {
|
|
|
|
containers.hedgedoc = {
|
|
|
|
image = "quay.io/hedgedoc/hedgedoc:1.9.9";
|
|
|
|
ports.web.containerPort = 3000;
|
|
|
|
|
|
|
|
env = {
|
|
|
|
CMD_DOMAIN.value = "md.kun.is";
|
|
|
|
CMD_PORT.value = "3000";
|
|
|
|
CMD_URL_ADDPORT.value = "false";
|
|
|
|
CMD_ALLOW_ANONYMOUS.value = "true";
|
|
|
|
CMD_ALLOW_EMAIL_REGISTER.value = "false";
|
|
|
|
CMD_PROTOCOL_USESSL.value = "true";
|
|
|
|
CMD_CSP_ENABLE.value = "false";
|
|
|
|
|
|
|
|
CMD_DB_URL.valueFrom.secretKeyRef = {
|
|
|
|
name = "hedgedoc";
|
|
|
|
key = "databaseURL";
|
2024-04-14 19:00:15 +00:00
|
|
|
};
|
2024-05-25 14:07:11 +00:00
|
|
|
|
2024-07-14 14:20:24 +00:00
|
|
|
CMD_SESSION_SECRET.valueFrom.secretKeyRef = {
|
|
|
|
name = "hedgedoc";
|
|
|
|
key = "sessionSecret";
|
|
|
|
};
|
2024-04-14 19:00:15 +00:00
|
|
|
};
|
2024-03-29 09:24:54 +00:00
|
|
|
|
2024-07-14 14:20:24 +00:00
|
|
|
volumeMounts = [
|
|
|
|
{
|
|
|
|
name = "uploads";
|
|
|
|
mountPath = "/hedgedoc/public/uploads";
|
|
|
|
}
|
|
|
|
{
|
|
|
|
name = "config";
|
|
|
|
mountPath = "/hedgedoc/config.json";
|
|
|
|
subPath = "config";
|
|
|
|
}
|
|
|
|
];
|
|
|
|
};
|
2024-05-25 14:07:11 +00:00
|
|
|
|
2024-07-14 14:20:24 +00:00
|
|
|
volumes = {
|
|
|
|
uploads.persistentVolumeClaim.claimName = "uploads";
|
|
|
|
config.configMap.name = "hedgedoc-config";
|
|
|
|
};
|
|
|
|
|
|
|
|
securityContext = {
|
|
|
|
fsGroup = 65534;
|
|
|
|
fsGroupChangePolicy = "OnRootMismatch";
|
2024-03-29 09:24:54 +00:00
|
|
|
};
|
2024-05-25 14:07:11 +00:00
|
|
|
};
|
|
|
|
};
|
|
|
|
};
|
2024-03-29 09:24:54 +00:00
|
|
|
|
2024-07-14 14:20:24 +00:00
|
|
|
database.spec = {
|
|
|
|
selector.matchLabels = {
|
2024-05-25 14:07:11 +00:00
|
|
|
app = "hedgedoc";
|
|
|
|
component = "database";
|
|
|
|
};
|
|
|
|
|
2024-07-14 14:20:24 +00:00
|
|
|
template = {
|
|
|
|
metadata.labels = {
|
2024-05-25 14:07:11 +00:00
|
|
|
app = "hedgedoc";
|
|
|
|
component = "database";
|
|
|
|
};
|
|
|
|
|
2024-07-14 14:20:24 +00:00
|
|
|
spec = {
|
|
|
|
containers.postgres = {
|
|
|
|
image = "postgres:15";
|
|
|
|
imagePullPolicy = "IfNotPresent";
|
|
|
|
ports.postgres.containerPort = 5432;
|
|
|
|
|
|
|
|
env = {
|
|
|
|
POSTGRES_DB.value = "hedgedoc";
|
|
|
|
POSTGRES_USER.value = "hedgedoc";
|
|
|
|
POSTGRES_PASSWORD.value = "ref+sops://secrets/kubernetes.yaml#/hedgedoc/databasePassword";
|
|
|
|
PGDATA.value = "/pgdata/data";
|
2024-05-25 14:07:11 +00:00
|
|
|
};
|
|
|
|
|
2024-07-14 14:20:24 +00:00
|
|
|
volumeMounts = [{
|
|
|
|
name = "database";
|
|
|
|
mountPath = "/pgdata";
|
|
|
|
}];
|
2024-05-20 16:10:26 +00:00
|
|
|
};
|
2024-07-14 14:20:24 +00:00
|
|
|
|
|
|
|
volumes.database.persistentVolumeClaim.claimName = "database";
|
2024-03-29 09:24:54 +00:00
|
|
|
};
|
|
|
|
};
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
2024-05-25 14:07:11 +00:00
|
|
|
services = {
|
2024-07-14 14:20:24 +00:00
|
|
|
server.spec = {
|
2024-05-25 14:07:11 +00:00
|
|
|
selector = {
|
|
|
|
app = "hedgedoc";
|
|
|
|
component = "website";
|
|
|
|
};
|
2024-03-29 09:24:54 +00:00
|
|
|
|
2024-05-25 14:07:11 +00:00
|
|
|
ports.web = {
|
|
|
|
port = 80;
|
|
|
|
targetPort = "web";
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
2024-07-14 14:20:24 +00:00
|
|
|
database.spec = {
|
2024-05-25 14:07:11 +00:00
|
|
|
selector = {
|
|
|
|
app = "hedgedoc";
|
|
|
|
component = "database";
|
|
|
|
};
|
|
|
|
|
|
|
|
ports.postgres = {
|
|
|
|
port = 5432;
|
|
|
|
targetPort = "postgres";
|
|
|
|
};
|
2024-04-14 19:43:31 +00:00
|
|
|
};
|
2024-03-29 09:24:54 +00:00
|
|
|
};
|
2024-04-14 21:11:19 +00:00
|
|
|
};
|
2024-03-29 09:24:54 +00:00
|
|
|
|
2024-04-14 21:34:54 +00:00
|
|
|
lab = {
|
2024-07-14 14:20:24 +00:00
|
|
|
ingresses.web = {
|
2024-04-14 21:34:54 +00:00
|
|
|
host = "md.kun.is";
|
|
|
|
|
|
|
|
service = {
|
2024-07-14 14:20:24 +00:00
|
|
|
name = "server";
|
2024-04-14 21:34:54 +00:00
|
|
|
portName = "web";
|
|
|
|
};
|
2024-03-29 09:24:54 +00:00
|
|
|
};
|
2024-07-14 14:20:24 +00:00
|
|
|
|
|
|
|
longhorn.persistentVolumeClaim = {
|
|
|
|
uploads = {
|
|
|
|
volumeName = "hedgedoc-uploads";
|
|
|
|
storage = "50Mi";
|
|
|
|
};
|
|
|
|
|
|
|
|
database = {
|
|
|
|
volumeName = "hedgedoc-db";
|
|
|
|
storage = "100Mi";
|
|
|
|
};
|
|
|
|
};
|
2024-03-29 09:24:54 +00:00
|
|
|
};
|
|
|
|
}
|