Skip to content

Commit

Permalink
Adding tasks to capistrano to start/stop delayed_job and incorporatin…
Browse files Browse the repository at this point in the history
…g them into deployment so they don't have zombie daemon processes running off old versions of the code.
  • Loading branch information
sfisher committed Jun 23, 2020
1 parent 23ef19f commit b8aa992
Show file tree
Hide file tree
Showing 4 changed files with 27 additions and 0 deletions.
14 changes: 14 additions & 0 deletions config/deploy.rb
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,20 @@
end
end

desc 'stop delayed_job'
task :stop_delayed_job do
on roles(:app) do
execute "cd #{deploy_to}/current; bundle exec bin/delayed_job -n 3 stop"
end
end

desc 'start delayed_job'
task :start_delayed_job do
on roles(:app) do
execute "cd #{deploy_to}/current; bundle exec bin/delayed_job -n 3 start"
end
end

after :restart, :clear_cache do
on roles(:app), in: :groups, limit: 3, wait: 10 do
# Here we can do anything such as:
Expand Down
3 changes: 3 additions & 0 deletions config/deploy/development.rb
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,9 @@

namespace :deploy do

before :starting, :stop_delayed_job
after :finished, :start_delayed_job

#desc 'update local engines to get around requiring version number changes in development'
#task :update_local_engines do
# on roles(:app) do
Expand Down
5 changes: 5 additions & 0 deletions config/deploy/prod2.rb
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,11 @@
set :rails_env, 'production'
set :passenger_pool, '12'

namespace :deploy do
before :starting, :stop_delayed_job
after :finished, :start_delayed_job
end

#set :bundle_env_variables, { 'RAILS_ENV' => 'stage' }

# To override the default host, set $SERVER_HOSTS, e.g.
Expand Down
5 changes: 5 additions & 0 deletions config/deploy/stage2.rb
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,11 @@
set :rails_env, 'stage'
set :passenger_pool, '6'

namespace :deploy do
before :starting, :stop_delayed_job
after :finished, :start_delayed_job
end

#set :bundle_env_variables, { 'RAILS_ENV' => 'stage' }

# To override the default host, set $SERVER_HOSTS, e.g.
Expand Down

0 comments on commit b8aa992

Please sign in to comment.