-
Notifications
You must be signed in to change notification settings - Fork 900
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
Server static assets in production based on environment detection #20107
Conversation
@@ -24,6 +24,10 @@ def self.supports_nohup_and_backgrounding? | |||
@supports_nohup = is_appliance? && supports_command?('nohup') | |||
end | |||
|
|||
def self.is_production_build? |
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.
We can debate the name...I was having a hard time with this.
Note that in discussions with @simaishi, it might be preferable to have a dedicated ENV var for this, such as MANAGEIQ_IMAGE=true
, which would be present in all build artifacts whether appliance, podified, or container. Then, this becomes a simple check for that ENV VAR, and all of the other checks in this file can use that value as a an extra sanity check.
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.
If we honored RAILS_SERVE_STATIC_FILES
's value, these types of installations can set this env variable and this method is not needed. Thoughts?
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.
RAILS_SERVE_STATIC_FILES is meant for dev use case of testing locally when Rails.env == "production"...that is, devs are expected to set it. The rationale is that in production Rails static asset serving is off by default, and then you opt-in with the env var, so on real production you specifically don't set anything.
- Additionally adds tests for a number of environment conditions
9af6b20
to
cbc55d8
Compare
@jrafanie As discussed I've also added a warning output for the abnormal use cases so users know what is happening and aren't surprised. |
Some comments on commits Fryguy/manageiq@40620c9~...cbc55d8 config/environments/production.rb
|
Checked commits Fryguy/manageiq@40620c9~...cbc55d8 with ruby 2.5.7, rubocop 0.69.0, haml-lint 0.28.0, and yamllint config/environments/production.rb
lib/miq_environment.rb
|
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. This is great. Knowing that rails is serving static assets in production mode is a nice addition as clearly, that's not a normal thing I do unless I'm doing performance testing of slow requests.
Server static assets in production based on environment detection (cherry picked from commit daa6751)
Jansa backport details:
|
@jrafanie please Review
cc @himdel