1

I have a Rails 4 app on a single Apache server on a Centos 6 box.

At the moment I am doing manual deployments, which is working well and only take a few minutes. I have no issue with this. Trying to be a smart developer, I would like to have the ability to "Take down" my site, deploy, test, then bring it back up once it's verified secure and working. I do all of my development on my locally so this is purely for the deployment aspect. Now by "Take Down" I mean that I would like to temporarily restrict access to a whitelist of IP addresses (me and my tester(s)) and redirect ALL other addresses to another virtual site. (basically a static html page with a "Currently undergoing updates" message or something)

I have tried looking around, but haven't found something that is quite what I would like. This need to be simple with a "light-switch" like ability to turn on and off whenever needed.

What is "Best Practice" on this? Should this be done through Apache? or Rails?

If this is done in Rails, (maybe with Action Dispatch) can it be turned on and off at a moment's notice, without having to re-compile the application?

1 Answer 1

4
+50

This is mostly doable at the Rack level (below Rails, but after Apache) using the turnout gem. It can be instantly enabled or disabled without restarting the app, and includes IP whitelisting. It doesn't answer your question 100% because it doesn't natively provide redirection, but the maintenance page is fully customizable.

1
  • Thank you! This is exactly what I was looking for. I can manage the redirection, or simply show a page that tells the user that the site is down. Will award the bounty as soon as the restriction time finishes.
    – SnareChops
    Nov 10, 2014 at 0:49

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .