Skip to content

Use web::vhost in web::jenkins - #2144

Open
ekohl wants to merge 1 commit into
theforeman:masterfrom
ekohl:use-web-vhost-for-jenkins
Open

Use web::vhost in web::jenkins#2144
ekohl wants to merge 1 commit into
theforeman:masterfrom
ekohl:use-web-vhost-for-jenkins

Conversation

@ekohl

@ekohl ekohl commented Oct 29, 2024

Copy link
Copy Markdown
Member

Now that web::vhost handles the certificate properly, web::jenkins can take advantage of it. It needs some special handling to make the HTTP vhost redirect if HTTPS is enabled and that's why http_attrs and https_attrs are introduced in web::vhost.

The X-Forwarded-Proto header is rewritten to use the REQUEST_SCHEME variable to automatically get the correct value.

Currently untested.

Comment thread puppet/modules/web/manifests/jenkins.pp
Comment thread puppet/modules/web/manifests/jenkins.pp Outdated
Stdlib::Absolutepath $webroot = '/var/www/vhosts/jenkins/htdocs',
Boolean $https = false,
) {
include web::base

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

web::vhost requires web which includes web::base

Copy link
Copy Markdown
Member Author

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.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Dropped the docroot ownership.

Comment thread puppet/modules/web/manifests/jenkins.pp Outdated
mode => '0755',
}

if $https {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should this use web::https instead, and drop the https param?
Otherwise you set web::jenkins::https to false, but web::vhost still uses web::https and tries to build a cert

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That would be more consistent with web::vhost::web. Further looking at that, we can probably also align those 2 on redirecting HTTP to HTTPS. I'll look a bit further.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've not implemented the HTTP to HTTPS redirect in web::vhost, but I now include web and use $web::https.

Now that web::vhost handles the certificate properly, web::jenkins can
take advantage of it. It needs some special handling to make the HTTP
vhost redirect if HTTPS is enabled and that's why http_attrs and
https_attrs are introduced in web::vhost.

The X-Forwarded-Proto header is rewritten to use the REQUEST_SCHEME
variable to automatically get the correct value.
@ekohl
ekohl force-pushed the use-web-vhost-for-jenkins branch from a90b781 to 3af0a02 Compare December 2, 2024 12:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants