Skip to content

Commit

Permalink
Enable overriding mod-level parameters for apache::mod::passenger
Browse files Browse the repository at this point in the history
Apache::mod::passenger didn't accept/pass (optional) mod parameters
through to apache::mod, so only auto-generated module parameters were
used. Without this option, apache::mod::passenger could not be used in
conjunction with passenger modules beyond those generated by the OS
package system (in particular, modules compiled via
passenger-install-apache2-module, which uses differing paths). This
commit enables passing in all parameters used with "apache::mod",
documented in the passenger README file.

Modified default RedHat passenger parameters for cleaned-up
installation (prior parameters worked with Apache, but broke
passenger-* utilities, incl. passenger-status & passenger-root).

Updated spec/class tests to verify mod-level parameters; also,
updated RedHat tests to accomodate updated default parameters.

Added spec/acceptance tests for passenger, verifying default
installations for RedHat and Debian systems. RedHat installation test
installs (required) EPEL and http://passenger.stealthymonkeys.com
package repositories.
  • Loading branch information
jonoterc committed Mar 29, 2014
1 parent cbcefb1 commit d0883b9
Show file tree
Hide file tree
Showing 6 changed files with 331 additions and 31 deletions.
1 change: 1 addition & 0 deletions .gitignore
Expand Up @@ -4,4 +4,5 @@ vendor
spec/fixtures
.rspec_system
.bundle
.vagrant
.*sw*
62 changes: 52 additions & 10 deletions README.passenger.md
Expand Up @@ -2,7 +2,9 @@

Just enabling the Passenger module is insufficient for the use of Passenger in production. Passenger should be tunable to better fit the environment in which it is run while being aware of the resources it required.

