0

我正在尝试使用Recap来使用Capistrano 部署我的 Rails 4 应用程序。在文档中,它说:

ruby 配方 [...] 包括在 Procfile 中定义的工头支持、启动和重新启动进程。

我的应用程序需要在每次部署时重新启动两个进程:

  1. 乘客
  2. 延迟作业

我已经添加gem 'foreman'到我的 Gemfile 中,我对 Procfile 的尝试是:

# Procfile
web: sudo service nginx restart
worker: bin/delayed_job restart

但这显然是错误的,因为部署时没有重新启动。

正确的 Procfile 会是什么样子?

或者,如果这只是首先采取的错误方法,那么确保在每次部署时重新启动这些流程的更好方法是什么?

4

1 回答 1

0

I ended up giving up on foreman, and using the following code instead.

(Because I had started delayed_job on the server as a different user, and the app user does not have permission to stop other users' processes, I had to first manually stop delayed_job on the server.)

# in Capfile

namespace :passenger do
  task :restart do
    run "touch /home/intouchsys/app/tmp/restart.txt"
  end
end

namespace :delayed_job do
  task :restart do
    as_app "bin/delayed_job restart"
  end
end

after "deploy", "passenger:restart"
after "deploy", "delayed_job:restart"
于 2014-04-07T03:23:05.097 回答