style
Some checks failed
Basic Code Checks / formatting-check (push) Has been cancelled

Signed-off-by: gwg313 <gwg313@pm.me>
This commit is contained in:
gwg313 2025-07-03 10:34:00 -04:00
parent 4c0e29da8f
commit bb2fe56082
Signed by: gwg313
GPG key ID: 60FF63B4826B7400
40 changed files with 595 additions and 1144 deletions

View file

@ -22,7 +22,9 @@
./grafana.nix
./promtail.nix
./loki.nix
./uptime-kuma.nix
./prometheus_node_exporter.nix
./traefik.nix
inputs.sops-nix.nixosModules.sops
];

View file

@ -1,14 +1,27 @@
_: {
{ config, ... }:
{
sops.secrets.grafana_user = {
mode = "0440";
owner = config.users.users.grafana.name;
group = config.users.users.grafana.group;
};
sops.secrets.grafana_password = {
mode = "0440";
owner = config.users.users.grafana.name;
group = config.users.users.grafana.group;
};
services.grafana = {
enable = true;
settings = {
server = {
http_addr = "127.0.0.1";
http_port = 3000;
http_port = 3001;
};
security = {
admin_user = "admin";
admin_password = "changeme";
admin_user = "${config.sops.secrets.grafana_user.path}";
admin_password = "${config.sops.secrets.grafana_password.path}";
};
};

View file

@ -0,0 +1,30 @@
# This is a complete configuration to deploy Loki backed by the filesystem.
# The index will be shipped to the storage via tsdb-shipper.
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

View file

@ -1,53 +1,6 @@
_: {
{
services.loki = {
enable = true;
configuration = {
auth_enabled = false;
server.http_listen_port = 3100;
ingester = {
lifecycler = {
ring = {
kvstore = {
store = "inmemory";
};
};
final_sleep = "0s";
};
chunk_idle_period = "5m";
max_chunk_age = "1h";
chunk_target_size = 1048576;
};
schema_config = {
configs = [
{
from = "2024-01-01";
store = "boltdb-shipper";
object_store = "filesystem";
schema = "v11";
index = {
prefix = "index_";
period = "24h";
};
}
];
};
storage_config = {
boltdb_shipper = {
active_index_directory = "/var/lib/loki/index";
cache_location = "/var/lib/loki/cache";
shared_store = "filesystem";
};
filesystem = {
directory = "/var/lib/loki/chunks";
};
};
limits_config = {
retention_period = "168h";
};
};
configFile = ./loki-config.yaml;
};
}

View file

@ -1,9 +1,13 @@
{ config, ... }:
{
systemd.tmpfiles.rules = [
"d /var/lib/promtail 0755 promtail promtail -"
];
services.promtail = {
enable = true;
configuration = {
server.http_listen_port = 9080;
server.grpc_listen_port = 0;
positions = {
filename = "/var/lib/promtail/positions.yaml";
};

View file

@ -0,0 +1,36 @@
{
imports = [
./services.nix
];
services.traefik = {
dynamicConfigOptions = {
http = {
routers = {
uptime_kuma_local = {
entryPoints = [ "websecure" ];
rule = "Host(`uptime.gwg313.xyz`)";
service = "uptime_kuma_local";
tls.certResolver = "le";
middlewares = [ "headers" ];
};
grafana_local = {
entryPoints = [ "websecure" ];
rule = "Host(`grafana.gwg313.xyz`)";
service = "grafana_local";
tls.certResolver = "le";
middlewares = [ "headers" ];
};
loki_local = {
entryPoints = [ "websecure" ];
rule = "Host(`loki.gwg313.xyz`)";
service = "loki_local";
tls.certResolver = "le";
middlewares = [ "headers" ];
};
};
};
};
};
}

View file

@ -0,0 +1,27 @@
{
services.traefik = {
dynamicConfigOptions = {
http = {
services = {
uptime_kuma_local.loadBalancer.servers = [
{
url = "http://127.0.0.1:3030";
}
];
grafana_local.loadBalancer.servers = [
{
url = "http://127.0.0.1:3001";
}
];
loki_local.loadBalancer.servers = [
{
url = "http://127.0.0.1:3100";
}
];
};
};
};
};
}

View file

@ -2,6 +2,7 @@
{ config, ... }:
{
imports = [
./routes.nix
];
sops.secrets.cf-api-token = {
mode = "0440";
@ -60,22 +61,22 @@
};
};
};
log = {
level = "DEBUG";
filePath = "/var/log/traefik/traefik.log";
};
accessLog = {
filePath = "/var/log/traefik/access.log";
bufferingSize = 0;
filters = { };
fields = {
defaultMode = "keep";
names = {
StartUTC = "drop";
};
};
};
# log = {
# level = "DEBUG";
# filePath = "/var/log/traefik/traefik.log";
# };
#
# accessLog = {
# filePath = "/var/log/traefik/access.log";
# bufferingSize = 0;
# filters = {};
# fields = {
# defaultMode = "keep";
# names = {
# StartUTC = "drop";
# };
# };
# };
};
dynamicConfigOptions = {
http = {

View file

@ -0,0 +1,9 @@
_: {
services.uptime-kuma = {
enable = true;
settings = {
HOST = "127.0.0.1";
PORT = "3030";
};
};
}