vno1: redirect grafana to fwminex

This commit is contained in:
Motiejus Jakštys 2024-08-03 06:10:03 +03:00
parent 5a811a61e8
commit c8daa0758a
2 changed files with 105 additions and 163 deletions

View File

@ -312,7 +312,6 @@ in
tcp = with myData.ports; [ tcp = with myData.ports; [
80 80
443 443
#grafana
prometheus prometheus
#soju #soju
#soju-ws #soju-ws

View File

@ -63,7 +63,6 @@
paths = [ paths = [
"bitwarden_rs" "bitwarden_rs"
"caddy" "caddy"
"grafana"
"hass" "hass"
"nsd-acme" "nsd-acme"
"tailscale" "tailscale"
@ -85,7 +84,6 @@
paths = [ paths = [
"bitwarden_rs" "bitwarden_rs"
"caddy" "caddy"
"grafana"
"hass" "hass"
"nsd-acme" "nsd-acme"
"tailscale" "tailscale"
@ -149,7 +147,6 @@
tcp = with myData.ports; [ tcp = with myData.ports; [
80 80
443 443
grafana
prometheus prometheus
soju soju
soju-ws soju-ws
@ -226,15 +223,16 @@
metrics metrics
} }
''; '';
virtualHosts = { virtualHosts =
let
fwminex-vno1 = myData.hosts."fwminex.servers.jakst".vno1IP;
fwminex-jakst = myData.hosts."fwminex.servers.jakst".jakstIP;
in
{
"www.11sync.net".extraConfig = "redir https://jakstys.lt/2024/11sync-shutdown/"; "www.11sync.net".extraConfig = "redir https://jakstys.lt/2024/11sync-shutdown/";
"11sync.net".extraConfig = "redir https://jakstys.lt/2024/11sync-shutdown/"; "11sync.net".extraConfig = "redir https://jakstys.lt/2024/11sync-shutdown/";
"vpn.jakstys.lt".extraConfig = ''reverse_proxy ${ "vpn.jakstys.lt".extraConfig = ''reverse_proxy ${fwminex-vno1}:8080'';
myData.hosts."fwminex.servers.jakst".vno1IP "git.jakstys.lt".extraConfig = ''reverse_proxy http://${fwminex-vno1}'';
}:8080'';
"git.jakstys.lt".extraConfig = ''reverse_proxy http://${
myData.hosts."fwminex.servers.jakst".vno1IP
}'';
"hass.jakstys.lt:80".extraConfig = '' "hass.jakstys.lt:80".extraConfig = ''
@denied not remote_ip ${myData.subnets.tailscale.cidr} @denied not remote_ip ${myData.subnets.tailscale.cidr}
abort @denied abort @denied
@ -243,7 +241,7 @@
"grafana.jakstys.lt:80".extraConfig = '' "grafana.jakstys.lt:80".extraConfig = ''
@denied not remote_ip ${myData.subnets.tailscale.cidr} @denied not remote_ip ${myData.subnets.tailscale.cidr}
abort @denied abort @denied
reverse_proxy 127.0.0.1:3000 reverse_proxy ${fwminex-jakst}:3000
''; '';
"bitwarden.jakstys.lt".extraConfig = '' "bitwarden.jakstys.lt".extraConfig = ''
@denied not remote_ip ${myData.subnets.tailscale.cidr} @denied not remote_ip ${myData.subnets.tailscale.cidr}
@ -359,52 +357,6 @@
}; };
}; };
grafana = {
enable = true;
provision = {
enable = true;
datasources.settings = {
apiVersion = 1;
datasources = [
{
name = "Prometheus";
type = "prometheus";
access = "proxy";
url = "http://127.0.0.1:${toString config.services.prometheus.port}";
isDefault = true;
jsonData.timeInterval = "10s";
}
];
};
};
settings = {
paths.logs = "/var/log/grafana";
server = {
domain = "grafana.jakstys.lt";
root_url = "http://grafana.jakstys.lt";
enable_gzip = true;
http_addr = "0.0.0.0";
http_port = myData.ports.grafana;
};
users.auto_assign_org = true;
users.auto_assign_org_role = "Editor";
# https://github.com/grafana/grafana/issues/70203#issuecomment-1612823390
auth.oauth_allow_insecure_email_lookup = true;
"auth.generic_oauth" = {
enabled = true;
auto_login = true;
client_id = "5349c113-467d-4b95-a61b-264f2d844da8";
client_secret = "$__file{/run/grafana/oidc-secret}";
auth_url = "https://git.jakstys.lt/login/oauth/authorize";
api_url = "https://git.jakstys.lt/login/oauth/userinfo";
token_url = "https://git.jakstys.lt/login/oauth/access_token";
};
feature_toggles.accessTokenExpirationCheck = true;
};
};
prometheus = { prometheus = {
enable = true; enable = true;
port = myData.ports.prometheus; port = myData.ports.prometheus;
@ -571,15 +523,6 @@
}; };
}; };
grafana = {
preStart = "ln -sf $CREDENTIALS_DIRECTORY/oidc /run/grafana/oidc-secret";
serviceConfig = {
LogsDirectory = "grafana";
RuntimeDirectory = "grafana";
LoadCredential = [ "oidc:${config.age.secrets.grafana-oidc.path}" ];
};
};
cert-watcher = { cert-watcher = {
description = "Restart caddy when tls keys/certs change"; description = "Restart caddy when tls keys/certs change";
wantedBy = [ "multi-user.target" ]; wantedBy = [ "multi-user.target" ];