Check secrets and ssl in production 2 #297
Check secrets and ssl in production 2 #297
Conversation
@@ -0,0 +1,3 @@ | |||
# Place all the behaviors and hooks related to the matching controller here. |
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.
Remove this file. It's not used.
Could you write a test to check that in a faulty configuration you would get redirected to the errors page ? |
@mssola : I've done the fixes you asked me. Please could you take a second look? |
@@ -42,5 +42,6 @@ | |||
put "toggle_admin", on: :member | |||
end | |||
end | |||
match "(errors)/:status", to: "errors#show", constraints: { status: /\d{3}/ }, via: :all |
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.
And now you can remove this match no ?
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 i can't. This match is for routing the (errors) to the errors controller. By (errors) I mean 500, 400 errors, like when an exception is raised.
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.
Does that include also the errors raised in other circumstances (like the 404 error trying to view a non existing team)?
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.
Yes it does. Should we handle it differently? I don't know this case.
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, I just think it's great.
Implement an error controller to show custom messages when requirements like ssl configuration or secrets configurations are not met. Also, set up this controller as a custom error handler for showing up a custom message if database is not accessible. do not exit when running database migrations on production but instead show the error page since any access to the database will raise an exception. This way we have a running application that states the configuration errors.
I've fixed the tests and rebased the branch. Thanks for your comments so far. Could you take another look? |
<center><%= image_tag "layout/portus-error.png" %></center> | ||
<% if @fix.value?(true) %> | ||
<p> | ||
<center><h1> Ops... something went wrong...</h1></center> |
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 can remove the space before "Ops"
Please fix Rubocop's complains ( |
LGTM, waiting for @mssola's feedback |
use "begin ... ensure" to make sure the "after" block is run after running the example
…in_production Check secrets and ssl in production 2
This PR adds additional checks and a nicer ui for error handling.
If you want to see how it would look in production, set config.consider_all_requests_local to false in config/environments/development.rb.
Here a couple of screenshots:
if database is not properly configured
http://ibin.co/2E3H61mok295
if secrets are not properly configured
http://ibin.co/2E3HNCRxMigl