Commit 889e72c1c080

Vincent Demeester <vincent@sbr.pm>
2025-11-28 14:18:25
feat: Add Kiwix offline content server with Traefik
- Enable offline access to Wikipedia and educational content - Provide HTTPS access via Traefik reverse proxy at kiwix.sbr.pm - Serve ZIM archives from sakhalin storage over VPN Signed-off-by: Vincent Demeester <vincent@sbr.pm>
1 parent 13f4fd4
Changed files (3)
systems/rhea/extra.nix
@@ -169,6 +169,14 @@
                   certResolver = "letsencrypt";
                 };
               };
+              kiwix = {
+                rule = "Host(`kiwix.sbr.pm`)";
+                service = "kiwix";
+                entryPoints = [ "websecure" ];
+                tls = {
+                  certResolver = "letsencrypt";
+                };
+              };
             };
             services = syncthingServices // {
               jellyfin = {
@@ -227,6 +235,13 @@
                   ];
                 };
               };
+              kiwix = {
+                loadBalancer = {
+                  servers = [
+                    { url = "http://${builtins.head globals.machines.sakhalin.net.vpn.ips}:8080"; }
+                  ];
+                };
+              };
             };
             middlewares = syncthingMiddlewares;
           };
systems/sakhalin/extra.nix
@@ -135,6 +135,7 @@
         /export/toshito              192.168.1.0/24(rw,fsid=2,no_subtree_check) 10.100.0.0/24(rw,fsid=2,no_subtree_check)
       '';
     };
+
     wireguard = {
       enable = true;
       ips = libx.wg-ips globals.machines.sakhalin.net.vpn.ips;
@@ -202,4 +203,18 @@
 
     startAt = "daily";
   };
+  # Kiwix serve
+  systemd.services.kiwix-serve = {
+    description = "Kiwix offline content server";
+    wantedBy = [ "multi-user.target" ];
+    after = [ "network.target" ];
+
+    serviceConfig = {
+      Type = "simple";
+      User = "vincent";
+      ExecStart = "${pkgs.kiwix-tools}/bin/kiwix-serve --port=8080 --library /mnt/gaia/kiwix/*.zim";
+      Restart = "on-failure";
+      RestartSec = "5s";
+    };
+  };
 }
globals.nix
@@ -576,5 +576,7 @@ _: {
     };
     # MQTT on demeter
     mqtt.host = "demeter";
+    # Kiwix on sakhalin
+    kiwix.host = "sakhalin";
   };
 }