victoriametrics service

This commit is contained in:
2025-07-18 14:09:14 +07:00
parent 872414c995
commit a9b23c823c
6 changed files with 77 additions and 0 deletions

View File

@@ -0,0 +1,47 @@
{
_class = "clan.service";
manifest.name = "Victoria Metrics";
manifest.description = "VictoriaMetrics: fast, cost-effective monitoring solution and time series database";
manifest.categories = [ "System" ];
roles.default = {
perInstance = {
nixosModule =
{
config,
pkgs,
...
}:
let
defaultUser = "victoriametrics";
in
{
clan.core.vars.generators.victoria-metrics = {
files = {
username = {
secret = false;
};
password = {
secret = true;
owner = defaultUser;
group = defaultUser;
};
};
script = ''
echo "admin" > "$out"/username
xkcdpass --numwords 4 --delimiter - --count 1 | tr -d "\n" > "$out"/password
'';
runtimeInputs = [ pkgs.xkcdpass ];
};
services.victoriametrics = {
enable = true;
extraOptions = [
"-httpAuth.username=file://${config.clan.core.vars.generators.victoria-metrics.files.username.path}"
"-httpAuth.password=file://${config.clan.core.vars.generators.victoria-metrics.files.password.path}"
];
};
};
};
};
}