From 7a8cf7b1df232ea2af62a92f8dfde92983f635d6 Mon Sep 17 00:00:00 2001 From: kity Date: Sat, 12 Apr 2025 12:54:03 +0200 Subject: [PATCH] =?UTF-8?q?feat:=20ajout=20de=20Django=203.1.14,=20configu?= =?UTF-8?q?ration=20de=20sabnzbd=20et=20am=C3=A9lioration=20de=20l'archive?= =?UTF-8?q?box?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- hosts/sisyphe/configuration.nix | 1 + hosts/sisyphe/features/multimedia/sabnzbd.nix | 17 +------ hosts/sisyphe/features/prometheus.nix | 51 +++++++++++++++---- .../sisyphe/features/services/archivebox.nix | 28 +++++++++- 4 files changed, 71 insertions(+), 26 deletions(-) diff --git a/hosts/sisyphe/configuration.nix b/hosts/sisyphe/configuration.nix index 8ec97c9..896da0c 100644 --- a/hosts/sisyphe/configuration.nix +++ b/hosts/sisyphe/configuration.nix @@ -112,6 +112,7 @@ in "aspnetcore-runtime-wrapped-6.0.36" "dotnet-sdk-6.0.428" "dotnet-sdk-wrapped-6.0.428" + "python3.12-django-3.1.14" ]; # seems like sabnzbd needs some unfree pkgs... diff --git a/hosts/sisyphe/features/multimedia/sabnzbd.nix b/hosts/sisyphe/features/multimedia/sabnzbd.nix index 75a85d3..5a275f1 100644 --- a/hosts/sisyphe/features/multimedia/sabnzbd.nix +++ b/hosts/sisyphe/features/multimedia/sabnzbd.nix @@ -1,24 +1,11 @@ -{ config, pkgs, ... }: +{ ... }: { services.sabnzbd = { enable = true; openFirewall = true; }; - services.caddy.virtualHosts."http://nzb.normandy.sisyphe.hypervirtual.world".extraConfig = '' + services.caddy.virtualHosts."http://nzb.sisyphe.normandy.hypervirtual.world".extraConfig = '' reverse_proxy 8080 ''; - - /* - services.prometheus.exporters.sabnzbd = { - enable = true; - servers = [ - { - sisyphe = { - - }; - } - ]; - }; - */ } diff --git a/hosts/sisyphe/features/prometheus.nix b/hosts/sisyphe/features/prometheus.nix index 0c32ac4..0ccc4a9 100644 --- a/hosts/sisyphe/features/prometheus.nix +++ b/hosts/sisyphe/features/prometheus.nix @@ -11,23 +11,54 @@ ]; port = 9002; }; + borgmatic = { + enable = true; + }; + systemd = { + enable = true; + }; + sabnzbd = { + enable = true; + servers = [ + { + "sisyphe" = { + apiKeyFile = "/run/secrets/sabnbzd_apikey"; + }; + } + ]; + }; + redis = { + enable = true; + }; + postgres = { + enable = true; + }; + pihole = { + enable = true; + pihoeHostname = "192.168.1.25"; + }; + php-fpm = { + enable = true; + }; + nextcloud = { + enable = true; + url = "https://cloud.hypervirtual.world"; + tokenFile = "/run/secrets/nextcloudTokenFile"; + }; }; scrapeConfigs = [ - /* - { - job_name = "synapse"; - scrape_interval = "15s"; - metrics_path = "/_synapse/metrics"; - static_configs = [ { targets = [ "localhost:9000" ]; } ]; - } - */ + { job_name = "homelab-stats"; static_configs = [ - { targets = [ "localhost:${builtins.toString config.services.prometheus.exporters.node.port}" ]; } + { + targets = [ + "localhost:${builtins.toString config.services.prometheus.exporters.node.port}" + "192.168.1.197:9100" + ]; + } ]; } ]; - }; } diff --git a/hosts/sisyphe/features/services/archivebox.nix b/hosts/sisyphe/features/services/archivebox.nix index d0685d3..98a5665 100644 --- a/hosts/sisyphe/features/services/archivebox.nix +++ b/hosts/sisyphe/features/services/archivebox.nix @@ -1,6 +1,32 @@ -{config, pkgs, ...}: +{ config, pkgs, ... }: { environment.systemPackages = with pkgs; [ archivebox + nodejs_23 ]; + + services.caddy.virtualHosts."archive.hypervirtual.world".extraConfig = '' + reverse_proxy 15632 + ''; + + systemd.services."archivebox-web" = { + enable = true; + description = "Runs the archivebox web UI"; + preStart = '' + mkdir -p /srv/archivebox + chown archivebox:archivebox /srv/archivebox + if [ ! -f /srv/archivebox/index.sqlite3 ]; then + sudo -u archivebox ${pkgs.archivebox}/bin/archivebox init --path /srv/archivebox + fi + ''; + serviceConfig = { + ExecStart = "${pkgs.archivebox}/bin/archivebox server 0.0.0.0:15632 --path /srv/archivebox"; + Restart = "always"; + User = "archivebox"; + Group = "archivebox"; + WorkingDirectory = "/var/lib/archivebox"; + }; + wantedBy = [ "multi-user.target" ]; + }; + }