0

I am trying to use Recap for deploying my Rails 4 app with Capistrano. In the docs, it says:

The ruby recipe [...] includes foreman support, starting and restarting processes defined in a Procfile.

My app needs two processes to be restarted each deployment:

  1. Passenger
  2. Delayed Job

I've added gem 'foreman' to my Gemfile, and my attempt at a Procfile is:

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

But it's clearly wrong since nothing gets restarted when deploying.

What would a correct Procfile look like?

Alternatively, if this is just the wrong approach to be taking in the first place, then what would a better approach be to ensure these processes are restarted on each deploy?

Teddy Widom
  • 356
  • 1
  • 3
  • 11

1 Answers1

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"
Teddy Widom
  • 356
  • 1
  • 3
  • 11