diff modules/apache/manifests/mod/passenger.pp @ 437:b8d6ada284dd

Update Apache module to latest version Also converted some params to ints to match
author IBBoard <dev@ibboard.co.uk>
date Sun, 14 Aug 2022 11:30:13 +0100
parents d9352a684e62
children adf6fe9bbc17
line wrap: on
line diff
--- a/modules/apache/manifests/mod/passenger.pp	Wed Apr 19 18:45:23 2023 +0100
+++ b/modules/apache/manifests/mod/passenger.pp	Sun Aug 14 11:30:13 2022 +0100
@@ -26,6 +26,9 @@
 # @param passenger_allow_encoded_slashes
 #   Toggle whether URLs with encoded slashes (%2f) can be used (by default Apache does not support this).
 #
+# @param passenger_anonymous_telemetry_proxy
+#   Set an intermediate proxy for the Passenger anonymous telemetry reporting.
+#
 # @param passenger_app_env
 #   This option sets, for the current application, the value of the following environment variables:
 #   - RAILS_ENV
@@ -80,6 +83,12 @@
 # @param passenger_default_user
 #   Allows you to specify the user that applications must run as, if user switching fails or is disabled.
 #
+# @param passenger_disable_anonymous_telemetry
+#   Whether or not to disable the Passenger anonymous telemetry reporting.
+#
+# @param passenger_disable_log_prefix
+#   Whether to stop Passenger from prefixing logs when they are written to a log file.
+#
 # @param passenger_disable_security_update_check
 #   Allows disabling the Passenger security update check, a daily check with https://securitycheck.phusionpassenger.com for important
 #   security updates that might be available.
@@ -120,6 +129,9 @@
 # @param passenger_load_shell_envvars
 #   Enables or disables the loading of shell environment variables before spawning the application.
 #
+# @param passenger_preload_bundler
+#   Enables or disables loading bundler before loading your Ruby app.
+#
 # @param passenger_log_file
 #   File path to log file. By default Passenger log messages are written to the Apache global error log.
 #
@@ -204,6 +216,9 @@
 # @param passenger_socket_backlog
 #   This option can be raised if Apache manages to overflow the backlog queue.
 #
+# @param passenger_spawn_dir
+#   The directory in which Passenger will record progress during startup
+#
 # @param passenger_spawn_method
 #   Controls whether Passenger spawns applications directly, or using a prefork copy-on-write mechanism.
 #
@@ -222,6 +237,9 @@
 # @param passenger_sticky_sessions_cookie_name
 #   Sets the name of the sticky sessions cookie.
 #
+# @param passenger_sticky_sessions_cookie_attributes
+#   Sets the attributes of the sticky sessions cookie.
+#
 # @param passenger_thread_count
 #   Specifies the number of threads that Passenger should spawn per Ruby application process.
 #
@@ -301,106 +319,117 @@
 #   - Around 08/20/2017 UnionStation was discontinued options were removed.
 #   - As of 08/20/2017 there are 77 available/deprecated/removed settings.
 #
