fix: postgres balancing / limit meilisearch memory usage
This commit is contained in:
@@ -19,6 +19,9 @@
|
||||
librechat = {
|
||||
file = ../../secrets/librechat.age;
|
||||
};
|
||||
meilisearch-env = {
|
||||
file = ../../secrets/meilisearch-env.age;
|
||||
};
|
||||
librechat-env = {
|
||||
file = ../../secrets/librechat-env.age;
|
||||
};
|
||||
@@ -80,10 +83,6 @@
|
||||
file = ../../secrets/snipe-it-mail-password.age;
|
||||
owner = "snipeit";
|
||||
};
|
||||
pgadmin-pw = {
|
||||
file = ../../secrets/pgadmin-pw.age;
|
||||
owner = "pgadmin";
|
||||
};
|
||||
pgbouncer-userlist = {
|
||||
file = ../../secrets/pgbouncer-userlist.age;
|
||||
owner = "pgbouncer";
|
||||
|
||||
@@ -9,6 +9,7 @@
|
||||
ragApiPort = config.m3ta.ports.get ragApiServiceName;
|
||||
envFileProd = config.age.secrets.librechat-env-prod.path;
|
||||
envFileCommon = config.age.secrets.librechat.path;
|
||||
envFileMeili = config.age.secrets.meilisearch-env.path;
|
||||
in {
|
||||
virtualisation.oci-containers = {
|
||||
containers.meilisearch = {
|
||||
@@ -19,8 +20,13 @@ in {
|
||||
MEILI_HTTP_ADDR = "0.0.0.0:7700";
|
||||
MEILI_NO_ANALYTICS = "true";
|
||||
};
|
||||
environmentFiles = [envFileCommon envFileProd];
|
||||
extraOptions = ["--ip=10.89.0.20" "--network=web"];
|
||||
environmentFiles = [envFileMeili];
|
||||
extraOptions = [
|
||||
"--ip=10.89.0.20"
|
||||
"--network=web"
|
||||
"--memory=2g"
|
||||
"--memory-swap=2g"
|
||||
];
|
||||
};
|
||||
|
||||
containers.rag_api = {
|
||||
|
||||
@@ -31,12 +31,7 @@
|
||||
POSTGRESQL_HOST = "10.89.0.1";
|
||||
POSTGRESQL_USER = "zammad_${instanceName}";
|
||||
POSTGRESQL_PORT = "6433";
|
||||
# pool=50 entspricht dem Zammad-Default (config/database/database.yml).
|
||||
# Der Scheduler startet mehrere BackgroundServices-Threads gleichzeitig
|
||||
# (ProcessSessions/Scheduled/Delayed/DelayedAI + Cleanup/fetch); pool=5
|
||||
# war zu klein -> ActiveRecord::ConnectionTimeoutError beim Start.
|
||||
# Wird durch PgBouncer-Session (default_pool_size=30) server-seitig gedeckelt.
|
||||
POSTGRESQL_OPTIONS = "?pool=50";
|
||||
POSTGRESQL_OPTIONS = "?pool=5";
|
||||
REDIS_URL = "redis://zammad-redis:6379";
|
||||
TZ = "Europe/Berlin";
|
||||
BACKUP_DIR = "/var/tmp/zammad";
|
||||
@@ -108,7 +103,11 @@ in {
|
||||
image = zammadImage;
|
||||
autoStart = true;
|
||||
cmd = ["zammad-railsserver"];
|
||||
environment = sharedEnvironment;
|
||||
environment =
|
||||
sharedEnvironment
|
||||
// {
|
||||
POSTGRESQL_OPTIONS = "?pool=8";
|
||||
};
|
||||
environmentFiles = [envFileCommon envFileProd];
|
||||
volumes = ["${serviceName}_storage:/opt/zammad/storage"];
|
||||
dependsOn = ["${serviceName}-memcached" "${serviceName}-redis" "${serviceName}-elasticsearch"];
|
||||
@@ -124,7 +123,11 @@ in {
|
||||
image = zammadImage;
|
||||
autoStart = true;
|
||||
cmd = ["zammad-scheduler"];
|
||||
environment = sharedEnvironment;
|
||||
environment =
|
||||
sharedEnvironment
|
||||
// {
|
||||
POSTGRESQL_OPTIONS = "?pool=18";
|
||||
};
|
||||
environmentFiles = [envFileCommon envFileProd];
|
||||
volumes = ["${serviceName}_storage:/opt/zammad/storage"];
|
||||
dependsOn = ["${serviceName}-memcached" "${serviceName}-redis"];
|
||||
@@ -139,7 +142,11 @@ in {
|
||||
image = zammadImage;
|
||||
autoStart = true;
|
||||
cmd = ["zammad-websocket"];
|
||||
environment = sharedEnvironment;
|
||||
environment =
|
||||
sharedEnvironment
|
||||
// {
|
||||
POSTGRESQL_OPTIONS = "?pool=3";
|
||||
};
|
||||
environmentFiles = [envFileCommon envFileProd];
|
||||
volumes = ["${serviceName}_storage:/opt/zammad/storage"];
|
||||
dependsOn = ["${serviceName}-memcached" "${serviceName}-redis"];
|
||||
@@ -239,7 +246,7 @@ in {
|
||||
--env POSTGRESQL_HOST=10.89.0.1 \
|
||||
--env POSTGRESQL_USER=zammad_${instanceName} \
|
||||
--env POSTGRESQL_PORT=6433 \
|
||||
--env POSTGRESQL_OPTIONS='?pool=50' \
|
||||
--env POSTGRESQL_OPTIONS='?pool=10' \
|
||||
--env REDIS_URL=redis://zammad-redis:6379 \
|
||||
--env TZ=Europe/Berlin \
|
||||
--env ELASTICSEARCH_ENABLED=true \
|
||||
|
||||
@@ -116,7 +116,7 @@ in {
|
||||
max_client_conn = 300
|
||||
default_pool_size = 30
|
||||
min_pool_size = 1
|
||||
query_wait_timeout = 30
|
||||
query_wait_timeout = 120
|
||||
|
||||
log_connections = 1
|
||||
log_disconnections = 1
|
||||
|
||||
@@ -1,11 +1,4 @@
|
||||
{
|
||||
config,
|
||||
pkgs,
|
||||
...
|
||||
}: let
|
||||
serviceName = "pgadmin";
|
||||
pgadminPort = config.m3ta.ports.get serviceName;
|
||||
in {
|
||||
{pkgs, ...}: {
|
||||
services.postgresql = {
|
||||
enable = true;
|
||||
enableTCPIP = true;
|
||||
@@ -161,31 +154,7 @@ in {
|
||||
services.postgresqlBackup = {
|
||||
enable = true;
|
||||
startAt = "03:10:00";
|
||||
databases = ["az_kpi_raw" "baserow" "kestra" "librechat_rag" "litellm" "metabase" "n8n" "outline" "vaultwarden" "zammad" "zammad_hr"];
|
||||
};
|
||||
services.pgadmin = {
|
||||
enable = true;
|
||||
initialPasswordFile = "${config.age.secrets.pgadmin-pw.path}";
|
||||
initialEmail = "sascha.koenig@azintec.com";
|
||||
};
|
||||
|
||||
# Traefik configuration specific to pgadmin
|
||||
services.traefik.dynamicConfigOptions.http = {
|
||||
services.pgadmin.loadBalancer.servers = [{url = "http://localhost:${toString pgadminPort}/";}];
|
||||
routers.pgadmin = {
|
||||
rule = "Host(`pg.az-gruppe.com`)";
|
||||
tls.certResolver = "ionos";
|
||||
service = "pgadmin";
|
||||
entrypoints = "websecure";
|
||||
middlewares = ["error-pages"];
|
||||
};
|
||||
};
|
||||
# Wartungsmodus: Selbstanmeldung des Dienstes (Q3).
|
||||
# Der pgAdmin-Router wohnt hier im Postgres-Modul, daher auch die
|
||||
# Wartungsmodus-Anmeldung von pg.
|
||||
m3ta.maintenance.services.pg = {
|
||||
domains = ["pg.az-gruppe.com"];
|
||||
desc = "pgAdmin (Datenbanken)";
|
||||
databases = ["az_kpi_raw" "baserow" "kestra" "librechat_rag" "litellm" "n8n" "outline" "vaultwarden" "zammad" "zammad_hr"];
|
||||
};
|
||||
|
||||
networking.firewall = {
|
||||
|
||||
@@ -52,6 +52,7 @@ in {
|
||||
"secrets/snipe-it-mail-password.age".publicKeys = systems ++ users;
|
||||
"secrets/pgbouncer-userlist.age".publicKeys = systems ++ users;
|
||||
"secrets/pgadmin-pw.age".publicKeys = systems ++ users;
|
||||
"secrets/meilisearch-env.age".publicKeys = systems ++ users;
|
||||
"secrets/phishboard-env.age".publicKeys = systems ++ users;
|
||||
"secrets/homarr-env.age".publicKeys = systems ++ users;
|
||||
"secrets/vaultwarden-env.age".publicKeys = systems ++ users;
|
||||
|
||||
Binary file not shown.
Reference in New Issue
Block a user