diff --git a/.gitignore b/.gitignore index 2803e56..e81ac17 100644 --- a/.gitignore +++ b/.gitignore @@ -33,3 +33,4 @@ .plan_cache.json .rerun.json bolt-debug.log +/.vscode/ diff --git a/.vscode/extensions.json b/.vscode/extensions.json deleted file mode 100644 index 6da8d47..0000000 --- a/.vscode/extensions.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "recommendations": [ - "puppet.puppet-vscode", - "Shopify.ruby-lsp" - ] -} diff --git a/REFERENCE.md b/REFERENCE.md index c9c0c8c..c00a81a 100644 --- a/REFERENCE.md +++ b/REFERENCE.md @@ -19,6 +19,7 @@ ### Defined types * [`prosa::proc`](#prosa--proc): Allows specialised configurations for ProSA processors +Use the `prosa::processors` defined type if you want to create processors ### Data types @@ -86,6 +87,7 @@ The following parameters are available in the `prosa` class: * [`service_enable`](#-prosa--service_enable) * [`service_manage`](#-prosa--service_manage) * [`service_ensure`](#-prosa--service_ensure) +* [`service_limit_nofile`](#-prosa--service_limit_nofile) * [`manage_user`](#-prosa--manage_user) * [`manage_group`](#-prosa--manage_group) * [`user`](#-prosa--user) @@ -172,6 +174,16 @@ application.
Default value: `'running'` +##### `service_limit_nofile` + +Data type: `Optional[Integer]` + +Sets the limit on the number of open file descriptors for the ProSA service.
+This parameter corresponds to the `LimitNOFILE` directive in the systemd service unit file.
+Apply the default system limit when set to `undef`. + +Default value: `undef` + ##### `manage_user` Data type: `Boolean` @@ -226,7 +238,7 @@ Default value: `$prosa::params::telemetry_level` Data type: `Optional[Hash[String, String]]` Configures the ProSA [Telemetry Attributes](https://docs.rs/prosa-utils/latest/prosa_utils/config/observability/struct.Observability.html) directive -which allows to add custom attributes to telemetry messages. +which allows to add custom attributes to telemetry messages.
Refer to the [ProSA book](https://worldline.github.io/ProSA/ch01-02-01-observability.html) for more details on how to configure this directive. Default value: `undef` @@ -236,7 +248,7 @@ Default value: `undef` Data type: `Hash[String, Hash[String, Hash[String, String]]]` Configures the ProSA [Observability](https://docs.rs/prosa-utils/latest/prosa_utils/config/observability/struct.Observability.html) directive -which configure metrics, traces and logs export. +which configure metrics, traces and logs export.
Refer to the [ProSA book](https://worldline.github.io/ProSA/ch01-02-01-observability.html) for more details on how to configure this directive. Default value: `$prosa::params::observability` @@ -284,17 +296,7 @@ Default value: `{}` ### `prosa::proc` Allows specialised configurations for ProSA processors - -#### Examples - -##### - -```puppet -class { 'prosa': - default_vhost => false, - default_ssl_vhost => false, -} -``` +Use the `prosa::processors` defined type if you want to create processors #### Parameters diff --git a/manifests/init.pp b/manifests/init.pp index dccf5f0..49db564 100644 --- a/manifests/init.pp +++ b/manifests/init.pp @@ -39,6 +39,11 @@ # to `false`, which is useful when you want to let the service be managed by another # application.
# +# @param service_limit_nofile +# Sets the limit on the number of open file descriptors for the ProSA service.
+# This parameter corresponds to the `LimitNOFILE` directive in the systemd service unit file.
+# Apply the default system limit when set to `undef`. +# # @param manage_user # When `false`, stops Puppet from creating the user resource.
# This is for instances when you have a user, created from another Puppet module, you want @@ -65,7 +70,7 @@ # # @param telemetry_attributes # Configures the ProSA [Telemetry Attributes](https://docs.rs/prosa-utils/latest/prosa_utils/config/observability/struct.Observability.html) directive -# which allows to add custom attributes to telemetry messages. +# which allows to add custom attributes to telemetry messages.
# Refer to the [ProSA book](https://worldline.github.io/ProSA/ch01-02-01-observability.html) for more details on how to configure this directive. # # @example Setting custom telemetry attributes @@ -78,7 +83,7 @@ # # @param observability # Configures the ProSA [Observability](https://docs.rs/prosa-utils/latest/prosa_utils/config/observability/struct.Observability.html) directive -# which configure metrics, traces and logs export. +# which configure metrics, traces and logs export.
# Refer to the [ProSA book](https://worldline.github.io/ProSA/ch01-02-01-observability.html) for more details on how to configure this directive. # # @example Setting custom observability configuration @@ -112,6 +117,7 @@ Boolean $service_enable = true, Boolean $service_manage = true, Variant[Stdlib::Ensure::Service, Boolean] $service_ensure = 'running', + Optional[Integer] $service_limit_nofile = undef, Boolean $manage_user = true, Boolean $manage_group = true, String $user = $prosa::params::user, @@ -172,14 +178,15 @@ # Declare ProSA service class { 'prosa::service': - prosa_name => $prosa_name, - service_name => $service_name, - service_binary => $bin_path, - app_conf => $conf_dir, - user => $user, - group => $group, - service_enable => $service_enable, - service_ensure => $service_ensure, - service_manage => $service_manage, + prosa_name => $prosa_name, + service_name => $service_name, + service_binary => $bin_path, + app_conf => $conf_dir, + user => $user, + group => $group, + service_enable => $service_enable, + service_ensure => $service_ensure, + service_manage => $service_manage, + service_limit_nofile => $service_limit_nofile, } } diff --git a/manifests/proc.pp b/manifests/proc.pp index 7849aaf..ca47005 100644 --- a/manifests/proc.pp +++ b/manifests/proc.pp @@ -1,11 +1,6 @@ # @summary # Allows specialised configurations for ProSA processors -# -# @example -# class { 'prosa': -# default_vhost => false, -# default_ssl_vhost => false, -# } +# Use the `prosa::processors` defined type if you want to create processors # # @param adaptor_config_path # For some ProSA adaptor, they need to have a configuration in addition to processor. diff --git a/manifests/service.pp b/manifests/service.pp index b11a3d6..5eaca74 100644 --- a/manifests/service.pp +++ b/manifests/service.pp @@ -11,7 +11,8 @@ String $group = $prosa::params::group, Boolean $service_enable = true, Variant[Boolean, String] $service_ensure = 'running', - Boolean $service_manage = true + Boolean $service_manage = true, + Optional[Integer] $service_limit_nofile = undef ) { # The base class must be included first because parameter defaults depend on it if ! defined(Class['prosa::params']) { @@ -36,11 +37,12 @@ group => $prosa::params::root_group, mode => '0644', content => epp('prosa/service.epp', { - 'prosa_name' => $prosa_name, - 'user' => $user, - 'group' => $group, - 'bin_path' => $service_binary, - 'conf_path' => $app_conf, + 'prosa_name' => $prosa_name, + 'user' => $user, + 'group' => $group, + 'bin_path' => $service_binary, + 'conf_path' => $app_conf, + 'limit_nofile' => $service_limit_nofile, }), replace => true, } diff --git a/spec/acceptance/processors_spec.rb b/spec/acceptance/processors_spec.rb index 6207ebe..48cc088 100644 --- a/spec/acceptance/processors_spec.rb +++ b/spec/acceptance/processors_spec.rb @@ -16,14 +16,14 @@ pp = <<-MANIFEST class { 'prosa': - prosa_name => #{prosa_hash['prosa_name']}, - service_manage => false, - telemetry_level => 'warn', + prosa_name => #{prosa_hash['prosa_name']}, + service_manage => false, + telemetry_level => 'warn', telemetry_attributes => { 'service.name' => 'prosa-service', 'host.id' => 'fdbf79e8af94cb7f9e8df36789187052', }, - observability => { + observability => { 'metrics' => { 'prometheus' => { 'endpoint' => '0.0.0.0:9090', diff --git a/templates/service.epp b/templates/service.epp index 23ac199..b493661 100644 --- a/templates/service.epp +++ b/templates/service.epp @@ -3,6 +3,7 @@ String $group = 'prosa', Stdlib::Absolutepath $bin_path = '/usr/local/bin/prosa', Stdlib::Absolutepath $conf_path = '/etc/prosa', + Optional[Integer] $limit_nofile = undef, | -%> [Unit] Description=ProSA service for <%= $prosa_name %> @@ -14,6 +15,9 @@ Type=simple User=<%= $user %> Group=<%= $group %> ExecStart=<%= $bin_path %> -c <%= $conf_path %> +<% if $limit_nofile { -%> +LimitNOFILE=<%= $limit_nofile %> +<% } -%> [Install] WantedBy=multi-user.target