Add postgresCfg
This commit is contained in:
parent
2cd9bdc3ac
commit
82090bb120
|
@ -8,14 +8,14 @@ let
|
||||||
|
|
||||||
lemmyDockerImage = { hostname, lemmyDockerImage, lemmyUiDockerImage
|
lemmyDockerImage = { hostname, lemmyDockerImage, lemmyUiDockerImage
|
||||||
, nginxCfgFile, pictrsApiKey, pictrsDockerImage, port, postgresDockerImage
|
, nginxCfgFile, pictrsApiKey, pictrsDockerImage, port, postgresDockerImage
|
||||||
, postgresPasswd, smtpServer, stateDirectory, ... }:
|
, postgresCfg, postgresPasswd, smtpServer, stateDirectory, ... }:
|
||||||
let
|
let
|
||||||
lemmyCfgFile =
|
lemmyCfgFile =
|
||||||
lemmyCfg { inherit hostname postgresPasswd pictrsApiKey smtpServer; };
|
lemmyCfg { inherit hostname postgresPasswd pictrsApiKey smtpServer; };
|
||||||
lemmyDockerComposeCfgDir = lemmyDockerComposeCfg {
|
lemmyDockerComposeCfgDir = lemmyDockerComposeCfg {
|
||||||
inherit hostname port lemmyCfgFile nginxCfgFile pictrsApiKey
|
inherit hostname port lemmyCfgFile nginxCfgFile pictrsApiKey
|
||||||
stateDirectory postgresPasswd lemmyDockerImage lemmyUiDockerImage
|
stateDirectory postgresPasswd lemmyDockerImage lemmyUiDockerImage
|
||||||
pictrsDockerImage postgresDockerImage;
|
pictrsDockerImage postgresDockerImage postgresCfg;
|
||||||
};
|
};
|
||||||
in pkgs.stdenv.mkDerivation {
|
in pkgs.stdenv.mkDerivation {
|
||||||
name = "lemmy-docker-image";
|
name = "lemmy-docker-image";
|
||||||
|
@ -110,9 +110,43 @@ let
|
||||||
};
|
};
|
||||||
});
|
});
|
||||||
|
|
||||||
|
postgresCfg = pkgs.writeText "lemmy-postgres.conf" ''
|
||||||
|
# DB Version: 15
|
||||||
|
# OS Type: linux
|
||||||
|
# DB Type: web
|
||||||
|
# Total Memory (RAM): 8 GB
|
||||||
|
# CPUs num: 4
|
||||||
|
# Data Storage: ssd
|
||||||
|
|
||||||
|
max_connections = 200
|
||||||
|
shared_buffers = 2GB
|
||||||
|
effective_cache_size = 6GB
|
||||||
|
maintenance_work_mem = 512MB
|
||||||
|
checkpoint_completion_target = 0.9
|
||||||
|
checkpoint_timeout = 86400
|
||||||
|
wal_buffers = 16MB
|
||||||
|
default_statistics_target = 100
|
||||||
|
random_page_cost = 1.1
|
||||||
|
effective_io_concurrency = 200
|
||||||
|
work_mem = 5242kB
|
||||||
|
min_wal_size = 1GB
|
||||||
|
max_wal_size = 30GB
|
||||||
|
max_worker_processes = 4
|
||||||
|
max_parallel_workers_per_gather = 2
|
||||||
|
max_parallel_workers = 4
|
||||||
|
max_parallel_maintenance_workers = 2
|
||||||
|
|
||||||
|
# Other custom params
|
||||||
|
temp_file_size=1GB
|
||||||
|
synchronous_commit=off
|
||||||
|
# This one shouldn't be on regularly, because DB migrations often take a long time
|
||||||
|
# statement_timeout = 10000
|
||||||
|
'';
|
||||||
|
|
||||||
lemmyDockerComposeCfg = { hostname, port, lemmyCfgFile, nginxCfgFile
|
lemmyDockerComposeCfg = { hostname, port, lemmyCfgFile, nginxCfgFile
|
||||||
, pictrsApiKey, stateDirectory, postgresPasswd, lemmyDockerImage
|
, pictrsApiKey, stateDirectory, postgresPasswd, lemmyDockerImage
|
||||||
, lemmyUiDockerImage, pictrsDockerImage, postgresDockerImage, ... }:
|
, lemmyUiDockerImage, pictrsDockerImage, postgresCfg, postgresDockerImage
|
||||||
|
, ... }:
|
||||||
let
|
let
|
||||||
defaultLogging = {
|
defaultLogging = {
|
||||||
driver = "json-file";
|
driver = "json-file";
|
||||||
|
@ -258,7 +292,7 @@ in {
|
||||||
postgresDockerImage = cfg.docker-images.postgres;
|
postgresDockerImage = cfg.docker-images.postgres;
|
||||||
stateDirectory = cfg.state-directory;
|
stateDirectory = cfg.state-directory;
|
||||||
smtpServer = cfg.smtp-server;
|
smtpServer = cfg.smtp-server;
|
||||||
inherit postgresPasswd pictrsApiKey nginxCfgFile;
|
inherit postgresPasswd pictrsApiKey nginxCfgFile postgresCfg;
|
||||||
};
|
};
|
||||||
in "${image}";
|
in "${image}";
|
||||||
autoStart = true;
|
autoStart = true;
|
||||||
|
|
Loading…
Reference in New Issue