如何与领班一起运行多个捆绑的多个应用程序

问题描述 投票:3回答:2

我有一个ruby应用程序,取决于我已经构建的几个Web服务。

为了一起开始,我有以下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

每个start_xxx.sh脚本都执行以下操作:

cd ../activity_stream; bundle exec unicorn -p 3003 -c ./config/unicorn.rb

如果我手动运行这些前一行,activity_stream运行正常。但是当从工头跑出来时,一些宝石是不被认可的。好像捆绑包没有正确构建。

示例错误:

activity_stream/config/boot.rb:2:in `require': no such file to load -- grape (LoadError)
ruby bundler foreman
2个回答
6
投票

使用subcontractor gem更改工作目录:

image_fallback: subcontract -d lib/rack/img_fallback/ -- bundle exec unicorn -c unicorn.conf config.ru

1
投票

您必须为要启动的每个应用程序使用新的bash shell。

# 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'

然后使用领班

foreman start --procfile path/to/Procfile

更多信息在这里http://www.seanbehan.com/how-to-boot-up-multiple-sinatra-applications-at-the-same-time-with-foreman

© www.soinside.com 2019 - 2024. All rights reserved.