summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--host/Rory-nginx/services/matrix/synapse/caches.nix10
-rwxr-xr-xhost/Rory-nginx/services/matrix/synapse/synapse-main.nix81
-rw-r--r--host/Rory-nginx/services/matrix/synapse/workers/federation-sender.nix8
3 files changed, 9 insertions, 90 deletions
diff --git a/host/Rory-nginx/services/matrix/synapse/caches.nix b/host/Rory-nginx/services/matrix/synapse/caches.nix
index d129076..6196129 100644
--- a/host/Rory-nginx/services/matrix/synapse/caches.nix
+++ b/host/Rory-nginx/services/matrix/synapse/caches.nix
@@ -1,12 +1,12 @@
 {
-  gc_min_interval = ["5m" "30m" "60m"];
-  gc_thresholds = [1000 500 250];
+  gc_min_interval = [ "15m" "30m" "60m" ];
+  gc_thresholds = [ 10000 5000 2500 ];
   event_cache_size = "12000K"; #defaults to 10K
   caches = {
-    global_factor = 50000.0;
+    global_factor = 500000.0;
     cache_entry_ttl = "24h";
-    expire_caches = true;
-    sync_response_cache_duration = "15s"; #6h
+    expire_caches = false;
+    sync_response_cache_duration = "15s";
     cache_autotuning = {
       max_cache_memory_usage = "65536M";
       target_cache_memory_usage = "32768M";
diff --git a/host/Rory-nginx/services/matrix/synapse/synapse-main.nix b/host/Rory-nginx/services/matrix/synapse/synapse-main.nix
index e204620..543e782 100755
--- a/host/Rory-nginx/services/matrix/synapse/synapse-main.nix
+++ b/host/Rory-nginx/services/matrix/synapse/synapse-main.nix
@@ -19,7 +19,7 @@ in
     enable = true;
     withJemalloc = true;
 
-    federationSenders = 8;
+    federationSenders = 32;
     pushers = 2;
     enableStreamWriters = false;
     enableAppserviceWorker = true;
@@ -45,8 +45,6 @@ in
         max_long_retry_delay = "30s";
       };
 
-      # Alicia - figure this out later...
-      #registration_shared_secret = builtins.exec ["cat" "/dev/urandom" "|" "tr" "-dc" "a-zA-Z0-9" "|" "fold" "-w" "256" "|" "head" "-n" "1"];
       registration_shared_secret_path = "/var/lib/matrix-synapse/registration_shared_secret.txt";
       
       listeners = [
@@ -77,21 +75,6 @@ in
       };
       url_preview_enabled = true;
       database = (import ./db.nix { workerName = "main"; dbGroup = "medium"; });
-      #database = {
-      #  name = "psycopg2";
-      #  args = {
-      #    user = "matrix-synapse-rory-gay";
-      #    #passwordFile = "/run/secrets/matrix-synapse-password";
-      #    password = "somepassword";
-      #    database = "matrix-synapse-rory-gay";
-      #    #host = "127.0.0.1";
-      #    host = "/run/postgresql";
-      #    application_name = "matrix-synapse (rory.gay)";
-      #    cp_min = 5;
-      #    cp_max = 10;
-      #    #cp_reconnect_interval = "True";
-      #  };
-      #};
       app_service_config_files = [
         #"/etc/matrix-synapse/appservice-registration.yaml"
         "/var/lib/matrix-synapse/modas-registration.yaml"
@@ -117,15 +100,8 @@ in
         prefer_local_users = true;
       };
 
+      # https://github.com/element-hq/synapse/blob/master/synapse/config/experimental.py
       experimental_features = {
-        # These apparently arent valid...
-        #"org.matrix.msc3026.busy_presence" = true;
-        #"fi.mau.msc2815" = true;
-        #"org.matrix.msc3881" = true;
-        #"org.matrix.msc3874" = true;
-        #"org.matrix.msc3912" = true;
-
-        # These should be, looking at synapse's experimental.py
         "msc2815_enabled" = true; # Redacted event content
         "msc3026_enabled" = true; # Busy presence
         "msc3266_enabled" = true; # Room summary API
@@ -141,63 +117,12 @@ in
 
       instance_map = {
         main = { # replication listener
-          #host = "127.0.0.1";
-          #port = 8009;
           path = "/run/matrix-synapse/replication-listener.sock";
         };
-      } ;
-      ### // builtins.listToAttrs (map (port: {
-      ###   name = "federation_sender-${toString port}";
-      ###   value = {
-      ###     path = "/run/matrix-synapse/federation_sender-${toString port}.sock";
-      ###   };
-      ### }) federationSenders);
-
-      #} // builtins.listToAttrs (map (port: {
-      #  name = "federation_receiver-${toString port}";
-      #  value = {
-      #    path = "/run/matrix-synapse/federation_receiver-${toString port}.sock";
-      #  };
-      #}) federationReceivers);
-
-      # by type:
-      
-      #federation_sender_instances = map (port: "federation_sender-${toString port}") federationSenders;
+      };
     }
     // import ./ratelimits.nix
     // import ./caches.nix;
-
-    ## TODO: INVESTIGATE
-    # worker_listeners:
-    # - type: metrics
-    #   bind_address: ''
-    #   port: 9101
-
-    #workers = 
-    #builtins.listToAttrs (map (port: {
-    #  name = "federation_receiver-${toString port}";
-    #  value = {
-    #    worker_app = "synapse.app.generic_worker";
-    #    worker_listeners = [
-    #      { 
-    #        port = port;
-    #        type = "http";
-    #        resources = [ {
-    #          names = [ "federation" ];
-    #          compress = false;
-    #        } ];
-    #      }
-    #    ];
-    #  };
-    #}) federationReceivers)
-    ### builtins.listToAttrs (map (port: {
-    ###   name = "federation_sender-${toString port}";
-    ###   value = {
-    ###     worker_app = "synapse.app.generic_worker";
-    ###     worker_listeners = [ ];
-    ###     database = (import ./db.nix { workerName = "federation sender ${toString port}"; dbGroup = "small"; });
-    ###   };
-    ### }) federationSenders);
   };
 
   systemd.services.matrix-synapse-reg-token = {
diff --git a/host/Rory-nginx/services/matrix/synapse/workers/federation-sender.nix b/host/Rory-nginx/services/matrix/synapse/workers/federation-sender.nix
index 9d00c78..9c5ed7c 100644
--- a/host/Rory-nginx/services/matrix/synapse/workers/federation-sender.nix
+++ b/host/Rory-nginx/services/matrix/synapse/workers/federation-sender.nix
@@ -6,13 +6,7 @@ in
 {
   services.matrix-synapse = lib.mkIf (cfg.federationSenders > 0) {
     settings = {
-      instance_map = lib.listToAttrs (lib.map (index: {
-        name = "federation_sender-${toString index}";
-        value = {
-          path = "/run/matrix-synapse/federation_sender-${toString index}.sock";
-        };
-      }) federationSenders);
-
+      # Instance map is not needed for federation senders
       send_federation = false;
       federation_sender_instances = lib.map (index: "federation_sender-${toString index}") federationSenders;
     };