Skip to content

Deploy with capistrano 3

Eric Guo edited this page Jun 6, 2016 · 1 revision

Append below code to your config/deploy.rb will restart the Restforce::DB daemon in each deploy, the sync period is set to 30 seconds.

after 'deploy:updated', 'restforcedb:stop'
after 'deploy:reverted', 'restforcedb:stop'
after 'deploy:published', 'restforcedb:start'
namespace :restforcedb do
  desc 'Stop restforcedb'
  task :stop do
    on roles(:web), in: :groups, limit: 3, wait: 10 do
      within release_path do
        execute './bin/restforce-db', 'stop', "RAILS_ENV=#{fetch(:rails_env)}"
      end
    end
  end

  desc 'Start restforcedb'
  task :start do
    on roles(:web), in: :groups, limit: 3, wait: 10 do
      within release_path do
        execute './bin/restforce-db', '-i 30 start', "RAILS_ENV=#{fetch(:rails_env)}"
      end
    end
  end
end
Clone this wiki locally