爲了生產目的,我需要運行三個進程。這是我的procfile,我用Foreman來啓動它們:與Mina和Foreman正確部署Rails應用程序
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
...但我不認爲這是由於「米娜部署」命令從未成功退出和本地控制檯剛開始輸出無論這些進程正在做的正確方法。
問題二:如何在單獨的文件中分別初始化這三個進程中的每一個的日誌記錄?
如何防止在其中一個崩潰時殺死所有這三個進程?如何在崩潰時重啓進程?
謝謝!