7
7
conf_file = "#{ $mod_dir} /passenger.conf"
8
8
load_file = "#{ $mod_dir} /zpassenger.load"
9
9
10
- case fact ( 'operatingsystem' )
11
- when 'Ubuntu'
12
- case fact ( 'lsbdistrelease' )
13
- when '14.04'
14
- passenger_root = '/usr/lib/ruby/vendor_ruby/phusion_passenger/locations.ini'
15
- passenger_default_ruby = '/usr/bin/ruby'
16
- when '16.04'
17
- passenger_root = '/usr/lib/ruby/vendor_ruby/phusion_passenger/locations.ini'
18
- passenger_default_ruby = '/usr/bin/ruby'
19
- else
20
- # Includes 10.04 and 12.04
21
- # This may or may not work on Ubuntu releases other than the above
22
- passenger_root = '/usr'
23
- passenger_ruby = '/usr/bin/ruby'
24
- end
25
- when 'Debian'
26
- case fact ( 'operatingsystemmajrelease' )
27
- when '8'
28
- passenger_root = '/usr/lib/ruby/vendor_ruby/phusion_passenger/locations.ini'
29
- passenger_default_ruby = '/usr/bin/ruby'
30
- when '9'
31
- passenger_root = '/usr/lib/ruby/vendor_ruby/phusion_passenger/locations.ini'
32
- passenger_default_ruby = '/usr/bin/ruby'
33
- else
34
- # Includes wheezy
35
- # This may or may not work on Debian releases other than the above
36
- passenger_root = '/usr'
37
- passenger_ruby = '/usr/bin/ruby'
38
- end
39
- end
10
+ passenger_root = '/usr/lib/ruby/vendor_ruby/phusion_passenger/locations.ini'
11
+ passenger_default_ruby = '/usr/bin/ruby'
40
12
41
13
passenger_module_path = '/usr/lib/apache2/modules/mod_passenger.so'
42
14
rackapp_user = 'www-data'
@@ -116,6 +88,11 @@ class { 'apache::mod::passenger':
116
88
end
117
89
end
118
90
context 'default passenger config' do
91
+ # We need to set passenger_instance_registry_dir on every sane distro
92
+ # with systemd. Systemd can force processes into a seperate/private
93
+ # tmpdir. This is the default for apache on Ubuntu 18.04. As a result,
94
+ # passenger CLI tools can't find the config/socket, which defaults to /tmp
95
+ # we enable it for ubuntu 16.04/18.04, centos7 and debian 9
119
96
pp = if [ '7' , '9' , '16.04' , '18.04' ] . include? ( fact ( 'operatingsystemmajrelease' ) )
120
97
<<-MANIFEST
121
98
/* stock apache and mod_passenger */
@@ -148,36 +125,8 @@ class { 'apache::mod::passenger': }
148
125
149
126
describe file ( conf_file ) do
150
127
it { is_expected . to contain %(PassengerRoot "#{ passenger_root } ") }
151
- case fact ( 'operatingsystem' )
152
- when 'Ubuntu'
153
- case fact ( 'lsbdistrelease' )
154
- when '14.04'
155
- it { is_expected . to contain %(PassengerDefaultRuby "#{ passenger_default_ruby } ") }
156
- it { is_expected . not_to contain '/PassengerRuby/' }
157
- when '16.04'
158
- it { is_expected . to contain %(PassengerDefaultRuby "#{ passenger_default_ruby } ") }
159
- it { is_expected . not_to contain '/PassengerRuby/' }
160
- else
161
- # Includes 10.04 and 12.04
162
- # This may or may not work on Ubuntu releases other than the above
163
- it { is_expected . to contain %(PassengerRuby "#{ passenger_ruby } ) }
164
- it { is_expected . not_to contain '/PassengerDefaultRuby/' }
165
- end
166
- when 'Debian'
167
- case fact ( 'operatingsystemmajrelease' )
168
- when '8'
169
- it { is_expected . to contain %(PassengerDefaultRuby "#{ passenger_default_ruby } ") }
170
- it { is_expected . not_to contain '/PassengerRuby/' }
171
- when '9'
172
- it { is_expected . to contain %(PassengerDefaultRuby "#{ passenger_default_ruby } ") }
173
- it { is_expected . not_to contain '/PassengerRuby/' }
174
- else
175
- # Includes wheezy
176
- # This may or may not work on Debian releases other than the above
177
- it { is_expected . to contain %(PassengerRuby "#{ passenger_ruby } ) }
178
- it { is_expected . not_to contain '/PassengerDefaultRuby/' }
179
- end
180
- end
128
+ it { is_expected . to contain %(PassengerDefaultRuby "#{ passenger_default_ruby } ") }
129
+ it { is_expected . not_to contain '/PassengerRuby/' }
181
130
end
182
131
# rubocop:enable RSpec/RepeatedExample
183
132
@@ -188,10 +137,7 @@ class { 'apache::mod::passenger': }
188
137
expected_one = [ %r{Apache processes} , %r{Nginx processes} , %r{Passenger processes} ]
189
138
# passenger-memory-stats output on newer Debian/Ubuntu verions do not contain
190
139
# these two lines
191
- unless ( fact ( 'operatingsystem' ) == 'Ubuntu' && fact ( 'operatingsystemrelease' ) == '14.04' ) ||
192
- ( fact ( 'operatingsystem' ) == 'Ubuntu' && fact ( 'operatingsystemrelease' ) == '16.04' ) ||
193
- ( fact ( 'operatingsystem' ) == 'Debian' && fact ( 'operatingsystemmajrelease' ) == '8' ) ||
194
- ( fact ( 'operatingsystem' ) == 'Debian' && fact ( 'operatingsystemmajrelease' ) == '9' )
140
+ unless fact ( 'osfamily' ) == 'Debian'
195
141
expected_one << [ %r{### Processes: [0-9]+} , %r{### Total private dirty RSS: [0-9\. ]+ MB} ]
196
142
end
197
143
it 'outputs status via passenger-memory-stats #stdout' do
@@ -207,34 +153,27 @@ class { 'apache::mod::passenger': }
207
153
end
208
154
end
209
155
210
- # passenger-status fails under stock ubuntu-server-12042-x64 + mod_passenger,
211
- # even when the passenger process is successfully installed and running
212
- unless fact ( 'operatingsystem' ) == 'Ubuntu' && fact ( 'operatingsystemrelease' ) == '12.04'
213
- it 'outputs status via passenger-status #General information' do
214
- shell ( 'PATH=/usr/bin:$PATH PASSENGER_INSTANCE_REGISTRY_DIR=/var/run /usr/sbin/passenger-status' ) do |r |
215
- # spacing may vary
216
- expect ( r . stdout ) . to match ( %r{[\- ]+ General information [\- ]+} )
217
- end
156
+ it 'outputs status via passenger-status #General information' do
157
+ shell ( 'PATH=/usr/bin:$PATH PASSENGER_INSTANCE_REGISTRY_DIR=/var/run /usr/sbin/passenger-status' ) do |r |
158
+ # spacing may vary
159
+ expect ( r . stdout ) . to match ( %r{[\- ]+ General information [\- ]+} )
218
160
end
219
- expected_two = if ( fact ( 'operatingsystem' ) == 'Ubuntu' && fact ( 'operatingsystemrelease' ) == '14.04' ) ||
220
- ( fact ( 'operatingsystem' ) == 'Ubuntu' && fact ( 'operatingsystemrelease' ) == '16.04' ) ||
221
- ( fact ( 'operatingsystem' ) == 'Debian' && fact ( 'operatingsystemmajrelease' ) == '8' ) ||
222
- ( fact ( 'operatingsystem' ) == 'Debian' && fact ( 'operatingsystemmajrelease' ) == '9' )
223
- [ %r{Max pool size[ ]+: [0-9]+} , %r{Processes[ ]+: [0-9]+} , %r{Requests in top-level queue[ ]+: [0-9]+} ]
224
- else
225
- [ %r{max[ ]+= [0-9]+} , %r{count[ ]+= [0-9]+} , %r{active[ ]+= [0-9]+} , %r{inactive[ ]+= [0-9]+} , %r{Waiting on global queue: [0-9]+} ]
226
- end
227
- it 'outputs status via passenger-status #stdout' do
228
- shell ( 'PATH=/usr/bin:$PATH PASSENGER_INSTANCE_REGISTRY_DIR=/var/run /usr/sbin/passenger-status' ) do |r |
229
- expected_two . each do |expect |
230
- expect ( r . stdout ) . to match ( expect )
231
- end
161
+ end
162
+ expected_two = if fact ( 'osfamily' ) == 'Debian'
163
+ [ %r{Max pool size[ ]+: [0-9]+} , %r{Processes[ ]+: [0-9]+} , %r{Requests in top-level queue[ ]+: [0-9]+} ]
164
+ else
165
+ [ %r{max[ ]+= [0-9]+} , %r{count[ ]+= [0-9]+} , %r{active[ ]+= [0-9]+} , %r{inactive[ ]+= [0-9]+} , %r{Waiting on global queue: [0-9]+} ]
166
+ end
167
+ it 'outputs status via passenger-status #stdout' do
168
+ shell ( 'PATH=/usr/bin:$PATH PASSENGER_INSTANCE_REGISTRY_DIR=/var/run /usr/sbin/passenger-status' ) do |r |
169
+ expected_two . each do |expect |
170
+ expect ( r . stdout ) . to match ( expect )
232
171
end
233
172
end
234
- it 'outputs status via passenger-status #exit_code' do
235
- shell ( 'PATH=/usr/bin:$PATH PASSENGER_INSTANCE_REGISTRY_DIR=/var/run /usr/sbin/ passenger-status' ) do | r |
236
- expect ( r . exit_code ) . to eq ( 0 )
237
- end
173
+ end
174
+ it 'outputs status via passenger-status #exit_code' do
175
+ shell ( 'PATH=/usr/bin:$PATH PASSENGER_INSTANCE_REGISTRY_DIR=/var/run /usr/sbin/passenger-status' ) do | r |
176
+ expect ( r . exit_code ) . to eq ( 0 )
238
177
end
239
178
end
240
179
0 commit comments