Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Restart passenger on deploy #71

Merged
merged 1 commit into from
Sep 15, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Capfile
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,12 @@ require 'capistrano/setup'

# Include default deployment tasks
require 'capistrano/deploy'
require 'capistrano/rails'

require 'capistrano/scm/git'
install_plugin Capistrano::SCM::Git

require 'capistrano/bundler'
require 'capistrano/passenger'

# Load custom tasks from `lib/capistrano/tasks` if you have any defined
Dir.glob('lib/capistrano/tasks/*.rake').each { |r| import r }
Expand Down
2 changes: 1 addition & 1 deletion Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ group :development do
gem 'bcrypt_pbkdf'
gem 'capistrano', require: false
gem 'capistrano-bundler'
gem 'capistrano-passenger'
gem 'capistrano-rails', require: false
gem 'ed25519'
end

Expand Down
7 changes: 4 additions & 3 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,9 @@ GEM
sshkit (>= 1.9.0)
capistrano-bundler (2.1.0)
capistrano (~> 3.1)
capistrano-passenger (0.2.1)
capistrano (~> 3.0)
capistrano-rails (1.6.3)
capistrano (~> 3.1)
capistrano-bundler (>= 1.1, < 3)
coderay (1.1.3)
concurrent-ruby (1.2.2)
crack (0.4.5)
Expand Down Expand Up @@ -207,7 +208,7 @@ DEPENDENCIES
brakeman
capistrano
capistrano-bundler
capistrano-passenger
capistrano-rails
ddtrace
dogstatsd-ruby
ed25519
Expand Down
11 changes: 10 additions & 1 deletion config/deploy.rb
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,13 @@

set :ssh_options, { forward_agent: true }

set :passenger_restart_with_touch, true
namespace :passenger do
desc 'Restart application'
task :restart do
on roles(:app), in: :sequence, wait: 5 do
execute 'passenger-config restart-app /opt/allsearch_rails_api/current'
end
end

after :publishing, :restart
end
4 changes: 2 additions & 2 deletions config/deploy/production.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,5 @@

set :stage, :production
set :rails_env, 'production'
server 'allsearch-api-prod1', user: 'deploy'
server 'allsearch-api-prod2', user: 'deploy'
server 'allsearch-api-prod1', user: 'deploy', roles: ['app']
server 'allsearch-api-prod2', user: 'deploy', roles: ['app']
2 changes: 1 addition & 1 deletion config/deploy/staging.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@

set :stage, :staging
set :rails_env, 'staging'
server 'allsearch-api-staging1', user: 'deploy'
server 'allsearch-api-staging1', user: 'deploy', roles: ['app']