Rails Under Construction Page
-
22-10-2019 - |
Question
I know this may seem trivial to some, other won't see the point, however - for me this would be great:
I am trying to work out how to quickly and efficiently commit updates to my Rails app, switch to an under construction style page while I restart the rails app and then test the changes, then when I am happy, switch back to the live public version.
At the moment, I follow the following pattern:
- 1, make changes to app
- 2, commit using Versions App for Mac to BeanstalkApp
- 3, deploy revision from BeanstalkApp to server
- 4, login to server and restart apache
- 5, wait a few seconds and then start to double check everything is A-OK
If it helps, I am using Passenger on a Turnkey Rails image VPS.
Thanks in advance for any advice, etc.
Thanks,
Danny
Solution
You have a few options:
- Create a subdomain for 'testing' and deploy it to your production server and when it's vetted you can push it to your production code location.
You'll need to be able to add a subdomain to your DNS record to point to the same IP address as your main production server. You'll then also need to add a new VirtualHost with ServerName subdomain.host.com
and DocumentRoot /data/host.com/testing/public
so that it loads that code.
- Using Passenger create a subfolder app. See section 3.2 of http://www.modrails.com/documentation/Users%20guide.html#_deploying_a_ruby_on_rails_application to see how to add
RailsBaseURI
directives to enable separate sites in subdirectories. This means you deploy your code to another directory and create the simlink.
I have personally done BOTH approaches. I prefer approach #1 but it's personal preference and the level of access you have to your hosts.