modules/monitoring: add loki and promtail

This commit is contained in:
xinyangli 2024-12-02 14:44:26 +08:00
parent 92db38383e
commit 4b5b41b05a
Signed by: xin
SSH key fingerprint: SHA256:UU5pRTl7NiLFJbWJZa+snLylZSXIz5rgHmwjzv8v4oE
20 changed files with 406 additions and 86 deletions

View file

@ -0,0 +1,46 @@
{ config, ... }:
{
sops.secrets."gotosocial/oidc_client_secret" = {
owner = "gotosocial";
};
sops.templates."gotosocial.env" = {
owner = "gotosocial";
content = ''
GTS_OIDC_CLIENT_SECRET=${config.sops.placeholder."gotosocial/oidc_client_secret"}
'';
};
services.gotosocial = {
enable = true;
settings = {
log-level = "info";
bind-address = "127.0.0.1";
port = 19571;
host = "gts.xiny.li";
account-domain = "xiny.li";
letsencrypt-enabled = false;
instance-expose-public-timeline = true;
oidc-enabled = true;
oidc-idp-name = "Kanidm";
oidc-issuer = "https://auth.xinyang.life/oauth2/openid/gotosocial";
oidc-client-id = "gotosocial";
oidc-link-existing = true;
};
environmentFile = config.sops.templates."gotosocial.env".path;
};
services.caddy = {
virtualHosts."https://gts.xiny.li".extraConfig = ''
encode zstd gzip
reverse_proxy * http://${config.services.gotosocial.settings.bind-address}:${toString config.services.gotosocial.settings.port} {
flush_interval -1
}
'';
virtualHosts."https://xiny.li".extraConfig = ''
redir /.well-known/host-meta* https://gts.xiny.li{uri} permanent # host
redir /.well-known/webfinger* https://gts.xiny.li{uri} permanent # host
redir /.well-known/nodeinfo* https://gts.xiny.li{uri} permanent # host
'';
};
}