I'm developing an master rails app which controls other rails apps. It has a bash script to start those rails apps, and it works well while it's invoked in the command line manually.
But if I invoke it in the matter rails app, using backticks
, system
, or exec
, the script will fail.
The error message is:
unicorn_rails worker[0] -c ../configs/unicorns/c5.rb -E production must be run inside RAILS_ROOT:
#<Gem::LoadError: can't activate rack (~> 1.0.0, runtime), already activated rack-1.2.1.
Make sure all dependencies are added to Gemfile
.>
And here is the bash file:
cp configs/Gemfile* $1
cd $1
bundle
bundle exec unicorn_rails -c ../configs/unicorns/$1.rb -E production
How to resolve a problem like this?
As you can see, I use bundle exec
to start the child process, which should have it's own gems loaded, right?