]> git.immae.eu Git - perso/Immae/Config/Nix.git/blobdiff - modules/private/system/eldiron.nix
Fix netdata stream for eldiron
[perso/Immae/Config/Nix.git] / modules / private / system / eldiron.nix
index bb8bbfc0d1e9c779dba2f9dcae4aab3849f13eca..fdc3692f0cc404376b20fe9419a86abaa864f14d 100644 (file)
   myEnv = import "${privateFiles}/environment.nix" // { inherit privateFiles; };
 
   fileSystems = {
+    # pools:
+    #     zpool: ashift=12
+    #     zfast: ashift=12
+    # zfs:
+    #     zpool/: acltype=posixacl ; xattr=sa ; atime=off ; mountpoint=legacy
+    #     zpool/root: encryption=on ; keyformat=passphrase ; keylocation=file:///boot/pass.key
+    #     zpool/root/var: atime=on
+    #     zfast/: acltype=posixacl ; xattr=sa ; atime=off ; mountpoint=legacy
+    #     zfast/root: encryption=on ; keyformat=passphrase ; keylocation=file:///boot/pass.key
+    #     zfast/root/etc: ø
+    #     zfast/root/nix: ø
+    #     zfast/root/tmp: async=disabled
+    #     zfast/root/var: atime=on
+    #     zfast/root/var/lib: ø
+    #     zfast/root/var/lib/mysql: logbias=throughput ; atime=off ; primarycache=metadata
+    #     zfast/root/var/lib/postgresql: recordsize=8K ; atime=off ; logbias=throughput
+    #     zfast/root/var/lib/postgresql/11.0: ø
+    #     zfast/root/var/lib/postgresql/11.0/pg_wal: ø
     "/"     = { fsType = "zfs"; device = "zpool/root"; };
     "/boot" = { fsType = "ext4"; device = "/dev/disk/by-uuid/e6bb18fb-ff56-4b5f-ae9f-e60d40dc0622"; };
     "/etc"  = { fsType = "zfs"; device = "zpool/root/etc"; };
-    "/nix"  = { fsType = "zfs"; device = "zpool/root/nix"; };
-    "/tmp"  = { fsType = "zfs"; device = "zpool/root/tmp"; };
+    "/nix"  = { fsType = "zfs"; device = "zfast/root/nix"; };
+    "/tmp"  = { fsType = "zfs"; device = "zfast/root/tmp"; };
     "/var"  = { fsType = "zfs"; device = "zpool/root/var"; };
+    "/var/lib/mysql" = { fsType = "zfs"; device = "zfast/root/var/lib/mysql"; };
+    "/var/lib/postgresql"             = { fsType = "zfs"; device = "zfast/root/var/lib/postgresql"; };
+    "/var/lib/postgresql/11.0"        = { fsType = "zfs"; device = "zfast/root/var/lib/postgresql/11.0"; };
+    "/var/lib/postgresql/11.0/pg_wal" = { fsType = "zfs"; device = "zfast/root/var/lib/postgresql/11.0/pg_wal"; };
   };
   swapDevices = [ { label = "swap1"; } { label = "swap2"; } ];
   hardware.enableRedistributableFirmware = true;
 
   services.zfs = {
     autoScrub = {
-      enable = true;
+      enable = false;
     };
   };
   networking = {
     hostId = "8262ca33"; # generated with head -c4 /dev/urandom | od -A none -t x4
     firewall.enable = true;
-    # 176.9.151.89 declared in nixops -> infra / tools
+    # FIXME: on next reboot, remove the /27 and the localCommands
     interfaces."eth0".ipv4.addresses =
       pkgs.lib.attrsets.mapAttrsToList
         (n: ips: { address = ips.ip4; prefixLength = 32; })
   myServices.ejabberd.enable = true;
   myServices.vpn.enable = true;
   services.pure-ftpd.enable = true;
-  services.duplyBackup.enable = true;
+  services.duplyBackup.enable = false;
   services.duplyBackup.profiles.oldies.rootDir = "/var/lib/oldies";
 
+  services.netdata.enable = true;
+  services.netdata.config.global."memory mode" = "none";
+  services.netdata.config.health."enabled" = "no";
+  services.netdata.config.web.mode = "none";
+  users.users."${config.services.netdata.user}".extraGroups = [ "keys" ];
+  environment.etc."netdata/stream.conf".source = "/var/secrets/netdata-stream.conf";
   secrets.keys = [
+    {
+      dest = "netdata-stream.conf";
+      user = config.services.netdata.user;
+      group = config.services.netdata.group;
+      permissions = "0400";
+      text = ''
+        [stream]
+            enabled = yes
+            destination = ${config.myEnv.monitoring.netdata_aggregator}
+            api key = ${config.myEnv.monitoring.netdata_keys.eldiron}
+      '';
+    }
     {
       dest = "zrepl_backup/identity";
       user = "root";
           snapshotting:
             type: periodic
             prefix: zrepl_
-            interval: 15m
-            hooks:
-              - type: mysql-lock-tables
-                dsn: "${config.myEnv.zrepl_backup.mysql.user}:${config.myEnv.zrepl_backup.mysql.password}@tcp(localhost)/"
-                filesystems:
-                  "zpool/root/var": true
-              - type: command
-                path: ${redis_dump}
-                err_is_fatal: false
-                filesystems:
-                  "zpool/root/var": true
+            interval: 1h
+            #hooks:
+            #  - type: mysql-lock-tables
+            #    dsn: "${config.myEnv.zrepl_backup.mysql.user}:${config.myEnv.zrepl_backup.mysql.password}@tcp(localhost)/"
+            #    filesystems:
+            #      "zpool/root/var": true
+            #  - type: command
+            #    path: ${redis_dump}
+            #    err_is_fatal: false
+            #    filesystems:
+            #      "zpool/root/var": true
           send:
             encrypted: true
           pruning:
             keep_sender:
-              - type: not_replicated
               - type: regex
                 regex: "^manual_.*"
               - type: grid
-                grid: 1x1h(keep=all) | 24x1h | 7x1d | 4x7d | 6x30d
+                grid: 24x1h | 7x1d | 4x7d | 6x30d
                 regex: "^zrepl_.*"
             keep_receiver:
               - type: regex
                 regex: "^manual_.*"
               - type: grid
-                grid: 1x1h(keep=all) | 24x1h | 7x1d | 4x7d | 6x30d
+                grid: 6x4h | 7x1d | 4x7d | 6x30d
                 regex: "^zrepl_.*"
     '';
   };