-
Notifications
You must be signed in to change notification settings - Fork 1.2k
/
passenger.rb
75 lines (66 loc) · 3.24 KB
/
passenger.rb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
###
# Do not use this file to override the passenger_apache2 cookbook's default
# attributes. Instead, please use the customize.rb attributes file,
# which will keep your adjustments separate from the AWS OpsWorks
# codebase and make it easier to upgrade.
#
# However, you should not edit customize.rb directly. Instead, create
# "passenger_apache2/attributes/customize.rb" in your cookbook repository and
# put the overrides in YOUR customize.rb file.
#
# Do NOT create an 'passenger_apache2/attributes/passenger.rb' in your cookbooks. Doing so
# would completely override this file and might cause upgrade issues.
#
# See also: http://docs.aws.amazon.com/opsworks/latest/userguide/customizing.html
###
require 'rubygems/version'
include_attribute 'opsworks_initial_setup::default'
include_attribute 'rails::rails'
include_attribute 'packages::packages'
case node[:opsworks][:ruby_version]
when /^1\.8/
default[:passenger][:gems_path] = '/usr/local/lib/ruby/gems/1.8/gems'
when /^1\.9/
default[:passenger][:gems_path] = '/usr/local/lib/ruby/gems/1.9.1/gems'
when /^2\.0/
default[:passenger][:gems_path] = '/usr/local/lib/ruby/gems/2.0.0/gems'
when /^2\.1/
default[:passenger][:gems_path] = '/usr/local/lib/ruby/gems/2.1.0/gems'
when /^2\.2/
default[:passenger][:gems_path] = '/usr/local/lib/ruby/gems/2.2.0/gems'
when /^2\.3/
default[:passenger][:gems_path] = '/usr/local/lib/ruby/gems/2.3.0/gems'
when /^2\.6/
default[:passenger][:gems_path] = '/usr/local/lib/ruby/gems/2.6.0/gems'
else
Chef::Log.warn "Unsupported Ruby version '#{node[:opsworks][:ruby_version]}'. Unable to set passenger gems_path."
default[:passenger][:gems_path] = '/'
end
default[:passenger][:version] = '4.0.46'
default[:passenger][:root_path] = "#{node[:passenger][:gems_path]}/passenger-#{passenger[:version]}"
if platform?('centos','redhat','fedora','amazon') and node[:packages][:dist_only]
default[:passenger][:module_path] = "#{node['apache']['libexecdir']}/mod_passenger.so"
else
if ::Gem::Version.new(node[:passenger][:version]) >= ::Gem::Version.new("4.0.7")
default[:passenger][:module_path] = "#{passenger[:root_path]}/buildout/apache2/mod_passenger.so"
elsif ::Gem::Version.new(node[:passenger][:version]) >= ::Gem::Version.new("3.9")
default[:passenger][:module_path] = "#{passenger[:root_path]}/libout/apache2/mod_passenger.so"
else
default[:passenger][:module_path] = "#{passenger[:root_path]}/ext/apache2/mod_passenger.so"
end
end
default[:passenger][:ruby_bin] = '/usr/local/bin/ruby'
default[:passenger][:ruby_wrapper_bin] = '/usr/local/bin/ruby_gc_wrapper.sh'
default[:passenger][:gem_bin] = '/usr/local/bin/gem'
default[:passenger][:stat_throttle_rate] = 5
default[:passenger][:rails_framework_spawner_idle_time] = 0
default[:passenger][:rails_app_spawner_idle_time] = 0
default[:passenger][:pool_idle_time] = 14400 # 4 hours
default[:passenger][:max_instances_per_app] = 0
default[:passenger][:max_requests] = 0
default[:passenger][:high_performance_mode] = 'off'
default[:passenger][:rails_spawn_method] = 'smart-lv2'
default[:passenger][:max_pool_size] = 8 # usually will be set by OpsWorks directy. Override if you need a custom size
default[:passenger][:friendly_error_pages] = 'off'
default[:passenger][:rack_version] = "1.6.4"
include_attribute "passenger_apache2::customize"