From 8c3924d942d648dc5e33e5e6749c092d7f516f86 Mon Sep 17 00:00:00 2001 From: Anish Lakhwara Date: Tue, 30 May 2023 22:23:28 +1000 Subject: [PATCH] box: add smtp config to grafana, allow access to psql dbs --- hosts/profiles/monitoring/default.nix | 26 +++++++++++++++++++------- 1 file changed, 19 insertions(+), 7 deletions(-) diff --git a/hosts/profiles/monitoring/default.nix b/hosts/profiles/monitoring/default.nix index de5b92a7..86ba35c6 100644 --- a/hosts/profiles/monitoring/default.nix +++ b/hosts/profiles/monitoring/default.nix @@ -1,22 +1,23 @@ { self, config, pkgs, ... }: { - age.secrets.smtp_password.file = "${self}/secrets/nullhex-smtp.age"; - age.secrets.smtp_password.owner = "nobody"; + age.secrets.nullhex-smtp.file = "${self}/secrets/nullhex-smtp.age"; + age.secrets.nullhex-smtp.owner = "grafana"; # grafana configuration services.grafana = { enable = true; settings = { smtp = { - enabled = false; - password = "$__file{/run/secrets/smtp_password}"; + enabled = true; + password = "$__file{/run/agenix/nullhex-smtp}"; host = "smtp.nullhex.com"; user = "ops@sealight.xyz"; from_address = "ops@sealight.xyz"; }; server = { domain = "stats.mossnet.lan"; - http_port = 2342; http_addr = "127.0.0.1"; + http_port = 2342; + root_url = "http://stats.mossnet.lan/"; }; }; # TODO enable @@ -24,14 +25,25 @@ }; # nginx reverse proxy - services.nginx.recommendedProxySettings = true; # Needed for new grafana versions + # services.nginx.recommendedProxySettings = true; # Needed for new grafana versions services.nginx.virtualHosts.${config.services.grafana.settings.server.domain} = { locations."/" = { - proxyPass = "http://127.0.0.1:${toString config.services.grafana.settings.server.http_port}"; + proxyPass = "http://127.0.0.1:2342"; proxyWebsockets = true; }; }; + services.postgresql = { + ensureUsers = [{ + name = "grafana"; + ensurePermissions = { + "DATABASE wallabag" = "SELECT"; + "DATABASE ulogger" = "SELECT"; + "DATABASE photoprism" = "SELECT"; + }; + }]; + }; + services.prometheus = { enable = true; port = 9001;