By Tintin
I have Ruby on Rails 5, NginX, and Ubuntu 16.04. running on my droplet. The app has been running for a number of years, however, for some reason it keeps reverting back to development mode.
Every time I run rake about it tells me that Rails is in development mode.
This is strange because I am telling Rails very clearly that I want it to run in production mode, for example in my unicorn configuration file:
ENV="production"
Whenever I do something on the server, for example, run a migration I tell Rails that it should be done in a production context:
rake db:migrate RAILS_ENV=production
But still Rails seems to be running in development mode all the time.
This command doesn’t help either:
RAILS_ENV=production rake about
How can I set my Rails app to production mode permanently?
This textbox defaults to using Markdown to format your answer.
You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!
Hi & thanks for your help.
Actually, I solved the problem using rbenv-vars.
More info can be found here.
Not sure if this is the best way to go?
Be aware that you should add the parameter in the place you start the service. But I can guide if you don’t add more info. So how do you start your server?
The way I do it is by setting the RAILS_ENV in the .bashrc adding the following line at the very end.
export RAILS_ENV=production
If you need to use it during the session only you can run it on the terminal and all the commands you execute afterwards are going to be on the production enviroment
Get paid to write technical tutorials and select a tech-focused charity to receive a matching donation.
Full documentation for every DigitalOcean product.
The Wave has everything you need to know about building a business, from raising funding to marketing your product.
Stay up to date by signing up for DigitalOcean’s Infrastructure as a Newsletter.
New accounts only. By submitting your email you agree to our Privacy Policy
Scale up as you grow — whether you're running one virtual machine or ten thousand.
Sign up and get $200 in credit for your first 60 days with DigitalOcean.*
*This promotional offer applies to new accounts only.