server: minor performance tuning

This commit is contained in:
chayleaf 2024-08-23 10:48:53 +07:00
parent 8f19644b3e
commit cc4ae20674
Signed by: chayleaf
GPG key ID: 78171AD46227E68E
4 changed files with 29 additions and 3 deletions

View file

@ -62,8 +62,23 @@ in {
DISABLE_REGISTRATION = true; DISABLE_REGISTRATION = true;
REGISTER_EMAIL_CONFIRM = true; REGISTER_EMAIL_CONFIRM = true;
}; };
cache = {
ADAPTER = "redis";
HOST = "redis+socket://${config.services.redis.servers.forgejo.unixSocket}";
}; };
}; };
};
systemd.services.forgejo = {
wants = [ "redis-forgejo.service" ];
after = [ "redis-forgejo.service" ];
};
users.users.forgejo.extraGroups = [ config.services.redis.servers.forgejo.user ];
services.redis.servers.forgejo = {
enable = true;
};
services.nginx.virtualHosts."cloud.${cfg.domainName}" = { services.nginx.virtualHosts."cloud.${cfg.domainName}" = {
quic = true; quic = true;
@ -82,6 +97,7 @@ in {
dbtype = "pgsql"; dbtype = "pgsql";
dbhost = "/run/postgresql"; dbhost = "/run/postgresql";
}; };
phpOptions."opcache.interned_strings_buffer" = "16";
settings.overwriteprotocol = "https"; settings.overwriteprotocol = "https";
hostName = "cloud.${cfg.domainName}"; hostName = "cloud.${cfg.domainName}";
https = true; https = true;

View file

@ -27,6 +27,11 @@ in {
hostName = "mail.${cfg.domainName}"; hostName = "mail.${cfg.domainName}";
maxAttachmentSize = 100; maxAttachmentSize = 100;
plugins = [ "persistent_login" ]; plugins = [ "persistent_login" ];
extraConfig = ''
$config['smtp_server'] = "tls://${config.mailserver.fqdn}";
$config['smtp_user'] = "%u";
$config['smtp_pass'] = "%p";
'';
}; };
mailserver = { mailserver = {
enable = true; enable = true;

View file

@ -71,6 +71,8 @@ in {
}; };
}; };
environment.systemPackages = with pkgs; [ matrix-synapse-tools.rust-synapse-compress-state ];
services.matrix-synapse = { services.matrix-synapse = {
enable = true; enable = true;
extraConfigFiles = [ "/var/lib/matrix-synapse/config.yaml" ]; extraConfigFiles = [ "/var/lib/matrix-synapse/config.yaml" ];

View file

@ -133,9 +133,12 @@ in {
{ directory = /var/lib/${config.services.prometheus.stateDir}; user = "prometheus"; group = "prometheus"; mode = "0755"; } { directory = /var/lib/${config.services.prometheus.stateDir}; user = "prometheus"; group = "prometheus"; mode = "0755"; }
] ++ lib.optionals (config.services.qbittorrent-nox.enable or false) [ ] ++ lib.optionals (config.services.qbittorrent-nox.enable or false) [
{ directory = /var/lib/qbittorrent-nox; mode = "0755"; } { directory = /var/lib/qbittorrent-nox; mode = "0755"; }
] ++ lib.optionals (config.services.redis.servers.rspamd.enable or false) [ ] ++ (lib.mapAttrsToList
{ directory = /var/lib/redis-rspamd; user = "redis-rspamd"; group = "redis-rspamd"; mode = "0700"; } (k: v: let
] ++ lib.optionals config.services.roundcube.enable [ name = if k == "" then "redis" else "redis-${k}";
in { directory = /var/lib/${name}; inherit (v) user; group = v.user; mode = "0700"; })
(lib.filterAttrs (k: v: v.enable or false) config.services.redis.servers))
++ lib.optionals config.services.roundcube.enable [
{ directory = /var/lib/roundcube; user = "roundcube"; group = "roundcube"; mode = "0700"; } { directory = /var/lib/roundcube; user = "roundcube"; group = "roundcube"; mode = "0700"; }
] ++ lib.optionals config.services.rspamd.enable [ ] ++ lib.optionals config.services.rspamd.enable [
{ directory = /var/lib/rspamd; user = "rspamd"; group = "rspamd"; mode = "0700"; } { directory = /var/lib/rspamd; user = "rspamd"; group = "rspamd"; mode = "0700"; }