Files
system-config/system/hosts/mcp/containers/grafana.nix
2025-03-22 11:32:35 -07:00

68 lines
1.5 KiB
Nix

{ config, ... }:
let
lib = import ./lib.nix config;
in {
imports = [
./shared-postgres.nix
];
virtualisation.oci-containers.containers.grafana = lib.mkContainer {
image = "grafana/grafana-enterprise";
dependsOn = [
"db"
"loki"
];
hostName = "grafana";
domain = lib.blazestar;
port = 3000;
homepageOpts = {
group = "Infra";
icon = "grafana.png";
name = "Grafana";
description = "Database Visualization";
};
volumes = [
"grafana-storage:/var/lib/grafana"
];
environment = {
GF_SERVER_ROOT_URL = "https://grafana.${lib.blazestar}";
};
};
# TODO: Put this behind some form of authentication
virtualisation.oci-containers.containers.loki = lib.mkContainer {
image = "grafana/loki";
hostName = "loki";
domain = lib.blazestar;
port = 3100;
homepageOpts = {
group = "Infra";
icon = "loki.png";
name = "Loki";
description = "Log Database";
};
environment = {};
};
services.promtail = {
enable = true;
configuration = {
server.http_listen_port = 9080;
clients = [
{ url = "https://loki.blazestar.net/loki/api/v1/push"; }
];
scrape_configs = [{
job_name = "journal";
journal = {
max_age = "12h";
labels = { job = "systemd-journal"; };
};
relabel_configs = [{
source_labels = ["__journal__systemd_unit"];
target_label = "unit";
}];
}];
};
};
}