Revision 4cad220c
Added by Marek Hulán over 9 years ago
manifests/config/passenger.pp | ||
---|---|---|
validate_bool($prestart)
|
||
|
||
$docroot = "${app_root}/public"
|
||
$suburi_parts = split($foreman::foreman_url, '/')
|
||
$suburi_parts_count = size($suburi_parts) - 1
|
||
if $suburi_parts_count >= 3 {
|
||
$suburi_without_slash = join(values_at($suburi_parts, ["3-${suburi_parts_count}"]), '/')
|
||
if $suburi_without_slash {
|
||
$suburi = "/${suburi_without_slash}"
|
||
}
|
||
}
|
||
|
||
include ::apache
|
||
include ::apache::mod::headers
|
||
... | ... | |
priority => '05',
|
||
options => ['SymLinksIfOwnerMatch'],
|
||
custom_fragment => template('foreman/apache-fragment.conf.erb', 'foreman/_assets.conf.erb',
|
||
'foreman/_virt_host_include.erb'),
|
||
'foreman/_virt_host_include.erb', 'foreman/_suburi.conf.erb'),
|
||
}
|
||
|
||
if $ssl {
|
||
... | ... | |
ssl_options => '+StdEnvVars',
|
||
ssl_verify_depth => '3',
|
||
custom_fragment => template('foreman/apache-fragment.conf.erb', 'foreman/_assets.conf.erb',
|
||
'foreman/_ssl_virt_host_include.erb'),
|
||
'foreman/_ssl_virt_host_include.erb', 'foreman/_suburi.conf.erb'),
|
||
}
|
||
}
|
||
} else {
|
spec/classes/foreman_config_spec.rb | ||
---|---|---|
with_ruby('/usr/bin/ruby193-ruby').
|
||
that_comes_before('Anchor[foreman::config_end]')
|
||
end
|
||
|
||
it { should contain_apache__vhost('foreman').without_custom_fragment(/Alias/) }
|
||
end
|
||
|
||
describe 'without passenger' do
|
||
... | ... | |
with({})
|
||
end
|
||
end
|
||
|
||
describe 'with url ending with trailing slash' do
|
||
let :pre_condition do
|
||
"class {'foreman':
|
||
foreman_url => 'https://example.com/',
|
||
}"
|
||
end
|
||
|
||
it { should contain_apache__vhost('foreman').without_custom_fragment(/Alias/) }
|
||
end
|
||
|
||
describe 'with sub-uri' do
|
||
let :pre_condition do
|
||
"class {'foreman':
|
||
foreman_url => 'https://example.com/foreman',
|
||
}"
|
||
end
|
||
|
||
it { should contain_apache__vhost('foreman').with_custom_fragment(/Alias \/foreman/) }
|
||
end
|
||
|
||
describe 'with sub-uri ending with trailing slash' do
|
||
let :pre_condition do
|
||
"class {'foreman':
|
||
foreman_url => 'https://example.com/foreman/',
|
||
}"
|
||
end
|
||
|
||
it { should contain_apache__vhost('foreman').with_custom_fragment(/Alias \/foreman/) }
|
||
end
|
||
|
||
describe 'with sub-uri ending with more levels' do
|
||
let :pre_condition do
|
||
"class {'foreman':
|
||
foreman_url => 'https://example.com/apps/foreman/',
|
||
}"
|
||
end
|
||
|
||
it { should contain_apache__vhost('foreman').with_custom_fragment(/Alias \/apps\/foreman/) }
|
||
end
|
||
end
|
||
|
||
context 'on debian' do
|
templates/_assets.conf.erb | ||
---|---|---|
# Static public dir serving
|
||
<% unless @suburi %>
|
||
<Directory <%= @docroot %>>
|
||
|
||
<IfVersion < 2.4>
|
||
... | ... | |
</IfModule>
|
||
|
||
</Directory>
|
||
|
||
<% end %>
|
templates/_suburi.conf.erb | ||
---|---|---|
<% if @suburi %>
|
||
SetEnv RAILS_RELATIVE_URL_ROOT <%= @suburi %>
|
||
Alias <%= @suburi -%> <%= @docroot %>
|
||
<Location <%= @suburi -%>>
|
||
PassengerBaseURI /
|
||
PassengerAppRoot <%= @app_root %>
|
||
</Location>
|
||
|
||
<Directory <%= @docroot -%>>
|
||
Options -MultiViews
|
||
</Directory>
|
||
<% end %>
|
templates/apache-fragment.conf.erb | ||
---|---|---|
<% unless @suburi %>
|
||
PassengerAppRoot <%= @app_root %>
|
||
<% end %>
|
||
<% if @ruby and !@ruby.empty? -%>
|
||
PassengerRuby <%= @ruby %>
|
||
<% end -%>
|
Also available in: Unified diff
Allows sub-uri deployment