Support arbitrary customization of webserver site configuration #101
Support arbitrary customization of webserver site configuration #101
Conversation
1 similar comment
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 really, really like the idea. Can you also add one or two integration tests for this config options?
|
||
def generate_appserver_config(opts, source_template, source_cookbook) |
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 passing separate variables here? Can we stick to using opts
only?
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.
opts
get passed to the cookbook template itself at L93, and I figured that the cookbook template didn't need to know the source_template
and source_cookbook
values to do its work.
@ajgon What additional tests would you like? I'm unclear from the context of your question what "this config options" is. |
(I should add that I'm happy to add any tests you'd like - I'd really love to have my changes merged to master!) |
I was thinking about integration test, which actually sets custom ports, template and cookbook source. From my experience with chef, unit tests usually doesn't catch all the quirks. Integration test sets up fully functional chef environment, so I trust them way more. |
Ah. I did do template-level testing in the test that I wrote, showing that the For what it's worth I am actually testing this in a real chef environment and it works exactly as expected, but it's hard for me to see how to replicate that within the testing framework here. Do you have something in mind? |
Do you have any experience with chef integration testing? Because if not, that's okay - I'm going to merge all of your hard work anyway, and I can write those tests for you :) The format is actually pretty simple, take a look here for example: https://github.com/ajgon/opsworks_ruby/blob/master/test/integration/default/serverspec/default_spec.rb - your changes would probably need a new scope for that. Maybe one test to rule them all, with passenger, templates and ports? |
Oh my, sorry. I had not noticed the Let me take a look and see how hard it would be to add some integration tests. |
Yeah, totally understand, chef cookbooks use this directory structure for tests for whatever reason... which is confusing. |
Oh, and if it's easier for you, you can create a new PR with integration tests, then I can close and merge all those PRs right now! |
No, no...make me do the work. I'll churn through it today - I really want to get these PRs closed so that I can move on with the client work that is driving me to make all these changes. |
Awesome, thanks! I'm going to bed now, so no rush. I'm going to review and merge all of them tomorrow, and create a new release as well. |
53ad129
to
da53e69
Compare
Allow the user to deploy multiple applications on a single server, each listening on a distinct port: `app['webserver']['port']` and `app['webserver']['ssl_port']` (default 80 and 443, respectively), as well as the corresponding `global` values, will allow the user to override the port that the application listens to in Apache2 or nginx. Allow user to override which template is used to generate Apache2 or nginx per-app webserver configurations (aka "site configs"): `app['webserver']['site_config_template']` and `app['webserver']['site_config_template_cookbook']` (defaults are `appserver.#{webserver}.conf.erb` and `opswork_ruby`, respectively), as well as the corresponding `global` values, will allow the user to specify which template (from which cookbook) should be used to render the webserver site configuration. Fixes ajgon#100
da53e69
to
4efd130
Compare
SSL requests are enabled. Note that SSL itself is controlled by the | ||
``app['enable_ssl']`` setting in Opsworks. | ||
|
||
- ``app['webserver']['site_config_template']`` |
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 couldn't find a graceful to test the site_config_template
/site_config_template_cookbook
stuff in the integration tests without introducing another cookbook or at least some more recipes into the opsworks_ruby
code base, so I am going to trust that the unit tests for these two attributes are sufficient.
Anyone mucking around with such hardcore customizations can feel free to write an integration test if they discover that I've somehow borked this part ;-)
2 similar comments
…-customizations Support arbitrary customization of webserver site configuration
Allow the user to deploy multiple applications on a single server,
each listening on a distinct port:
app['webserver']['port']
andapp['webserver']['ssl_port']
(default80 and 443, respectively), as well as the corresponding
global
values,will allow the user to override the port that the application listens to
in Apache2 or nginx.
Allow user to override which template is used to generate Apache2 or
nginx per-app webserver configurations (aka "site configs"):
app['webserver']['site_config_template']
andapp['webserver']['site_config_template_cookbook']
(defaults areappserver.#{webserver}.conf.erb
andopswork_ruby
, respectively), aswell as the corresponding
global
values, will allow the user tospecify which template (from which cookbook) should be used to render
the webserver site configuration.
Fixes #100
TODO: