diff --git a/nixng/containers/matrix/mautrix-discord/default.nix b/nixng/containers/matrix/mautrix-discord/default.nix index 6129eb8..6661559 100644 --- a/nixng/containers/matrix/mautrix-discord/default.nix +++ b/nixng/containers/matrix/mautrix-discord/default.nix @@ -23,18 +23,18 @@ in pkgs.writeShellScript "mautrix-discord" '' - DATA_DIR="/var/lib/mautrix-discord" - CONFIG_FILE="$DATA_DIR/config.yaml" - REGISTRATION_FILE="/var/lib/registrations/mautrix-discord.yaml" - DB_FILE="$DATA_DIR/sqlite.db" + DATA_DIR="/var/lib/mautrix-discord" + CONFIG_FILE="$DATA_DIR/config.yaml" + REGISTRATION_FILE="/var/lib/registrations/mautrix-discord.yaml" + DB_FILE="$DATA_DIR/sqlite.db" - ${getExe pkgs.envsubst} < ${./mautrix-discord.yaml} > "$CONFIG_FILE" - chmod 755 "$CONFIG_FILE" + ${getExe pkgs.envsubst} < ${./mautrix-discord.yaml} > "$CONFIG_FILE" + chmod 755 "$CONFIG_FILE" - [ -e "$REGISTRATION_FILE" ] || \ - ${getExe mautrix-discord} -c "$CONFIG_FILE" -r "$REGISTRATION_FILE" -g - ${getExe mautrix-discord} -c "$CONFIG_FILE" -r "$REGISTRATION_FILE" -n - ''; + [ -e "$REGISTRATION_FILE" ] || \ + ${getExe mautrix-discord} -c "$CONFIG_FILE" -r "$REGISTRATION_FILE" -g + ${getExe mautrix-discord} -c "$CONFIG_FILE" -r "$REGISTRATION_FILE" -n + ''; }; }; }; diff --git a/nixng/containers/matrix/mautrix-discord/mautrix-discord.yaml b/nixng/containers/matrix/mautrix-discord/mautrix-discord.yaml index 5f3c523..fe6e518 100644 --- a/nixng/containers/matrix/mautrix-discord/mautrix-discord.yaml +++ b/nixng/containers/matrix/mautrix-discord/mautrix-discord.yaml @@ -41,7 +41,7 @@ appservice: # To connect via Unix socket, use something like postgres:///dbname?host=/var/run/postgresql uri: postgres://mautrix-discord:${MAUTRIX_DISCORD_APPSERVICE_DATABASE_PASSWORD}@127.0.0.1/mautrix-discord?sslmode=disable # Maximum number of connections. Mostly relevant for Postgres. - max_open_conns: 20 + max_open_conns: 10 max_idle_conns: 2 # Maximum connection idle time and lifetime before they're closed. Disabled if null. # Parsed with https://pkg.go.dev/time#ParseDuration diff --git a/nixng/containers/matrix/mautrix-signal/mautrix-signal.yaml b/nixng/containers/matrix/mautrix-signal/mautrix-signal.yaml index a41edda..b45836f 100644 --- a/nixng/containers/matrix/mautrix-signal/mautrix-signal.yaml +++ b/nixng/containers/matrix/mautrix-signal/mautrix-signal.yaml @@ -51,7 +51,7 @@ appservice: # For sqlite, min_size is used as the connection thread pool size and max_size is ignored. # Additionally, SQLite supports init_commands as an array of SQL queries to run on connect (e.g. to set PRAGMAs). database_opts: - min_size: 1 + min_size: 2 max_size: 10 # The unique ID of this appservice. diff --git a/nixng/containers/matrix/synapse/postgresql.nix b/nixng/containers/matrix/synapse/postgresql.nix index 5a36f4a..baccdf7 100644 --- a/nixng/containers/matrix/synapse/postgresql.nix +++ b/nixng/containers/matrix/synapse/postgresql.nix @@ -23,7 +23,7 @@ makeSystem { authentication = "host all all all md5"; config = { - max_connections = 50; + max_connections = 70; shared_buffers = "384MB"; effective_cache_size = "1152MB"; maintenance_work_mem = "96MB"; @@ -35,9 +35,9 @@ makeSystem { work_mem = "1966kB"; min_wal_size = "1GB"; max_wal_size = "4GB"; - max_worker_processes = 12; + max_worker_processes = 24; max_parallel_workers_per_gather = 4; - max_parallel_workers = 12; + max_parallel_workers = 24; max_parallel_maintenance_workers = 4; };