infrastructure/machines/nixos/storage01/influxdb.nix
Tom Hubrecht 88d9b8c3e3
chore: Add license and copyright information
Signed-off-by: Tom Hubrecht <tom.hubrecht@dgnum.eu>
Acked-by: Ryan Lahfa <ryan.lahfa@dgnum.eu>
Acked-by: Maurice Debray <maurice.debray@dgnum.eu>
Acked-by: Lubin Bailly <lubin.bailly@dgnum.eu>
Acked-by: Jean-Marc Gailis <jean-marc.gailis@dgnum.eu> as the legal authority, at the time of writing, in DGNum.
Acked-by: Elias Coppens <elias.coppens@dgnum.eu> as a member, at the time of writing, of the DGNum executive counsel.
2024-12-13 12:41:38 +01:00

54 lines
1.1 KiB
Nix

# SPDX-FileCopyrightText: 2024 Tom Hubrecht <tom.hubrecht@dgnum.eu>
#
# SPDX-License-Identifier: EUPL-1.2
{ config, ... }:
let
secret = name: config.age.secrets."influxdb2-${name}".path;
token = user: secret "${user}_token_file";
host = "influx.dgnum.eu";
port = 8086;
in
{
services.influxdb2 = {
enable = true;
provision = {
enable = true;
organizations = {
dgnum = {
description = "DGNum org";
buckets.telegraf.description = "Telegraf bucket";
auths = {
telegraf = {
writeBuckets = [ "telegraf" ];
tokenFile = token "telegraf";
};
grafana = {
readPermissions = [ "buckets" ];
tokenFile = token "grafana";
};
};
};
};
initialSetup = {
tokenFile = token "initial";
passwordFile = secret "initial_password_file";
organization = "main";
bucket = "main";
};
};
};
dgn-web.simpleProxies.influxdb = {
inherit host port;
};
age-secrets.autoMatch = [ "influxdb2" ];
}