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
MODULES-5426 : Add support for all mod_passenger server config settings #1665
MODULES-5426 : Add support for all mod_passenger server config settings #1665
Conversation
* Parsed https://www.phusionpassenger.com/library/config/apache/reference for all options * Took care of maintaining older options * Add specs for all options * added warnings a failures if passenger_installed_version is set
* Remove the RubyMine formatter configuration from the ERB template * Remove pending message from spec/acceptance/mod_passenger_spec The message is not needed any more because puppet manages the passenger.conf file now
* validates the passenger_installed_version options fires the version checking for each option * Fix a few linting errors
The code generator was using the introduction version number as the removed verison number.
I am finished making changes to this branch. |
Hey @jbondpdx, would you mind taking a looking at these README changes and seeing what you think? They don't match the standard format we usually use for parameters but seem like an improvement with respect to readability and not duplicating documentation. |
} | ||
} | ||
if $passenger_app_root { | ||
if (versioncmp($passenger_installed_version, '4.0.0') < 0) { |
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.
Would it be easier to sort the parameters based on their version instead of duplicating the versioncmp logic a bunch?
if (versioncmp($passenger_installed_version, '4.0.0') < 0) {
if $passenger_allow_encoded_slashes {
fail("Passenger config option :: passenger_allow_encoded_slashes is not introduced until version 4.0.0 :: ${passenger_installed_version} is the version reported")
}
if $passenger_app_env {
fail("Passenger config option :: passenger_app_env is not introduced until version 4.0.0 :: ${passenger_installed_version} is the version reported")
}
if $passenger_app_group_name {
fail("Passenger config option :: passenger_app_group_name is not introduced until version 4.0.0 :: ${passenger_installed_version} is the version reported")
}
if $passenger_app_root {
fail("Passenger config option :: passenger_app_root is not introduced until version 4.0.0 :: ${passenger_installed_version} is the version reported")
}
}
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.
You are right, I should of lumped together the checks. I thought about but I rationalized to keep it the way it was written -- why? I don't recall. I will fix.
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 do recall now why it its that way. It was to keep all the passenger options in alphabetical order. Keep it as is, or lump them together?
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.
Normally we keep these alphabetized just to make things easier to find. If sorting by version in this case works better, then I'm fine with it.
spec/classes/mod/passenger_spec.rb
Outdated
:concat_basedir => '/dne', | ||
:id => 'root', | ||
:path => '/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin', | ||
:is_pe => false, |
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.
Why indent extra here?
spec/classes/mod/passenger_spec.rb
Outdated
:concat_basedir => '/dne', | ||
:id => 'root', | ||
:path => '/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin', | ||
:is_pe => false, |
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.
Same.
spec/classes/mod/passenger_spec.rb
Outdated
:concat_basedir => '/dne', | ||
:id => 'root', | ||
:path => '/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin', | ||
:is_pe => false, |
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.
Same.
spec/classes/mod/passenger_spec.rb
Outdated
:concat_basedir => '/dne', | ||
:id => 'root', | ||
:path => '/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin', | ||
:is_pe => false, |
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.
Same.
spec/classes/mod/passenger_spec.rb
Outdated
:id => 'root', | ||
:kernel => 'Linux', | ||
:path => '/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin', | ||
:is_pe => false, |
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.
Same.
spec/classes/mod/passenger_spec.rb
Outdated
:id => 'root', | ||
:kernel => 'FreeBSD', | ||
:path => '/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin', | ||
:is_pe => false, |
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.
Same.
spec/classes/mod/passenger_spec.rb
Outdated
:id => 'root', | ||
:kernel => 'Linux', | ||
:path => '/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/opt/bin', | ||
:is_pe => false, |
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.
Same.
spec/classes/mod/passenger_spec.rb
Outdated
@@ -25,7 +204,7 @@ | |||
it { is_expected.to contain_file('passenger.conf').with({ | |||
'path' => '/etc/apache2/mods-available/passenger.conf', | |||
}) } | |||
describe "with passenger_root => '/usr/lib/example'" do | |||
describe "with passenger_root => '/usr/lib/example'" do |
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.
Whitespace change.
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.
All white space issues are either copy/paste or code generation issues. I will fix.
spec/classes/mod/passenger_spec.rb
Outdated
}) } | ||
|
||
passenger_config_options = { | ||
'passenger_allow_encoded_slashes' => {Type: 'OnOff', PassOpt: :PassengerAllowEncodedSlashes}, |
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.
It looks like you're using capitalized key names whereas in ruby this is not canonical.
e.g. Type
would be type
, PassOpt
would be pass_opt
Also, I'm curious, is there a particular reason the values for PassOpt are symbols instead of strings?
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.
No reason :) Just generated code, I will make it more canonical.
PassengerErrorOverride <%= @passenger_error_override %> | ||
<%- end -%> | ||
<%- if @passenger_file_descriptor_log_file -%> | ||
PassengerFileDescriptorLogFile "<%= @passenger_file_descriptor_log_file %>" |
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 don't quite understand why some values get quotes and some don't. Could you expand on this decision?
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.
Some of the values may have white space. The passenger docs is not quote explicit on which ones can and can't. The passenger docs specify in the syntax the kind of value and from there I wrote a conversion chart. Copy-paste from my script below:
type_conversion_chart = {
'dir-path' => 'FullPath',
'file-path' => 'FullPath',
'on|off' => 'OnOff',
'uri' => 'URI',
'path-to-ruby-interpreter' => 'FullPath',
'path-to-python-interpreter' => 'FullPath',
'path-to-node-js' => 'FullPath',
'path-to-json-settings-file' => 'FullPath',
'name' => 'String',
'path' => 'FullPath',
'relative-path' => 'RelPath',
'absolute-or-relative-path' => 'Path',
'smart|direct' => %w(smart direct),
'username' => 'String',
'groupname' => 'String',
'scheme://user:password@proxy_host:proxy_port' => 'URI',
'integer' => 'Integer',
'seconds' => 'Integer',
'number' => 'Integer',
'process|thread' => %w(process thread),
'megabytes' => 'Integer',
'url' => 'URI',
'bytes' => 'Integer',
'filename' => 'FullPath',
'path-to-socket' => 'FullPath',
'your_application_key' => 'String',
'"string"' => 'QuotedString',
'gateway_hostname' => 'URI',
'gateway_port' => 'Integer',
'gateway_pinned_certificate_file' => 'FullPath'
}
Here is the bit where at I decided what was what.
quoted_types = ['QuotedString', 'FullPath', 'Path', 'RelPath']
non_quoted_types = ['OnOff','Integer','String','URI']
Things I mapped as non_quoted_types are the only settings in which the passenger documentation made evident the value would not contain white space, everything else may contain white space.
The apache documetation states
Arguments to directives are separated by whitespace. If an argument contains spaces, you must enclose that argument in quotes.
I also left in whatever quoting existed before my changes. I didn't want to change anyone's module configuration who was using existing options with or without quotes.
spec/classes/mod/passenger_spec.rb
Outdated
passenger_config_options.each do |config_option, config_hash| | ||
puppetized_config_option = config_option | ||
valid_config_values = [] | ||
case config_hash[:Type] |
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'm curious about the sorting of these tests into cases by the Type
. Is this just a semantic thing to make the test cases more organized or does it serve a functional purpose?
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.
During the code generator work, I had a different case for each "type" then slowly consolidated. When I saw that some of the existing apache::mod::passenger options had types associated with them, ex. $passenger_log_file and $passenger_spawn_method, my thought was to lay down some ground to maybe force type checking and allow unhappy-path testing. its probably too early for that, i'll will consolidate and remove duplicate code.
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.
Awesome change, thank you!
README.md
Outdated
Default: `undef`. | ||
|
||
* `passenger_max_pool_size`: Sets the [`PassengerMaxPoolSize`](https://www.phusionpassenger.com/library/config/apache/reference/#passengermaxpoolsize). | ||
The current set of server configurations settings were taking directly from the [`Passenger Reference`](https://www.phusionpassenger.com/library/config/apache/reference/). Deprecation warning and removal failure messages can be enabled by setting the passenger_installed_version to |
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.
Suggest changing the first sentence to "These server configuration settings are based on the Passenger Reference". Passenger Reference doesn't need to be in backticks.
Also, passenger_installed_version is a parameter, so should be in backticks.
README.md
Outdated
|union_station_key|undef|[`UnionStationKey`](https://www.phusionpassenger.com/library/config/apache/reference/#UnionStationKey)|| | ||
|union_station_proxy_address|undef|[`UnionStationProxyAddress`](https://www.phusionpassenger.com/library/config/apache/reference/#UnionStationProxyAddress)|| | ||
|union_station_support|undef|[`UnionStationSupport`](https://www.phusionpassenger.com/library/config/apache/reference/#UnionStationSupport)|| | ||
|wsgi_auto_detect|undef|WsgiAutoDetect|These options have been removed in version 4.0.0 as part of an optimization. You should use PassengerEnabled instead.| |
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.
holy cow, this table is a heroic effort, go you! Huge improvement.
@hunner @HAIL9000 @jbondpdx @eputnam My apologies for not getting back to you sooner, I was out of the country. About 90% of the code and documentation is being generated by a script I wrote. This effort started as just adding support for the server config settings. It sort of snowballed as I kept adding to the code generator. I will fix the issues with the generator and formatting as you have pointed out. However, before I left I started on a branch to combine all the changes for Vhost, Directory and Server configurations. With that I have a few questions.
Thanks for taking the time to review my pull request. |
@dacat keeping the PRs separate works best. And I don't mind an extra column but I'm not sure I understand what it would be for. |
* Remove whitespace added by auto-formatter * Make hash keys more canonical * Remove UnionStation options - UnionStation is no longer supported/offered by phusion. - All options are being removed from the passenger source * Add white space at the end of the the passenger.conf.erb template * Update the README to remove UnionStation as well as to add the context column.
@eputnam I added the column in the README for you to look at. All of the passenger options are available in the context of a "server config". From there subsets are available in "vhost", "directory" and "htaccess" Since all the passenger options are available, as of today, in the "server config" context, it made sense in my head to list the other context's which can contain the option. |
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.
Just this one little fix needed.
README.md
Outdated
Default: `undef`. | ||
|
||
* `passenger_max_pool_size`: Sets the [`PassengerMaxPoolSize`](https://www.phusionpassenger.com/library/config/apache/reference/#passengermaxpoolsize). | ||
The current set of server configurations settings were taking directly from the [Passenger Reference](https://www.phusionpassenger.com/library/config/apache/reference/). Deprecation warning and removal failure messages can be enabled by setting the `passenger_installed_version` to |
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.
Change "taking" to "taken"
Optional bonus points if you make the "Deprecation warnings..." sentence active while you're in there: "To enable deprecation warnings and removal failure messages, set the..."
My apologies for the delay. |
I've verified requested changes have been made, Jean is real busy so we'll just check this off for her
…tions MODULES-5426 : Add support for all mod_passenger server config settings
Support for the available server configuration settings is currently incomplete. The changes I've will:
Items from the guidlines for contributing: