-
Notifications
You must be signed in to change notification settings - Fork 32
Add full Apache management #105
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
Conversation
a40f72f to
18b1e6d
Compare
|
Something you may want to consider as part of this re-design is the ability to deploy a content app and its Apache configurations without deploying the API app. |
|
Yes, I agree. But then you also want to be able to deploy a content app without workers. By that point you're really blowing up the size of the PR. |
|
This is already a large change so I don't mind it covering that use case :) If you want to plan to come back and layer that change on top of this design I'm OK with that too. |
What's the goal of deploying one without the API? Shared filesystem with shared database to scale out? I suspect we may also need to support a shared Redis deployment then so I'd prefer to tackle it later. We can write acceptance tests with multiple servers so I'd hope to really set a new level of verification in this module. That does require some research on my side though. |
|
Correct. With the Pulp 3 architecture, it's possible to deploy just a content app connected to the database of a main Pulp or mirror, as well as the storage (either shared filesystem or S3) for a lighter weight scale out. For that architecture, Redis is only needed by the main Pulp where the API app and workers are. |
|
I've split off #108 as a preparation PR which will reduce the size of this PR. That can already be merged. I'm starting to feel fairly confident about this but no tests have been done on attaching to another vhost (which is currently the primary deployment). Hence it's still a draft. |
|
Looks like EL8 doesn't generate a certificate by default where EL7 does so which is why they fail. |
manifests/apache.pp
Outdated
| ssl => true, | ||
| priority => $vhost_priority, | ||
| docroot => $pulpcore::webserver_static_dir, | ||
| directories => $base_directories + $api_directories, |
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 think these also need to be passed to the pulpcore::apache::fragment use as well so that authentication is configured through remote user environ.
715e43c to
acdc904
Compare
|
So a small update. I started with better integration tests:
Now that this appears to mostly work, I'm going to continue with testing deployment as part of the Foreman vhost. |
manifests/plugin.pp
Outdated
| } | ||
|
|
||
| if $http_content or $https_content { | ||
| # TODO: prio below main |
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 wouldn't know what to do with this TODO. Could you expand on the details?
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 think this is where I need to solve the issue you saw in fpc where the content was added after the main reverse proxy so they ended up not being proxied.
3acef9e to
0d401e5
Compare
|
I've started doing testing and this appears to work well now. I'm doing a final EL7 pipeline to verify it end to end. EL8 is untested, but I noticed that on EL8's Apache we need to do more work. https://pulp-certguard.readthedocs.io/en/latest/reverse_proxy_config.html#apache-2-4-10-config-example states we need to encode it. |
| @@ -0,0 +1,53 @@ | |||
| <%- | | |||
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.
This is painful to read and parse as a developer. Is there empty lines we could add to separate blocks more? Or processing that can happen inside the puppet class rather than in the template? I think, if we are going to go this route of trying to have a generic fragment that handles all cases, rather than having easy to read, specific templates we need to make the template easier to read and accept that the rendered version may not look like you would exactly design an Apache config file indentation and grouping of parameters wise.
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 should have mentioned this, but it's a trimmed down version of https://github.com/puppetlabs/puppetlabs-apache/blob/main/templates/vhost/_directories.erb with strict input checking. I could probably avoid it altogether and use template('apache/vhost/_directories.erb') but I wasn't quite sure about scoping.
I also wasn't quite sure about best practices. Room for improvement but I liked the strict typing checks.
I'll probably submit this upstream in puppetlabs-apache, but in the short term I don't think we can rely on that.
Pulpcore has a default for this (which is copied). That means it's a good idea to always set it. Otherwise the illusion is created that it's an optional thing. However, the reverse proxy must be set up to use this. If the header is not cleared, it's a security risk because an attack can spoof the header.
ff3d7b3 to
032e713
Compare
|
I think the tests should now be green, but Travis is backed up. After that, I think this is pretty much ready to be merged. |
templates/apache-fragment.epp
Outdated
| } else { | ||
| $provider = $directory['provider'].capitalize | ||
| } | ||
| -%> |
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.
This is hard to parse in this in this syntax. I think it could benefit from:
<%- $directories.each |$directory| { -%>
<%- if $directory['provider'] =~ /^(.*)match$/ {
$provider = $1.capitalize + 'Match'
} else {
$provider = $directory['provider'].capitalize
}
-%>
templates/apache-fragment.epp
Outdated
| }]] $directories, | ||
| Optional[Array[Hash[String, String]]] $proxy_pass = undef, | ||
| | -%> | ||
| <%- |
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.
Could this be:
| -%>
<%-
|
I had green install pipeline with this change. I just have questions regarding the EPP template formatting |
|
How about this? I kept it as a separate commit to make the diff easier to read, but will squash if you agree. |
|
Yes, that helps a lot, thank you! I can squash on merge once the tests run. |
|
Trying to kick Travis |
The goal of this is that the module can either manage the vhost itself or attach fragments to another vhost to embed the application. This allows composition.
42d8124 to
259d8e1
Compare
The goal of this PR is to keep all Apache configuration within the module. There should be no Apache config fragments at all in puppet-foreman_proxy_content. There are parameters to attach fragments to an existing vhost. This makes it easy to switch between the co-located implementation (Foreman is the vhost) or standalone.
Currently this is very much a draft. Tests will fail and the proxy setup is not configured when attaching. It may also need parameters for HTTPS certificates.