nixos-servers/kubenix-modules/atuin.nix

110 lines
2.5 KiB
Nix
Raw Normal View History

2024-06-12 21:14:55 +00:00
{
kubernetes.resources = {
secrets.database.stringData = {
2024-06-15 20:27:07 +00:00
databasePassword = "ref+sops://secrets/kubernetes.yaml#/atuin/databasePassword";
databaseURL = "ref+sops://secrets/kubernetes.yaml#/atuin/databaseURL";
2024-06-12 21:14:55 +00:00
};
deployments.server.spec = {
selector.matchLabels.app = "atuin";
2024-06-12 21:14:55 +00:00
strategy = {
type = "RollingUpdate";
2024-06-12 21:14:55 +00:00
rollingUpdate = {
maxSurge = 0;
maxUnavailable = 1;
2024-06-12 21:14:55 +00:00
};
};
2024-06-12 21:14:55 +00:00
template = {
metadata.labels.app = "atuin";
2024-06-12 21:14:55 +00:00
spec = {
volumes = {
data.persistentVolumeClaim.claimName = "data";
database.persistentVolumeClaim.claimName = "database";
};
2024-06-12 21:14:55 +00:00
containers = {
atuin = {
image = "ghcr.io/atuinsh/atuin:18.3.0";
imagePullPolicy = "IfNotPresent";
ports.web.containerPort = 8888;
args = [ "server" "start" ];
env = {
ATUIN_HOST.value = "0.0.0.0";
ATUIN_PORT.value = "8888";
ATUIN_OPEN_REGISTRATION.value = "false";
ATUIN_DB_URI.valueFrom.secretKeyRef = {
name = "database";
key = "databaseURL";
2024-06-12 21:14:55 +00:00
};
};
volumeMounts = [{
name = "data";
mountPath = "/config";
}];
};
2024-06-12 21:14:55 +00:00
database = {
image = "postgres:14";
ports.web.containerPort = 5432;
2024-06-12 21:14:55 +00:00
env = {
POSTGRES_DB.value = "atuin";
POSTGRES_USER.value = "atuin";
2024-06-12 21:14:55 +00:00
POSTGRES_PASSWORD.valueFrom.secretKeyRef = {
name = "database";
key = "databasePassword";
};
2024-06-12 21:14:55 +00:00
};
volumeMounts = [{
name = "database";
mountPath = "/var/lib/postgresql/data";
}];
2024-06-12 21:14:55 +00:00
};
};
};
};
};
services.server.spec = {
2024-06-12 21:14:55 +00:00
selector.app = "atuin";
ports.web = {
port = 80;
targetPort = "web";
};
};
};
lab = {
ingresses.server = {
host = "atuin.kun.is";
service = {
name = "server";
portName = "web";
};
};
longhorn.persistentVolumeClaim = {
data = {
volumeName = "atuin";
storage = "300Mi";
};
2024-06-12 21:14:55 +00:00
database = {
volumeName = "atuin-db";
storage = "300Mi";
};
2024-06-12 21:14:55 +00:00
};
};
}