出于生产目的,我需要运行三个进程。这是我的 procfile,我使用 Foreman 来启动它们:
web: bundle exec rails s Puma -p $PORT
queuing: bundle exec clockwork clock.rb
workers: bundle exec rake resque:workers
对于部署,我使用的是 Mina。在部署任务结束时启动 Foreman 的适当方法是什么?目前我是这样开始的:
desc "Deploys the current version to the server."
task :deploy => :environment do
deploy do
invoke :'git:clone'
invoke :'deploy:link_shared_paths'
invoke :'bundle:install'
invoke :'rails:db_migrate'
invoke :'rails:assets_precompile'
to :launch do
queue "touch #{deploy_to}/tmp/restart.txt"
queue "bundle exec foreman start"
end
end
end
...但我认为这不是正确的方法,因为“mina deploy”命令从未成功退出,并且本地控制台只是开始输出这些进程正在执行的任何操作。
问题二:如何在单独的文件中分别初始化这三个进程中的每一个的日志记录?
当其中一个崩溃时,如何防止杀死所有这三个进程?崩溃时如何使进程重新启动?
谢谢!