nixos-servers/kubenix-modules/hedgedoc.nix

171 lines
4.1 KiB
Nix
Raw Permalink Normal View History

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