Showing with 44 additions and 4 deletions.
  1. +10 −0 CHANGELOG.md
  2. +8 −0 manifests/init.pp
  3. +1 −1 metadata.json
  4. +19 −1 spec/classes/pulpcore_spec.rb
  5. +4 −1 templates/pulpcore-api.service.erb
  6. +2 −1 templates/pulpcore-content.service.erb
10 changes: 10 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,15 @@
# Changelog

## [8.1.0](https://github.com/theforeman/puppet-pulpcore/tree/8.1.0) (2023-05-26)

[Full Changelog](https://github.com/theforeman/puppet-pulpcore/compare/8.0.0...8.1.0)

**Implemented enhancements:**

- Fixes [\#36438](https://projects.theforeman.org/issues/36438) - configure API request limit to avoid memory leaks [\#289](https://github.com/theforeman/puppet-pulpcore/pull/289) ([evgeni](https://github.com/evgeni))
- Fixes [\#36437](https://projects.theforeman.org/issues/36437) - preload pulpcore API and content code [\#288](https://github.com/theforeman/puppet-pulpcore/pull/288) ([evgeni](https://github.com/evgeni))
- use `--workers` instead of `-w` when configuring gunicorn workers [\#287](https://github.com/theforeman/puppet-pulpcore/pull/287) ([evgeni](https://github.com/evgeni))

## [8.0.0](https://github.com/theforeman/puppet-pulpcore/tree/8.0.0) (2023-05-15)

[Full Changelog](https://github.com/theforeman/puppet-pulpcore/compare/7.2.0...8.0.0)
Expand Down
8 changes: 8 additions & 0 deletions manifests/init.pp
Original file line number Diff line number Diff line change
Expand Up @@ -162,6 +162,12 @@
# @param api_service_worker_timeout
# Timeout in seconds of the pulpcore-api gunicorn workers.
#
# @param api_service_worker_max_requests
# Number of requests a gunicorn worker will process before restarting.
#
# @param api_service_worker_max_requests_jitter
# Jitter to add to the max_requests setting of the gunicorn worker.
#
# @param api_client_auth_cn_map
# Mapping of certificate common name and Pulp user to authenticate to Pulp API.
#
Expand Down Expand Up @@ -233,6 +239,8 @@
Integer[0] $api_service_worker_count = min(4, $facts['processors']['count']) + 1,
Integer[0] $content_service_worker_timeout = 90,
Integer[0] $api_service_worker_timeout = 90,
Integer[0] $api_service_worker_max_requests = 50,
Integer[0] $api_service_worker_max_requests_jitter = 30,
Hash[String[1], String[1]] $api_client_auth_cn_map = {},
Boolean $cache_enabled = false,
Optional[Variant[Integer[1], Enum['None']]] $cache_expires_ttl = undef,
Expand Down
2 changes: 1 addition & 1 deletion metadata.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "theforeman-pulpcore",
"version": "8.0.0",
"version": "8.1.0",
"author": "theforeman",
"summary": "Installs next generation Pulp server",
"license": "GPL-3.0-or-later",
Expand Down
20 changes: 19 additions & 1 deletion spec/classes/pulpcore_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,9 @@
is_expected.to contain_class('pulpcore::service')
is_expected.to contain_pulpcore__socket_service('pulpcore-api')
is_expected.to contain_systemd__unit_file('pulpcore-api.socket')
is_expected.to contain_systemd__unit_file('pulpcore-api.service').with_content(%r{-w 2})
is_expected.to contain_systemd__unit_file('pulpcore-api.service').with_content(%r{--workers 2})
.with_content(%r{--max-requests 50})
.with_content(%r{--max-requests-jitter 30})
is_expected.to contain_file('/etc/systemd/system/pulpcore-api.socket').that_comes_before('Service[pulpcore-api.service]')
is_expected.to contain_pulpcore__socket_service('pulpcore-content')
is_expected.to contain_systemd__unit_file('pulpcore-content.socket')
Expand All @@ -162,6 +164,22 @@
end
end

context 'with changed max-requests' do
let :params do
{
api_service_worker_max_requests: 100,
api_service_worker_max_requests_jitter: 10
}
end

it do
is_expected.to compile.with_all_deps
is_expected.to contain_systemd__unit_file('pulpcore-api.service')
.with_content(%r{--max-requests 100})
.with_content(%r{--max-requests-jitter 10})
end
end

context 'with allowed import paths' do
let :params do
{
Expand Down
5 changes: 4 additions & 1 deletion templates/pulpcore-api.service.erb
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,11 @@ Group=<%= scope['pulpcore::group'] %>
WorkingDirectory=<%= scope['pulpcore::user_home'] %>
RuntimeDirectory=pulpcore-api
ExecStart=/usr/libexec/pulpcore/gunicorn pulpcore.app.wsgi:application \
--preload \
--timeout <%= scope['pulpcore::api_service_worker_timeout'] %> \
-w <%= scope['pulpcore::api_service_worker_count'] %> \
--workers <%= scope['pulpcore::api_service_worker_count'] %> \
--max-requests <%= scope['pulpcore::api_service_worker_max_requests'] %> \
--max-requests-jitter <%= scope['pulpcore::api_service_worker_max_requests_jitter'] %> \
--access-logfile - \
--access-logformat 'pulp [%({correlation-id}o)s]: %(h)s %(l)s %(u)s %(t)s "%(r)s" %(s)s %(b)s "%(f)s" "%(a)s"'
ExecReload=/bin/kill -s HUP $MAINPID
Expand Down
3 changes: 2 additions & 1 deletion templates/pulpcore-content.service.erb
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,10 @@ Group=<%= scope['pulpcore::group'] %>
WorkingDirectory=<%= scope['pulpcore::user_home'] %>
RuntimeDirectory=pulpcore-content
ExecStart=/usr/libexec/pulpcore/gunicorn pulpcore.content:server \
--preload \
--timeout <%= scope['pulpcore::content_service_worker_timeout'] %> \
--worker-class 'aiohttp.GunicornWebWorker' \
-w <%= scope['pulpcore::content_service_worker_count'] %> \
--workers <%= scope['pulpcore::content_service_worker_count'] %> \
--access-logfile -
ExecReload=/bin/kill -s HUP $MAINPID
SyslogIdentifier=pulpcore-content
Expand Down