-# @see https://www.phusionpassenger.com/library/config/apache/reference/ for additional documentation.
+# @see https://www.phusionpassenger.com/docs/references/config_reference/apache/ for additional documentation.
 #
 class apache::mod::passenger (
-  $manage_repo                                                                               = true,
-  $mod_id                                                                                    = undef,
-  $mod_lib                                                                                   = undef,
-  $mod_lib_path                                                                              = undef,
-  $mod_package                                                                               = undef,
-  $mod_package_ensure                                                                        = undef,
-  $mod_path                                                                                  = undef,
-  $passenger_allow_encoded_slashes                                                           = undef,
-  $passenger_app_env                                                                         = undef,
-  $passenger_app_group_name                                                                  = undef,
-  $passenger_app_root                                                                        = undef,
-  $passenger_app_type                                                                        = undef,
-  $passenger_base_uri                                                                        = undef,
-  $passenger_buffer_response                                                                 = undef,
-  $passenger_buffer_upload                                                                   = undef,
-  $passenger_concurrency_model                                                               = undef,
-  $passenger_conf_file                                                                       = $::apache::params::passenger_conf_file,
-  $passenger_conf_package_file                                                               = $::apache::params::passenger_conf_package_file,
-  $passenger_data_buffer_dir                                                                 = undef,
-  $passenger_debug_log_file                                                                  = undef,
-  $passenger_debugger                                                                        = undef,
-  $passenger_default_group                                                                   = undef,
-  $passenger_default_ruby                                                                    = $::apache::params::passenger_default_ruby,
-  $passenger_default_user                                                                    = undef,
-  $passenger_disable_security_update_check                                                   = undef,
-  $passenger_enabled                                                                         = undef,
-  $passenger_error_override                                                                  = undef,
-  $passenger_file_descriptor_log_file                                                        = undef,
-  $passenger_fly_with                                                                        = undef,
-  $passenger_force_max_concurrent_requests_per_process                                       = undef,
-  $passenger_friendly_error_pages                                                            = undef,
-  $passenger_group                                                                           = undef,
-  $passenger_high_performance                                                                = undef,
-  $passenger_installed_version                                                               = undef,
-  $passenger_instance_registry_dir                                                           = undef,
-  $passenger_load_shell_envvars                                                              = undef,
+  Boolean $manage_repo                                                                       = true,
+  Optional[String] $mod_id                                                                   = undef,
+  Optional[String] $mod_lib                                                                  = undef,
+  Optional[String] $mod_lib_path                                                             = undef,
+  Optional[String] $mod_package                                                              = undef,
+  Optional[String] $mod_package_ensure                                                       = undef,
+  Optional[String] $mod_path                                                                 = undef,
+  Optional[Enum['on', 'off', 'On', 'Off']] $passenger_allow_encoded_slashes                  = undef,
+  Optional[String] $passenger_anonymous_telemetry_proxy                                      = undef,
+  Optional[String] $passenger_app_env                                                        = undef,
+  Optional[String] $passenger_app_group_name                                                 = undef,
+  Optional[String] $passenger_app_root                                                       = undef,
+  Optional[String] $passenger_app_type                                                       = undef,
+  Optional[String] $passenger_base_uri                                                       = undef,
+  Optional[Enum['on', 'off', 'On', 'Off']] $passenger_buffer_response                        = undef,
+  Optional[Enum['on', 'off', 'On', 'Off']] $passenger_buffer_upload                          = undef,
+  Optional[String] $passenger_concurrency_model                                              = undef,
+  String $passenger_conf_file                                                                = $apache::params::passenger_conf_file,
+  Optional[String] $passenger_conf_package_file                                              = $apache::params::passenger_conf_package_file,
+  Optional[Stdlib::Absolutepath] $passenger_data_buffer_dir                                  = undef,
+  Optional[String] $passenger_debug_log_file                                                 = undef,
+  Optional[Enum['on', 'off', 'On', 'Off']] $passenger_debugger                               = undef,
+  Optional[String] $passenger_default_group                                                  = undef,
+  Optional[String] $passenger_default_ruby                                                   = $apache::params::passenger_default_ruby,
+  Optional[String] $passenger_default_user                                                   = undef,
+  Optional[Boolean] $passenger_disable_anonymous_telemetry                                   = undef,
+  Optional[Boolean] $passenger_disable_log_prefix                                            = undef,
+  Optional[Enum['on', 'off', 'On', 'Off']] $passenger_disable_security_update_check          = undef,
+  Optional[Enum['on', 'off', 'On', 'Off']] $passenger_enabled                                = undef,
+  Optional[Enum['on', 'off', 'On', 'Off']] $passenger_error_override                         = undef,
+  Optional[String] $passenger_file_descriptor_log_file                                       = undef,
+  Optional[String] $passenger_fly_with                                                       = undef,
+  Optional[Variant[Integer, String]] $passenger_force_max_concurrent_requests_per_process    = undef,
+  Optional[Enum['on', 'off', 'On', 'Off']] $passenger_friendly_error_pages                   = undef,
+  Optional[String] $passenger_group                                                          = undef,
+  Optional[Enum['on', 'off', 'On', 'Off']] $passenger_high_performance                       = undef,
+  Optional[String] $passenger_installed_version                                              = undef,
+  Optional[String] $passenger_instance_registry_dir                                          = undef,
+  Optional[Enum['on', 'off', 'On', 'Off']] $passenger_load_shell_envvars                     = undef,
+  Optional[Boolean] $passenger_preload_bundler                                               = undef,
   Optional[Stdlib::Absolutepath] $passenger_log_file                                         = undef,
-  $passenger_log_level                                                                       = undef,
-  $passenger_lve_min_uid                                                                     = undef,
-  $passenger_max_instances                                                                   = undef,
-  $passenger_max_instances_per_app                                                           = undef,
-  $passenger_max_pool_size                                                                   = undef,
-  $passenger_max_preloader_idle_time                                                         = undef,
-  $passenger_max_request_queue_size                                                          = undef,
-  $passenger_max_request_time                                                                = undef,
-  $passenger_max_requests                                                                    = undef,
-  $passenger_memory_limit                                                                    = undef,
-  $passenger_meteor_app_settings                                                             = undef,
-  $passenger_min_instances                                                                   = undef,
-  $passenger_nodejs                                                                          = undef,
-  $passenger_pool_idle_time                                                                  = undef,
-  Optional[Variant[String,Array[String]]] $passenger_pre_start                               = undef,
-  $passenger_python                                                                          = undef,
-  $passenger_resist_deployment_errors                                                        = undef,
-  $passenger_resolve_symlinks_in_document_root                                               = undef,
-  $passenger_response_buffer_high_watermark                                                  = undef,
-  $passenger_restart_dir                                                                     = undef,
-  $passenger_rolling_restarts                                                                = undef,
-  $passenger_root                                                                            = $::apache::params::passenger_root,
-  $passenger_ruby                                                                            = $::apache::params::passenger_ruby,
-  $passenger_security_update_check_proxy                                                     = undef,
-  $passenger_show_version_in_header                                                          = undef,
-  $passenger_socket_backlog                                                                  = undef,
+  Optional[Integer] $passenger_log_level                                                     = undef,
+  Optional[Integer] $passenger_lve_min_uid                                                   = undef,
+  Optional[Integer] $passenger_max_instances                                                 = undef,
+  Optional[Integer] $passenger_max_instances_per_app                                         = undef,
+  Optional[Integer] $passenger_max_pool_size                                                 = undef,
+  Optional[Integer] $passenger_max_preloader_idle_time                                       = undef,
+  Optional[Integer] $passenger_max_request_queue_size                                        = undef,
+  Optional[Integer] $passenger_max_request_time                                              = undef,
+  Optional[Integer] $passenger_max_requests                                                  = undef,
+  Optional[Integer] $passenger_memory_limit                                                  = undef,
+  Optional[String] $passenger_meteor_app_settings                                            = undef,
+  Optional[Integer] $passenger_min_instances                                                 = undef,
+  Optional[String] $passenger_nodejs                                                         = undef,
+  Optional[Integer] $passenger_pool_idle_time                                                = undef,
+  Optional[Variant[String, Array[String]]] $passenger_pre_start                              = undef,
+  Optional[String] $passenger_python                                                         = undef,
+  Optional[Enum['on', 'off', 'On', 'Off']] $passenger_resist_deployment_errors               = undef,
+  Optional[Enum['on', 'off', 'On', 'Off']] $passenger_resolve_symlinks_in_document_root      = undef,
+  Optional[Variant[Integer, String]] $passenger_response_buffer_high_watermark               = undef,
+  Optional[String] $passenger_restart_dir                                                    = undef,
+  Optional[Enum['on', 'off', 'On', 'Off']] $passenger_rolling_restarts                       = undef,
+  Optional[String] $passenger_root                                                           = $apache::params::passenger_root,
+  Optional[String] $passenger_ruby                                                           = $apache::params::passenger_ruby,
+  Optional[String] $passenger_security_update_check_proxy                                    = undef,
+  Optional[Enum['on', 'off', 'On', 'Off']] $passenger_show_version_in_header                 = undef,
+  Optional[Variant[Integer, String]] $passenger_socket_backlog                               = undef,
+  Optional[String] $passenger_spawn_dir                                                      = undef,
   Optional[Enum['smart', 'direct', 'smart-lv2', 'conservative']] $passenger_spawn_method     = undef,
-  $passenger_start_timeout                                                                   = undef,
-  $passenger_startup_file                                                                    = undef,
-  $passenger_stat_throttle_rate                                                              = undef,
-  $passenger_sticky_sessions                                                                 = undef,
-  $passenger_sticky_sessions_cookie_name                                                     = undef,
-  $passenger_thread_count                                                                    = undef,
-  $passenger_use_global_queue                                                                = undef,
-  $passenger_user                                                                            = undef,
-  $passenger_user_switching                                                                  = undef,
-  $rack_auto_detect                                                                          = undef,
-  $rack_autodetect                                                                           = undef,
-  $rack_base_uri                                                                             = undef,
-  $rack_env                                                                                  = undef,
-  $rails_allow_mod_rewrite                                                                   = undef,
-  $rails_app_spawner_idle_time                                                               = undef,
-  $rails_auto_detect                                                                         = undef,
-  $rails_autodetect                                                                          = undef,
-  $rails_base_uri                                                                            = undef,
-  $rails_default_user                                                                        = undef,
-  $rails_env                                                                                 = undef,
-  $rails_framework_spawner_idle_time                                                         = undef,
-  $rails_ruby                                                                                = undef,
-  $rails_spawn_method                                                                        = undef,
-  $rails_user_switching                                                                      = undef,
-  $wsgi_auto_detect                                                                          = undef,
-) inherits ::apache::params {
-  include ::apache
+  Optional[Integer] $passenger_start_timeout                                                 = undef,
+  Optional[String] $passenger_startup_file                                                   = undef,
+  Optional[Integer] $passenger_stat_throttle_rate                                            = undef,
+  Optional[Enum['on', 'off', 'On', 'Off']] $passenger_sticky_sessions                        = undef,
+  Optional[String] $passenger_sticky_sessions_cookie_name                                    = undef,
+  Optional[String] $passenger_sticky_sessions_cookie_attributes                              = undef,
+  Optional[Integer] $passenger_thread_count                                                  = undef,
+  Optional[String] $passenger_use_global_queue                                               = undef,
+  Optional[String] $passenger_user                                                           = undef,
+  Optional[Enum['on', 'off', 'On', 'Off']] $passenger_user_switching                         = undef,
+  Optional[String] $rack_auto_detect                                                         = undef,
+  Optional[String] $rack_autodetect                                                          = undef,
+  Optional[String] $rack_base_uri                                                            = undef,
+  Optional[String] $rack_env                                                                 = undef,
+  Optional[String] $rails_allow_mod_rewrite                                                  = undef,
+  Optional[String] $rails_app_spawner_idle_time                                              = undef,
+  Optional[String] $rails_auto_detect                                                        = undef,
+  Optional[String] $rails_autodetect                                                         = undef,
+  Optional[String] $rails_base_uri                                                           = undef,
+  Optional[String] $rails_default_user                                                       = undef,
+  Optional[String] $rails_env                                                                = undef,
+  Optional[String] $rails_framework_spawner_idle_time                                        = undef,
+  Optional[String] $rails_ruby                                                               = undef,
+  Optional[String] $rails_spawn_method                                                       = undef,
+  Optional[String] $rails_user_switching                                                     = undef,
+  Optional[String] $wsgi_auto_detect                                                         = undef,
+) inherits apache::params {
+  include apache
   if $passenger_installed_version {
     if $passenger_allow_encoded_slashes {
       if (versioncmp($passenger_installed_version, '4.0.0') < 0) {
         fail("Passenger config option :: passenger_allow_encoded_slashes is not introduced until version 4.0.0 :: ${passenger_installed_version} is the version reported")
       }
     }
+    if $passenger_anonymous_telemetry_proxy {
+      if (versioncmp($passenger_installed_version, '6.0.0') < 0) {
+        fail("Passenger config option :: passenger_anonymous_telemetry_proxy is not introduced until version 6.0.0 :: ${passenger_installed_version} is the version reported")
+      }
+    }
     if $passenger_app_env {
       if (versioncmp($passenger_installed_version, '4.0.0') < 0) {
         fail("Passenger config option :: passenger_app_env is not introduced until version 4.0.0 :: ${passenger_installed_version} is the version reported")
@@ -471,6 +500,16 @@
         fail("Passenger config option :: passenger_default_user is not introduced until version 3.0.0 :: ${passenger_installed_version} is the version reported")
       }
     }
+    if $passenger_disable_anonymous_telemetry {
+      if (versioncmp($passenger_installed_version, '6.0.0') < 0) {
+        fail("Passenger config option :: passenger_disable_anonymous_telemetry is not introduced until version 6.0.0 :: ${passenger_installed_version} is the version reported")
+      }
+    }
+    if $passenger_disable_log_prefix {
+      if (versioncmp($passenger_installed_version, '6.0.2') < 0) {
+        fail("Passenger config option :: passenger_disable_log_prefix is not introduced until version 6.0.2 :: ${passenger_installed_version} is the version reported")
+      }
+    }
     if $passenger_disable_security_update_check {
       if (versioncmp($passenger_installed_version, '5.1.0') < 0) {
         fail("Passenger config option :: passenger_disable_security_update_check is not introduced until version 5.1.0 :: ${passenger_installed_version} is the version reported")
@@ -526,6 +565,11 @@
         fail("Passenger config option :: passenger_load_shell_envvars is not introduced until version 4.0.20 :: ${passenger_installed_version} is the version reported")
       }
     }
+    if $passenger_preload_bundler {
+      if (versioncmp($passenger_installed_version, '6.0.13') < 0) {
+        fail("Passenger config option :: passenger_preload_bundler is not introduced until version 6.0.13 :: ${passenger_installed_version} is the version reported")
+      }
+    }
     if $passenger_log_file {
       if (versioncmp($passenger_installed_version, '5.0.5') < 0) {
         fail("Passenger config option :: passenger_log_file is not introduced until version 5.0.5 :: ${passenger_installed_version} is the version reported")
@@ -661,6 +705,11 @@
         fail("Passenger config option :: passenger_socket_backlog is not introduced until version 5.0.24 :: ${passenger_installed_version} is the version reported")
       }
     }
+    if $passenger_spawn_dir {
+      if (versioncmp($passenger_installed_version, '6.0.3') < 0) {
+        fail("Passenger config option :: passenger_spawn_dir is not introduced until version 6.0.3 :: ${passenger_installed_version} is the version reported")
+      }
+    }
     if $passenger_spawn_method {
       if (versioncmp($passenger_installed_version, '2.0.0') < 0) {
         fail("Passenger config option :: passenger_spawn_method is not introduced until version 2.0.0 :: ${passenger_installed_version} is the version reported")
@@ -691,6 +740,11 @@
         fail("Passenger config option :: passenger_sticky_sessions_cookie_name is not introduced until version 4.0.45 :: ${passenger_installed_version} is the version reported")
       }
     }
+    if $passenger_sticky_sessions_cookie_attributes {
+      if (versioncmp($passenger_installed_version, '6.0.5') < 0) {
+        fail("Passenger config option :: passenger_sticky_sessions_cookie_attributes is not introduced until version 6.0.5 :: ${passenger_installed_version} is the version reported")
+      }
+    }
     if $passenger_thread_count {
       if (versioncmp($passenger_installed_version, '4.0.0') < 0) {
         fail("Passenger config option :: passenger_thread_count is not introduced until version 4.0.0 :: ${passenger_installed_version} is the version reported")
@@ -788,14 +842,14 @@
   # Managed by the package, but declare it to avoid purging
   if $passenger_conf_package_file {
     file { 'passenger_package.conf':
-      path => "${::apache::confd_dir}/${passenger_conf_package_file}",
+      path => "${apache::confd_dir}/${passenger_conf_package_file}",
     }
   }
 
   $_package = $mod_package
   $_package_ensure = $mod_package_ensure
   $_lib = $mod_lib
-  if $::osfamily == 'FreeBSD' {
+  if $facts['os']['family'] == 'FreeBSD' {
     if $mod_lib_path {
       $_lib_path = $mod_lib_path
     } else {
@@ -805,9 +859,13 @@
     $_lib_path = $mod_lib_path
   }
 
-  if $::osfamily == 'RedHat' and $manage_repo {
-    if $::operatingsystem == 'Amazon' {
-      $baseurl = 'https://oss-binaries.phusionpassenger.com/yum/passenger/el/6Server/$basearch'
+  if $facts['os']['family'] == 'RedHat' and $manage_repo {
+    if $facts['os']['name'] == 'Amazon' {
+      if $facts['os']['release']['major'] == '2' {
+        $baseurl = 'https://oss-binaries.phusionpassenger.com/yum/passenger/el/7/$basearch'
+      } else {
+        $baseurl = 'https://oss-binaries.phusionpassenger.com/yum/passenger/el/6/$basearch'
+      }
     } else {
       $baseurl = 'https://oss-binaries.phusionpassenger.com/yum/passenger/el/$releasever/$basearch'
     }
@@ -818,7 +876,7 @@
       descr         => 'passenger',
       enabled       => '1',
       gpgcheck      => '0',
-      gpgkey        => 'https://packagecloud.io/phusion/passenger/gpgkey',
+      gpgkey        => 'https://oss-binaries.phusionpassenger.com/auto-software-signing-gpg-key.txt',
       repo_gpgcheck => '1',
       sslcacert     => '/etc/pki/tls/certs/ca-bundle.crt',
       sslverify     => '1',
@@ -826,7 +884,7 @@
     }
   }
 
-  unless ($::operatingsystem == 'SLES') {
+  unless ($facts['os']['name'] == 'SLES') {
     $_id = $mod_id
     $_path = $mod_path
     ::apache::mod { 'passenger':
@@ -867,6 +925,7 @@
   # - $passenger_high_performance : since 2.0.0.
   # - $passenger_instance_registry_dir : since 5.0.0.
   # - $passenger_load_shell_envvars : since 4.0.20.
+  # - $passenger_preload_bundler : since 6.0.13
   # - $passenger_log_file : since 5.0.5.
   # - $passenger_log_level : since 3.0.0.
   # - $passenger_lve_min_uid : since 5.0.28.
@@ -922,10 +981,10 @@
   # - $rack_autodetect : this options is only for backward compatiblity with older versions of this class
   file { 'passenger.conf':
     ensure  => file,
-    path    => "${::apache::mod_dir}/${passenger_conf_file}",
+    path    => "${apache::mod_dir}/${passenger_conf_file}",
     content => template('apache/mod/passenger.conf.erb'),
-    require => Exec["mkdir ${::apache::mod_dir}"],
-    before  => File[$::apache::mod_dir],
+    require => Exec["mkdir ${apache::mod_dir}"],
+    before  => File[$apache::mod_dir],
     notify  => Class['apache::service'],
   }
 }