mirror of
https://github.com/tuxdotrs/tawm.git
synced 2025-07-06 21:16:35 +05:30
refactor: categorised apps
This commit is contained in:
45
modules/nixos/selfhosted/monitoring/grafana.nix
Normal file
45
modules/nixos/selfhosted/monitoring/grafana.nix
Normal file
@ -0,0 +1,45 @@
|
||||
{
|
||||
lib,
|
||||
username,
|
||||
email,
|
||||
...
|
||||
}: {
|
||||
services = {
|
||||
grafana = {
|
||||
enable = true;
|
||||
settings = {
|
||||
server.http_port = 8888;
|
||||
security = {
|
||||
admin_user = "${username}";
|
||||
admin_email = "${email}";
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
nginx = {
|
||||
enable = lib.mkForce true;
|
||||
virtualHosts = {
|
||||
"grafana.tux.rs" = {
|
||||
forceSSL = true;
|
||||
useACMEHost = "tux.rs";
|
||||
locations = {
|
||||
"/" = {
|
||||
proxyPass = "http://localhost:8888";
|
||||
proxyWebsockets = true;
|
||||
};
|
||||
|
||||
"/api/live/" = {
|
||||
proxyPass = "http://localhost:8888";
|
||||
extraConfig = ''
|
||||
proxy_http_version 1.1;
|
||||
proxy_set_header Upgrade $http_upgrade;
|
||||
proxy_set_header Connection $connection_upgrade;
|
||||
proxy_set_header Host $host;
|
||||
'';
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
77
modules/nixos/selfhosted/monitoring/loki.nix
Normal file
77
modules/nixos/selfhosted/monitoring/loki.nix
Normal file
@ -0,0 +1,77 @@
|
||||
{lib, ...}: {
|
||||
services = {
|
||||
loki = {
|
||||
enable = true;
|
||||
configuration = {
|
||||
auth_enabled = false;
|
||||
server = {
|
||||
http_listen_port = 3100;
|
||||
};
|
||||
common = {
|
||||
ring = {
|
||||
instance_addr = "127.0.0.1";
|
||||
kvstore = {
|
||||
store = "inmemory";
|
||||
};
|
||||
};
|
||||
replication_factor = 1;
|
||||
path_prefix = "/tmp/loki";
|
||||
};
|
||||
schema_config = {
|
||||
configs = [
|
||||
{
|
||||
from = "2020-05-15";
|
||||
store = "tsdb";
|
||||
object_store = "filesystem";
|
||||
schema = "v13";
|
||||
index = {
|
||||
prefix = "index_";
|
||||
period = "24h";
|
||||
};
|
||||
}
|
||||
];
|
||||
};
|
||||
storage_config = {
|
||||
filesystem = {
|
||||
directory = "/tmp/loki/chunks";
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
nginx = {
|
||||
enable = lib.mkForce true;
|
||||
virtualHosts = {
|
||||
"loki.tux.rs" = {
|
||||
forceSSL = true;
|
||||
useACMEHost = "tux.rs";
|
||||
locations = {
|
||||
"/" = {
|
||||
proxyPass = "http://localhost:3100";
|
||||
extraConfig = ''
|
||||
proxy_http_version 1.1;
|
||||
proxy_read_timeout 1800s;
|
||||
proxy_connect_timeout 1600s;
|
||||
proxy_set_header Upgrade $http_upgrade;
|
||||
proxy_set_header Connection $connection_upgrade;
|
||||
proxy_set_header Connection "Keep-Alive";
|
||||
proxy_set_header Proxy-Connection "Keep-Alive";
|
||||
proxy_redirect off;
|
||||
'';
|
||||
};
|
||||
|
||||
"/ready" = {
|
||||
proxyPass = "http://localhost:3100";
|
||||
extraConfig = ''
|
||||
proxy_http_version 1.1;
|
||||
proxy_set_header Connection "Keep-Alive";
|
||||
proxy_set_header Proxy-Connection "Keep-Alive";
|
||||
proxy_redirect off;
|
||||
'';
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
55
modules/nixos/selfhosted/monitoring/promtail.nix
Normal file
55
modules/nixos/selfhosted/monitoring/promtail.nix
Normal file
@ -0,0 +1,55 @@
|
||||
{lib, ...}: {
|
||||
services = {
|
||||
promtail = {
|
||||
enable = true;
|
||||
configuration = {
|
||||
server = {
|
||||
http_listen_port = 9080;
|
||||
grpc_listen_port = 0;
|
||||
};
|
||||
positions = {
|
||||
filename = "/var/lib/promtail/positions.yaml";
|
||||
};
|
||||
clients = [
|
||||
{
|
||||
url = "https://loki.tux.rs/loki/api/v1/push";
|
||||
}
|
||||
];
|
||||
scrape_configs = [
|
||||
{
|
||||
job_name = "journal";
|
||||
journal = {
|
||||
max_age = "12h";
|
||||
labels = {
|
||||
job = "systemd-journal";
|
||||
};
|
||||
};
|
||||
relabel_configs = [
|
||||
{
|
||||
source_labels = [
|
||||
"__journal__systemd_unit"
|
||||
];
|
||||
target_label = "unit";
|
||||
}
|
||||
];
|
||||
}
|
||||
];
|
||||
};
|
||||
};
|
||||
|
||||
nginx = {
|
||||
enable = lib.mkForce true;
|
||||
virtualHosts = {
|
||||
"promtail.tux.rs" = {
|
||||
forceSSL = true;
|
||||
useACMEHost = "tux.rs";
|
||||
locations = {
|
||||
"/" = {
|
||||
proxyPass = "http://localhost:9080";
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
Reference in New Issue
Block a user