-
Notifications
You must be signed in to change notification settings - Fork 51
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Use web::vhost in web::jenkins #2144
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,25 +1,17 @@ | ||
class web::jenkins( | ||
class web::jenkins ( | ||
Stdlib::Fqdn $hostname = 'ci.theforeman.org', | ||
Stdlib::Absolutepath $webroot = '/var/www/vhosts/jenkins/htdocs', | ||
Boolean $https = false, | ||
) { | ||
include web::base | ||
|
||
$proxy_pass = { | ||
'path' => '/', | ||
'url' => 'http://localhost:8080/', | ||
'keywords' => ['nocanon'], | ||
'no_proxy_uris' => ['/.well-known'], | ||
} | ||
|
||
if $https { | ||
include web::letsencrypt | ||
|
||
letsencrypt::certonly { $hostname: | ||
plugin => 'webroot', | ||
domains => [$hostname], | ||
webroot_paths => [$webroot], | ||
} | ||
$proxy_attrs = { | ||
'allow_encoded_slashes' => 'nodecode', | ||
'proxy_pass' = { | ||
'path' => '/', | ||
'url' => 'http://localhost:8080/', | ||
'keywords' => ['nocanon'], | ||
'no_proxy_uris' => ['/.well-known'], | ||
}, | ||
} | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I still miss something in my vim config from when I moved to my new laptop. |
||
|
||
if $facts['os']['selinux']['enabled'] { | ||
|
@@ -29,50 +21,26 @@ | |
} | ||
} | ||
|
||
file { dirname($webroot): | ||
ensure => directory, | ||
owner => 'root', | ||
group => 'root', | ||
mode => '0755', | ||
} | ||
|
||
if $https { | ||
$url = "https://${hostname}" | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Should this use There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. That would be more consistent with |
||
|
||
apache::vhost { 'jenkins': | ||
port => 80, | ||
servername => $hostname, | ||
docroot => $webroot, | ||
docroot_owner => $apache::user, | ||
docroot_group => $apache::group, | ||
redirect_dest => "https://${hostname}/", | ||
} | ||
apache::vhost { 'jenkins-https': | ||
port => 443, | ||
servername => $hostname, | ||
docroot => $webroot, | ||
docroot_owner => $apache::user, | ||
docroot_group => $apache::group, | ||
proxy_pass => $proxy_pass, | ||
allow_encoded_slashes => 'nodecode', | ||
request_headers => ['set X-Forwarded-Proto "https"'], | ||
ssl => true, | ||
ssl_cert => "/etc/letsencrypt/live/${hostname}/fullchain.pem", | ||
ssl_chain => "/etc/letsencrypt/live/${hostname}/chain.pem", | ||
ssl_key => "/etc/letsencrypt/live/${hostname}/privkey.pem", | ||
require => Letsencrypt::Certonly[$hostname], | ||
$http_attrs = { | ||
'redirect_dest' => "${url}/", | ||
} | ||
$https_attrs = $proxy_attrs | ||
} else { | ||
$url = "http://${hostname}" | ||
$http_attrs = $proxy_attrs | ||
$https_attrs = {} | ||
} | ||
|
||
apache::vhost { 'jenkins': | ||
port => 80, | ||
servername => $hostname, | ||
docroot => $webroot, | ||
docroot_owner => $apache::user, | ||
docroot_group => $apache::group, | ||
proxy_pass => $proxy_pass, | ||
allow_encoded_slashes => 'nodecode', | ||
} | ||
web::vhost { 'jenkins': | ||
servername => $hostname, | ||
docroot_owner => $apache::user, | ||
docroot_group => $apache::user, | ||
http_attrs => $http_attrs, | ||
https_attrs => $https_attrs, | ||
attrs => { | ||
'request_headers' => ['set X-Forwarded-Proto expr=%{REQUEST_SCHEME}'], | ||
}, | ||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
web::vhost
requiresweb
which includesweb::base
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I kept it in because we use
$apache::user
and$apache::group
as docroot owners. I'm not sure we actually need that though.