Reputation: 1084
I have a ruby app that depends of several web-services i've built.
To start all together I've got the following Procfile:
mondodb: /home/dwaynemac/mongodb/bin/mongod
accounts: ./script/start_accounts.sh
contacts: ./script/start_contacts.sh
activity: ./script/start_activity_stream.sh
web: ./script/start.sh
Each of this start_xxx.sh script do something like:
cd ../activity_stream; bundle exec unicorn -p 3003 -c ./config/unicorn.rb
If I manually run these previous line activity_stream runs ok. But when ran from foreman some gems are not recognized. As if the bundle was not correctly built.
Example error:
activity_stream/config/boot.rb:2:in `require': no such file to load -- grape (LoadError)
Upvotes: 3
Views: 1279
Reputation: 21100
Use the subcontractor gem to change working directory:
image_fallback: subcontract -d lib/rack/img_fallback/ -- bundle exec unicorn -c unicorn.conf config.ru
Upvotes: 6
Reputation: 11
You will have to use a new bash shell for each app you want to boot up.
# Procfile
app1: sh -c 'cd path/to/app1 && bundle exec rackup config.ru -p $PORT'
app2: sh -c 'cd path/to/app2 && bundle exec rackup config.ru -p $PORT'
Then use foreman
foreman start --procfile path/to/Procfile
More info here http://www.seanbehan.com/how-to-boot-up-multiple-sinatra-applications-at-the-same-time-with-foreman
Upvotes: 1