Files
spacestation/capytal/analytics.nix

41 lines
949 B
Nix
Raw Permalink Normal View History

2025-09-13 11:28:42 -03:00
{
config,
self,
...
}: let
cfg = config.services.medama;
2025-04-04 20:15:47 -03:00
in {
2025-09-13 11:28:42 -03:00
imports = [
self.nixosModules.medama
];
2025-04-04 20:15:47 -03:00
services.medama.enable = true;
2025-09-13 11:28:42 -03:00
services.medama.port = 9840;
services.medama.cors = [
2025-04-05 17:23:20 -03:00
"capytal.cc"
"forge.capytal.company"
];
2025-04-04 20:15:47 -03:00
2025-09-13 11:28:42 -03:00
services.anubis.instances."medama" = {
settings = {
BIND = ":${toString (cfg.port + 2)}";
BIND_NETWORK = "tcp";
METRICS_BIND = ":${toString (cfg.port + 3)}";
METRICS_BIND_NETWORK = "tcp";
SERVE_ROBOTS_TXT = true;
TARGET = "http://localhost:${toString cfg.port}";
ED25519_PRIVATE_KEY_HEX_FILE = config.sops.secrets."anubis/medama/hex_file".path;
2025-09-13 11:28:42 -03:00
};
};
services.caddy.virtualHosts.":${toString (cfg.port + 1)}" = {
2025-04-04 20:15:47 -03:00
extraConfig = ''
2025-09-13 11:28:42 -03:00
reverse_proxy /api/* http://localhost:${toString cfg.port}
2025-09-13 11:28:42 -03:00
reverse_proxy http://localhost:${toString (cfg.port + 2)} {
2025-04-04 20:15:47 -03:00
header_up X-Real-Ip {remote_host}
}
'';
};
}