diff --git a/README.md b/README.md index d9e8a623..d73c8cba 100644 --- a/README.md +++ b/README.md @@ -45,6 +45,22 @@ This results into the following structure, using `tree -pug`: └── [drwxr-x--- pulp pulp ] tmp ($cache_dir) ``` +## Pulpcore settings + +The application will load settings from Django's defaults, Pulpcore's defaults, plus any overrides defined in the settings file at `${config_dir}/settings.py` (default: `/etc/pulp/settings.py`). The Django `diffsettings` tool is useful to check settings which are different from Django's defaults (i.e. all of the Pulpcore defaults which are not present in Django, plus any overrides defined in the settings file): + +```shell +PULP_SETTINGS=/etc/pulp/settings.py pulpcore-manager diffsettings +``` + +For example, to check the current value of a Pulpcore setting such as `WORKER_TTL`: + +```shell +PULP_SETTINGS=/etc/pulp/settings.py pulpcore-manager diffsettings | grep WORKER_TTL +``` + +This is useful for module parameter which configure Pulpcore settings but have an `undef` default, such as `$worker_ttl`. When the param value is `undef`, the setting is omitted from `settings.py` and therefore Pulpcore's default is used. + ## Service setup The module deploys a few systemd services: diff --git a/manifests/init.pp b/manifests/init.pp index 8efc11f9..1e00d76b 100644 --- a/manifests/init.pp +++ b/manifests/init.pp @@ -132,6 +132,13 @@ # available, likely results in performance degradation due to I/O blocking and is not recommended in most cases. Modifying this parameter should # be done incrementally with benchmarking at each step to determine an optimal value for your deployment. # +# @param worker_ttl +# Configure Pulpcore's WORKER_TTL setting. This is the number of seconds before a Pulpcore worker should be considered lost. +# If undefined, the setting will be omitted from the configuration file and Pulpcore will use its default value. +# To determine the current value in Pulpcore, see instructions about the diffsettings tool in this module's README. +# You should not need to modify this setting unless the application reports workers timing out while they are busy completing tasks. +# Modification should be performed incrementally to determine the least value that prevents false positive worker timeouts. +# # @param use_rq_tasking_system # Use the older RQ workers tasking system instead of the newer PostgreSQL tasking system introduced in Pulpcore 3.14. # Any benchmarking you did to optimize worker_count or other tasking related parameters will no longer be accurate after changing the tasking system. @@ -211,6 +218,7 @@ Pulpcore::ChecksumTypes $allowed_content_checksums = ['sha224', 'sha256', 'sha384', 'sha512'], String[1] $remote_user_environ_name = 'HTTP_REMOTE_USER', Integer[0] $worker_count = min(8, $facts['processors']['count']), + Optional[Integer[0]] $worker_ttl = undef, Boolean $use_rq_tasking_system = false, Boolean $service_enable = true, Boolean $service_ensure = true, diff --git a/spec/classes/pulpcore_spec.rb b/spec/classes/pulpcore_spec.rb index dfe3a8a6..1dc54f87 100644 --- a/spec/classes/pulpcore_spec.rb +++ b/spec/classes/pulpcore_spec.rb @@ -27,6 +27,7 @@ .with_content(%r{REDIS_URL = "redis://localhost:6379/8"}) .with_content(%r{CACHE_ENABLED = False}) .without_content(%r{sslmode}) + .without_content(%r{WORKER_TTL}) is_expected.to contain_file('/etc/pulp') is_expected.to contain_file('/var/lib/pulp') is_expected.to contain_file('/var/lib/pulp/sync_imports') @@ -513,6 +514,17 @@ .with_content(%r{\s'level': 'DEBUG',}) end end + + context 'with parameter worker_ttl = 60' do + let :params do + { worker_ttl: 60 } + end + + it 'configures pulpcore with setting WORKER_TTL = 60' do + is_expected.to contain_concat__fragment('base') + .with_content(%r{^WORKER_TTL = 60$}) + end + end end end end diff --git a/templates/settings.py.erb b/templates/settings.py.erb index db79d87e..3bc6969b 100644 --- a/templates/settings.py.erb +++ b/templates/settings.py.erb @@ -22,6 +22,9 @@ DATABASES = { REDIS_URL = "redis://localhost:<%= scope['redis::port'] %>/<%= scope['pulpcore::redis_db'] %>" USE_NEW_WORKER_TYPE = <%= scope['pulpcore::use_rq_tasking_system'] ? "False" : "True" %> +<% if scope['pulpcore::worker_ttl'] -%> +WORKER_TTL = <%= scope['pulpcore::worker_ttl'] %> +<% end -%> MEDIA_ROOT = "<%= scope['pulpcore::media_root'] %>" STATIC_ROOT = "<%= scope['pulpcore::static_root'] %>"