I am very confused about this whole rails deploy thing. The confusion is that whilst developing the whole app it has been in development
mode, which is fine. Now that I will deploy it, are there ammendments I need to make to files to change the rails app to production
mode before deploying, or does deploying autmatically do this?
I guess what I am asking is how do I switch from one environment to another?
No need to change any files just set shell variable RAILS_ENV=production
on your server
rails server -e production
will put you in production mode.
ALSO...
By default rails 3.1 and later defer assets to the asset pipeline. So you either need to run rake assets:precompile
or turn on serving assets in config/environments/production.rb
.
# config/environments/production.rb
config.assets.compile = true
You also need to ensure that your production database is setup correctly in config/database.yml
Other than that you are good to go :)
If this is truly a production box you could also set an environment variable to 'production' as well. As explained by Anatoliy Kukul in another answer.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With