28
|
1 |
class apache::mod::passenger ( |
|
2 |
$passenger_conf_file = $::apache::params::passenger_conf_file, |
|
3 |
$passenger_conf_package_file = $::apache::params::passenger_conf_package_file, |
|
4 |
$passenger_high_performance = undef, |
|
5 |
$passenger_pool_idle_time = undef, |
|
6 |
$passenger_max_requests = undef, |
|
7 |
$passenger_spawn_method = undef, |
|
8 |
$passenger_stat_throttle_rate = undef, |
|
9 |
$rack_autodetect = undef, |
|
10 |
$rails_autodetect = undef, |
|
11 |
$passenger_root = $::apache::params::passenger_root, |
|
12 |
$passenger_ruby = $::apache::params::passenger_ruby, |
|
13 |
$passenger_default_ruby = $::apache::params::passenger_default_ruby, |
|
14 |
$passenger_max_pool_size = undef, |
|
15 |
$passenger_min_instances = undef, |
|
16 |
$passenger_use_global_queue = undef, |
|
17 |
$passenger_app_env = undef, |
|
18 |
$mod_package = undef, |
|
19 |
$mod_package_ensure = undef, |
|
20 |
$mod_lib = undef, |
|
21 |
$mod_lib_path = undef, |
|
22 |
$mod_id = undef, |
|
23 |
$mod_path = undef, |
|
24 |
) { |
|
25 |
|
|
26 |
if $passenger_spawn_method { |
|
27 |
validate_re($passenger_spawn_method, '(^smart$|^direct$|^smart-lv2$|^conservative$)', "${passenger_spawn_method} is not permitted for passenger_spawn_method. Allowed values are 'smart', 'direct', 'smart-lv2', or 'conservative'.") |
|
28 |
} |
|
29 |
|
|
30 |
# Managed by the package, but declare it to avoid purging |
|
31 |
if $passenger_conf_package_file { |
|
32 |
file { 'passenger_package.conf': |
|
33 |
path => "${::apache::mod_dir}/${passenger_conf_package_file}", |
|
34 |
} |
|
35 |
} |
|
36 |
|
|
37 |
$_package = $mod_package |
|
38 |
$_package_ensure = $mod_package_ensure |
|
39 |
$_lib = $mod_lib |
|
40 |
if $::osfamily == 'FreeBSD' { |
|
41 |
if $mod_lib_path { |
|
42 |
$_lib_path = $mod_lib_path |
|
43 |
} else { |
|
44 |
$_lib_path = "${passenger_root}/buildout/apache2" |
|
45 |
} |
|
46 |
} else { |
|
47 |
$_lib_path = $mod_lib_path |
|
48 |
} |
|
49 |
|
|
50 |
$_id = $mod_id |
|
51 |
$_path = $mod_path |
|
52 |
::apache::mod { 'passenger': |
|
53 |
package => $_package, |
|
54 |
package_ensure => $_package_ensure, |
|
55 |
lib => $_lib, |
|
56 |
lib_path => $_lib_path, |
|
57 |
id => $_id, |
|
58 |
path => $_path, |
|
59 |
loadfile_name => 'zpassenger.load', |
|
60 |
} |
|
61 |
|
|
62 |
# Template uses: |
|
63 |
# - $passenger_root |
|
64 |
# - $passenger_ruby |
|
65 |
# - $passenger_default_ruby |
|
66 |
# - $passenger_max_pool_size |
|
67 |
# - $passenger_min_instances |
|
68 |
# - $passenger_high_performance |
|
69 |
# - $passenger_max_requests |
|
70 |
# - $passenger_spawn_method |
|
71 |
# - $passenger_stat_throttle_rate |
|
72 |
# - $passenger_use_global_queue |
|
73 |
# - $passenger_app_env |
|
74 |
# - $rack_autodetect |
|
75 |
# - $rails_autodetect |
|
76 |
file { 'passenger.conf': |
|
77 |
ensure => file, |
|
78 |
path => "${::apache::mod_dir}/${passenger_conf_file}", |
|
79 |
content => template('apache/mod/passenger.conf.erb'), |
|
80 |
require => Exec["mkdir ${::apache::mod_dir}"], |
|
81 |
before => File[$::apache::mod_dir], |
|
82 |
notify => Class['apache::service'], |
|
83 |
} |
|
84 |
} |