To this end the Apache passenger module has been modified to apply system wide Passenger tuning declarations to `passenger.conf`. Declarations specific to a virtual host should be passed through when defining a `vhost` (e.g. `rack_base_uris' parameter on the `apache::vhost` class, check `README.md`).
To this end the Apache passenger module has been modified to apply system wide Passenger tuning declarations to `passenger.conf`. Declarations specific to a virtual host should be passed through when defining a `vhost` (e.g. `rack_base_uris` parameter on the `apache::vhost` class, check `README.md`).

Also, general apache module loading parameters can be supplied to enable using a customized passenger module in place of a default-package-based version of the module.

# Parameters for `apache::mod::passenger`

Expand All @@ -12,59 +14,99 @@ The following declarations are supported and can be passed to `apache::mod::pass
class {'apache::mod::passenger':
passenger_high_performance => 'on',
rails_autodetect => 'off',
mod_lib_path => '/usr/lib/apache2/custom_modules',
}
```

The general form is using the all lower case version of the declaration.

If you pass a default value to `apache::mod::passenger` it will be ignored and not passed through to the configuration file.
## Parameters used with passenger.conf

If you pass a default value to `apache::mod::passenger` it will be ignored and not passed through to the configuration file.

## passenger_high_performance
### passenger_high_performance

Default is `off`, when turned `on` Passenger runs in a higher performance mode that can be less compatible with other Apache modules.

http://www.modrails.com/documentation/Users%20guide%20Apache.html#PassengerHighPerformance

## passenger_max_pool_size
### passenger_max_pool_size

Set's the maximum number of Passenger application processes that may simultaneously run. The default value is 6.

http://www.modrails.com/documentation/Users%20guide%20Apache.html#_passengermaxpoolsize_lt_integer_gt

## passenger_pool_idle_time
### passenger_pool_idle_time

The maximum number of seconds a Passenger Application process will be allowed to remain idle before being shut down. The default value is 300.

http://www.modrails.com/documentation/Users%20guide%20Apache.html#PassengerPoolIdleTime

## passenger_max_requests
### passenger_max_requests

The maximum number of request a Passenger application will process before being restarted. The default value is 0, which indicates that a process will only shut down if the Pool Idle Time (see above) expires.

http://www.modrails.com/documentation/Users%20guide%20Apache.html#PassengerMaxRequests

## passenger_stat_throttle_rate
### passenger_stat_throttle_rate

Sets how often Passenger performs file system checks, at most once every _x_ seconds. Default is 0, which means the checks are performed with every request.

http://www.modrails.com/documentation/Users%20guide%20Apache.html#_passengerstatthrottlerate_lt_integer_gt

## rack_autodetect
### rack_autodetect

Should Passenger automatically detect if the document root of a virtual host is a Rack application. The default is `on`

http://www.modrails.com/documentation/Users%20guide%20Apache.html#_rackautodetect_lt_on_off_gt

## rails_autodetect
### rails_autodetect

Should Passenger automatically detect if the document root of a virtual host is a Rails application. The default is on.

http://www.modrails.com/documentation/Users%20guide%20Apache.html#_railsautodetect_lt_on_off_gt

## passenger_use_global_queue
### passenger_use_global_queue

Allows toggling of PassengerUseGlobalQueue. NOTE: PassengerUseGlobalQueue is the default in Passenger 4.x and the versions >= 4.x have disabled this configuration option altogether. Use with caution.

## Parameters used to load the module

Unlike the tuning parameters specified above, the following parameters are only used when loading customized passenger modules.

### mod_package

Allows overriding the default package name used for the passenger module package.

### mod_package_ensure

Allows overriding the package installation setting used by puppet when installing the passenger module. The default is 'present'.

### mod_id

Allows overriding the value used by apache to identify the passenger module. The default is 'passenger_module'.

### mod_lib_path

Allows overriding the directory path used by apache when loading the passenger module. The default is the value of `$apache::params::lib_path`.

### mod_lib

Allows overriding the library file name used by apache when loading the passenger module. The default is 'mod_passenger.so'.

### mod_path

Allows overriding the full path to the library file used by apache when loading the passenger module. The default is the concatenation of the `mod_lib_path` and `mod_lib` parameters.

# Dependencies

RedHat-based systems will need to configure additional package repositories in order to install Passenger, specifically:

* [Extra Packages for Enterprise Linux](https://fedoraproject.org/wiki/EPEL)
* [Phusion Passenger](http://passenger.stealthymonkeys.com)

Configuration of these repositories is beyond the scope of this module and is left to the user.

# Attribution

The Passenger tuning parameters for the `apache::mod::puppet` Puppet class was modified by Aaron Hicks (hicksa@landcareresearch.co.nz) for work on the NeSI Project and the Tuakiri New Zealand Access Federation as a fork from the PuppetLabs Apache module on GitHub.
Expand Down
38 changes: 30 additions & 8 deletions manifests/mod/passenger.pp
Expand Up @@ -11,22 +11,44 @@
$passenger_ruby = $::apache::params::passenger_ruby,
$passenger_max_pool_size = undef,
$passenger_use_global_queue = undef,
$mod_package = undef,
$mod_package_ensure = undef,
$mod_lib = undef,
$mod_lib_path = undef,
$mod_id = undef,
$mod_path = undef,
) {
if $::osfamily == 'FreeBSD' {
::apache::mod { 'passenger':
lib_path => "${passenger_root}/buildout/apache2"
}
} else {
::apache::mod { 'passenger': }
}

# Managed by the package, but declare it to avoid purging
if $passenger_conf_package_file {
file { 'passenger_package.conf':
path => "${::apache::mod_dir}/${passenger_conf_package_file}",
}
}

$_package = $mod_package
$_package_ensure = $mod_package_ensure
$_lib = $mod_lib
if $::osfamily == 'FreeBSD' {
if $mod_lib_path {
$_lib_path = $mod_lib_path
} else {
$_lib_path = "${passenger_root}/buildout/apache2"
}
} else {
$_lib_path = $mod_lib_path
}

$_id = $mod_id
$_path = $mod_path
::apache::mod { 'passenger':
package => $_package,
package_ensure => $_package_ensure,
lib => $_lib,
lib_path => $_lib_path,
id => $_id,
path => $_path,
}

# Template uses:
# - $passenger_root
# - $passenger_ruby
Expand Down
8 changes: 4 additions & 4 deletions manifests/params.pp
Expand Up @@ -49,10 +49,10 @@
$default_ssl_cert = '/etc/pki/tls/certs/localhost.crt'
$default_ssl_key = '/etc/pki/tls/private/localhost.key'
$ssl_certs_dir = '/etc/pki/tls/certs'
$passenger_conf_file = 'passenger_extra.conf'
$passenger_conf_package_file = 'passenger.conf'
$passenger_root = undef
$passenger_ruby = undef
$passenger_conf_file = 'passenger.conf'
$passenger_conf_package_file = undef
$passenger_root = '/usr/lib/ruby/gems/1.8/gems/passenger-3.0.19'
$passenger_ruby = '/usr/bin/ruby'
$suphp_addhandler = 'php5-script'
$suphp_engine = 'off'
$suphp_configpath = undef
Expand Down

0 comments on commit d0883b9

Please sign in to comment.