diff --git a/functions b/functions index f842f63038..bc2d26b496 100644 --- a/functions +++ b/functions @@ -720,6 +720,22 @@ function enable_kernel_bridge_firewall { } +# Set a systemd system override +# +# This sets a system-side override in system.conf. A per-service +# override would be /etc/systemd/system/${service}.service/override.conf +function set_systemd_override { + local key="$1" + local value="$2" + + local sysconf="/etc/systemd/system.conf" + iniset -sudo "${sysconf}" "Manager" "$key" "$value" + echo "Set systemd system override for ${key}=${value}" + + sudo systemctl daemon-reload +} + + # Restore xtrace $_XTRACE_FUNCTIONS diff --git a/stack.sh b/stack.sh index d6837ef5d0..e83eaea326 100755 --- a/stack.sh +++ b/stack.sh @@ -765,6 +765,9 @@ install_infra # Phase: pre-install run_phase stack pre-install +# NOTE(danms): Set global limits before installing anything +set_systemd_override DefaultLimitNOFILE ${ULIMIT_NOFILE} + install_rpc_backend restart_rpc_backend diff --git a/stackrc b/stackrc index 35856ca73e..ea1bcdf3f0 100644 --- a/stackrc +++ b/stackrc @@ -925,6 +925,9 @@ fi # ``LOGDIR`` is always set at this point so it is not useful as a 'enable' for service logs # ``SCREEN_LOGDIR`` may be set, it is useful to enable the compat symlinks +# System-wide ulimit file descriptors override +ULIMIT_NOFILE=${ULIMIT_NOFILE:-2048} + # Local variables: # mode: shell-script # End: