box: add smtp config to grafana, allow access to psql dbs

This commit is contained in:
Anish Lakhwara 2023-05-30 22:23:28 +10:00
parent da8e4b25eb
commit 8c3924d942

View file

@ -1,22 +1,23 @@
{ self, config, pkgs, ... }: { { self, config, pkgs, ... }: {
age.secrets.smtp_password.file = "${self}/secrets/nullhex-smtp.age"; age.secrets.nullhex-smtp.file = "${self}/secrets/nullhex-smtp.age";
age.secrets.smtp_password.owner = "nobody"; age.secrets.nullhex-smtp.owner = "grafana";
# grafana configuration # grafana configuration
services.grafana = { services.grafana = {
enable = true; enable = true;
settings = { settings = {
smtp = { smtp = {
enabled = false; enabled = true;
password = "$__file{/run/secrets/smtp_password}"; password = "$__file{/run/agenix/nullhex-smtp}";
host = "smtp.nullhex.com"; host = "smtp.nullhex.com";
user = "ops@sealight.xyz"; user = "ops@sealight.xyz";
from_address = "ops@sealight.xyz"; from_address = "ops@sealight.xyz";
}; };
server = { server = {
domain = "stats.mossnet.lan"; domain = "stats.mossnet.lan";
http_port = 2342;
http_addr = "127.0.0.1"; http_addr = "127.0.0.1";
http_port = 2342;
root_url = "http://stats.mossnet.lan/";
}; };
}; };
# TODO enable # TODO enable
@ -24,14 +25,25 @@
}; };
# nginx reverse proxy # 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} = { services.nginx.virtualHosts.${config.services.grafana.settings.server.domain} = {
locations."/" = { locations."/" = {
proxyPass = "http://127.0.0.1:${toString config.services.grafana.settings.server.http_port}"; proxyPass = "http://127.0.0.1:2342";
proxyWebsockets = true; proxyWebsockets = true;
}; };
}; };
services.postgresql = {
ensureUsers = [{
name = "grafana";
ensurePermissions = {
"DATABASE wallabag" = "SELECT";
"DATABASE ulogger" = "SELECT";
"DATABASE photoprism" = "SELECT";
};
}];
};
services.prometheus = { services.prometheus = {
enable = true; enable = true;
port = 9001; port = 9001;