Every time I run rails console
on my production server, spring
starts and I forget to stop it.. and some of my RAM goes away...
Is there some way to prevent Spring from starting in a production environment?
To stop spring you can use bin/spring stop . It should start automatically when you run rails commands.
Spring is a Rails application preloader that speeds up development by keeping your application running in the background. This means you that don't need to restart a server when you make changes. In RubyMine, Spring can be used to run Rails generators, tests, and Rake tasks.
I found it. You need to set the environment variable DISABLE_SPRING
to true when executing the console, like this:
DISABLE_SPRING=true rails console
That way the Spring server will not load.
To do this automatically, you can export this variable in your .bashrc
, .tcshrc
, .zshrc
appending this code to it:
export DISABLE_SPRING=true
and then loading it, in my case (I'm using zsh):
source ~/.zshrc
Reference:
https://github.com/rails/spring
http://www.cyberciti.biz/faq/linux-unix-shell-export-command/
Put spring
in your testing group in the Gemfile
:
gem "spring", group: :test
or
group :test do
gem 'spring'
end
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