Add metrics port and enable metrics

This commit is contained in:
niten 2024-05-24 09:34:12 -07:00
parent 21ceef59ee
commit 81bdbc2816
1 changed files with 12 additions and 1 deletions

View File

@ -38,6 +38,12 @@ in {
default = 3254; default = 3254;
}; };
metrics-port = mkOption {
type = port;
description = "Port on which to provide metrics.";
default = 9090;
};
images = { images = {
immich = mkOption { immich = mkOption {
type = str; type = str;
@ -71,6 +77,8 @@ in {
POSTGRES_PASSWORD = readFile databasePassword; POSTGRES_PASSWORD = readFile databasePassword;
REDIS_HOSTNAME = "redis"; REDIS_HOSTNAME = "redis";
IMMICH_METRICS = "true";
}; };
target-file = "/run/immich/env"; target-file = "/run/immich/env";
}; };
@ -88,7 +96,10 @@ in {
service = { service = {
image = cfg.images.immich; image = cfg.images.immich;
restart = "always"; restart = "always";
ports = [ "${toString cfg.port}:3001" ]; ports = [
"${toString cfg.port}:3001"
"${toString cfg.metrics-port}:9090"
];
command = [ "start.sh" "immich" ]; command = [ "start.sh" "immich" ];
depends_on = [ "redis" "database" "immich-microservices" ]; depends_on = [ "redis" "database" "immich-microservices" ];
volumes = [ volumes = [