Skip to content

Commit

Permalink
Configure Passenger in separate .conf file on Debian so PassengerRoo…
Browse files Browse the repository at this point in the history
…t isn't lost

The changes in 005bf61 are also necessary for Ubuntu 14.04 which now
ships Passenger 4.x
  • Loading branch information
GregSutcliffe committed May 3, 2014
1 parent 4eff354 commit 6b14fd0
Show file tree
Hide file tree
Showing 3 changed files with 77 additions and 53 deletions.
72 changes: 36 additions & 36 deletions manifests/params.pp
Original file line number Diff line number Diff line change
Expand Up @@ -90,36 +90,36 @@
$mime_support_package = 'mailcap'
$mime_types_config = '/etc/mime.types'
} elsif $::osfamily == 'Debian' {
$user = 'www-data'
$group = 'www-data'
$root_group = 'root'
$apache_name = 'apache2'
$service_name = 'apache2'
$httpd_dir = '/etc/apache2'
$server_root = '/etc/apache2'
$conf_dir = $httpd_dir
$confd_dir = "${httpd_dir}/conf.d"
$mod_dir = "${httpd_dir}/mods-available"
$mod_enable_dir = "${httpd_dir}/mods-enabled"
$vhost_dir = "${httpd_dir}/sites-available"
$vhost_enable_dir = "${httpd_dir}/sites-enabled"
$conf_file = 'apache2.conf'
$ports_file = "${conf_dir}/ports.conf"
$logroot = '/var/log/apache2'
$lib_path = '/usr/lib/apache2/modules'
$mpm_module = 'worker'
$dev_packages = ['libaprutil1-dev', 'libapr1-dev', 'apache2-prefork-dev']
$default_ssl_cert = '/etc/ssl/certs/ssl-cert-snakeoil.pem'
$default_ssl_key = '/etc/ssl/private/ssl-cert-snakeoil.key'
$ssl_certs_dir = '/etc/ssl/certs'
$passenger_conf_file = 'passenger.conf'
$passenger_conf_package_file = undef
$passenger_root = '/usr'
$passenger_ruby = '/usr/bin/ruby'
$suphp_addhandler = 'x-httpd-php'
$suphp_engine = 'off'
$suphp_configpath = '/etc/php5/apache2'
$mod_packages = {
$user = 'www-data'
$group = 'www-data'
$root_group = 'root'
$apache_name = 'apache2'
$service_name = 'apache2'
$httpd_dir = '/etc/apache2'
$server_root = '/etc/apache2'
$conf_dir = $httpd_dir
$confd_dir = "${httpd_dir}/conf.d"
$mod_dir = "${httpd_dir}/mods-available"
$mod_enable_dir = "${httpd_dir}/mods-enabled"
$vhost_dir = "${httpd_dir}/sites-available"
$vhost_enable_dir = "${httpd_dir}/sites-enabled"
$conf_file = 'apache2.conf'
$ports_file = "${conf_dir}/ports.conf"
$logroot = '/var/log/apache2'
$lib_path = '/usr/lib/apache2/modules'
$mpm_module = 'worker'
$dev_packages = ['libaprutil1-dev', 'libapr1-dev', 'apache2-prefork-dev']
$default_ssl_cert = '/etc/ssl/certs/ssl-cert-snakeoil.pem'
$default_ssl_key = '/etc/ssl/private/ssl-cert-snakeoil.key'
$ssl_certs_dir = '/etc/ssl/certs'
$passenger_conf_file = 'passenger_extra.conf'
$passenger_conf_package_file = 'passenger.conf'
$passenger_root = undef
$passenger_ruby = undef
$suphp_addhandler = 'x-httpd-php'
$suphp_engine = 'off'
$suphp_configpath = '/etc/php5/apache2'
$mod_packages = {
'auth_kerb' => 'libapache2-mod-auth-kerb',
'dav_svn' => 'libapache2-svn',
'fastcgi' => 'libapache2-mod-fastcgi',
Expand All @@ -136,16 +136,16 @@
'wsgi' => 'libapache2-mod-wsgi',
'xsendfile' => 'libapache2-mod-xsendfile',
}
$mod_libs = {
$mod_libs = {
'php5' => 'libphp5.so',
}
$conf_template = 'apache/httpd.conf.erb'
$keepalive = 'Off'
$keepalive_timeout = 15
$conf_template = 'apache/httpd.conf.erb'
$keepalive = 'Off'
$keepalive_timeout = 15
$max_keepalive_requests = 100
$fastcgi_lib_path = '/var/lib/apache2/fastcgi'
$fastcgi_lib_path = '/var/lib/apache2/fastcgi'
$mime_support_package = 'mime-support'
$mime_types_config = '/etc/mime.types'
$mime_types_config = '/etc/mime.types'
} elsif $::osfamily == 'FreeBSD' {
$user = 'www'
$group = 'www'
Expand Down
23 changes: 15 additions & 8 deletions spec/acceptance/mod_passenger_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
when 'Debian'
service_name = 'apache2'
mod_dir = '/etc/apache2/mods-available/'
conf_file = "#{mod_dir}passenger.conf"
conf_file = "#{mod_dir}passenger_extra.conf"
load_file = "#{mod_dir}passenger.load"
passenger_root = '/usr'
passenger_ruby = '/usr/bin/ruby'
Expand Down Expand Up @@ -71,8 +71,9 @@ class { 'apache::mod::passenger': }
end

describe file(conf_file) do
it { should contain "PassengerRoot \"#{passenger_root}\"" }
it { should contain "PassengerRuby \"#{passenger_ruby}\"" }
# passenger_extra.conf only contains directives if overridden from the class params
it { should_not contain "PassengerRoot \"#{passenger_root}\"" }
it { should_not contain "PassengerRuby \"#{passenger_ruby}\"" }
end

describe file(load_file) do
Expand All @@ -99,11 +100,17 @@ class { 'apache::mod::passenger': }
shell("sudo /usr/sbin/passenger-status") do |r|
# spacing may vary
r.stdout.should =~ /[\-]+ General information [\-]+/
r.stdout.should =~ /max[ ]+= [0-9]+/
r.stdout.should =~ /count[ ]+= [0-9]+/
r.stdout.should =~ /active[ ]+= [0-9]+/
r.stdout.should =~ /inactive[ ]+= [0-9]+/
r.stdout.should =~ /Waiting on global queue: [0-9]+/
if fact('operatingsystem') == 'Ubuntu' && fact('operatingsystemrelease') == '14.04'
r.stdout.should =~ /Max pool size[ ]+: [0-9]+/
r.stdout.should =~ /Processes[ ]+: [0-9]+/
r.stdout.should =~ /Requests in top-level queue[ ]+: [0-9]+/
else
r.stdout.should =~ /max[ ]+= [0-9]+/
r.stdout.should =~ /count[ ]+= [0-9]+/
r.stdout.should =~ /active[ ]+= [0-9]+/
r.stdout.should =~ /inactive[ ]+= [0-9]+/
r.stdout.should =~ /Waiting on global queue: [0-9]+/
end

r.exit_code.should == 0
end
Expand Down
35 changes: 26 additions & 9 deletions spec/classes/mod/passenger_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,28 @@
it { should contain_file('passenger.load').with({
'path' => '/etc/apache2/mods-available/passenger.load',
}) }
it { should contain_file('passenger.conf').with({
it { should contain_file('passenger_package.conf').with({
'path' => '/etc/apache2/mods-available/passenger.conf',
}) }
it { should contain_file('passenger.conf').with_content(/^ PassengerRoot "\/usr"$/) }
it { should contain_file('passenger.conf').with_content(/^ PassengerRuby "\/usr\/bin\/ruby"$/) }
it { should contain_file('passenger_package.conf').without_content }
it { should contain_file('passenger_package.conf').without_source }
it { should contain_file('passenger.conf').with({
'path' => '/etc/apache2/mods-available/passenger_extra.conf',
}) }
it { should contain_file('passenger.conf').without_content(/PassengerRoot/) }
it { should contain_file('passenger.conf').without_content(/PassengerRuby/) }
describe "with passenger_root => '/usr/lib/example'" do
let :params do
{ :passenger_root => '/usr/lib/example' }
end
it { should contain_file('passenger.conf').with_content(%r{PassengerRoot "/usr/lib/example"}) }
end
describe "with passenger_ruby => /usr/lib/example/ruby" do
let :params do
{ :passenger_ruby => '/usr/lib/example/ruby' }
end
it { should contain_file('passenger.conf').with_content(%r{PassengerRuby "/usr/lib/example/ruby"}) }
end
describe "with passenger_high_performance => true" do
let :params do
{ :passenger_high_performance => 'true' }
Expand Down Expand Up @@ -69,11 +86,11 @@
end
it { should contain_file('passenger.conf').with_content(/^ PassengerRoot "\/usr\/lib\/example"$/) }
end
describe "with passenger_ruby => /user/lib/example/ruby" do
describe "with passenger_ruby => /usr/lib/example/ruby" do
let :params do
{ :passenger_ruby => '/user/lib/example/ruby' }
{ :passenger_ruby => '/usr/lib/example/ruby' }
end
it { should contain_file('passenger.conf').with_content(/^ PassengerRuby "\/user\/lib\/example\/ruby"$/) }
it { should contain_file('passenger.conf').with_content(/^ PassengerRuby "\/usr\/lib\/example\/ruby"$/) }
end
describe "with passenger_use_global_queue => true" do
let :params do
Expand Down Expand Up @@ -134,11 +151,11 @@
end
it { should contain_file('passenger.conf').with_content(/^ PassengerRoot "\/usr\/lib\/example"$/) }
end
describe "with passenger_ruby => /user/lib/example/ruby" do
describe "with passenger_ruby => /usr/lib/example/ruby" do
let :params do
{ :passenger_ruby => '/user/lib/example/ruby' }
{ :passenger_ruby => '/usr/lib/example/ruby' }
end
it { should contain_file('passenger.conf').with_content(/^ PassengerRuby "\/user\/lib\/example\/ruby"$/) }
it { should contain_file('passenger.conf').with_content(/^ PassengerRuby "\/usr\/lib\/example\/ruby"$/) }
end
end
context "on a FreeBSD OS" do
Expand Down

0 comments on commit 6b14fd0

Please sign in to comment.