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

add loadbalancer rake task #219

Open
wants to merge 5 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 1 commit
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
30 changes: 30 additions & 0 deletions config/deploy.rb
Original file line number Diff line number Diff line change
Expand Up @@ -48,4 +48,34 @@
end
end

desc "Marks the server(s) to be removed from the loadbalancer"
kayiwa marked this conversation as resolved.
Show resolved Hide resolved
task :remove_from_nginx do
count = 0
on roles(:app) do
count += 1
end
if count > 1
raise "You must run this command on individual servers utilizing the --hosts= switch"
end
on roles(:app) do
within release_path do
execute :touch, "public/remove-from-nginx"
end
end
end

# You can/ should apply this command to a single host
# cap --hosts=pdc-describe-staging1.princeton.edu staging application:serve_from_nginx
desc "Marks the server(s) to be removed from the loadbalancer"
kayiwa marked this conversation as resolved.
Show resolved Hide resolved
task :serve_from_nginx do
on roles(:app) do
within release_path do
execute :rm, "-f public/remove-from-nginx"
end
end
end
end

before "deploy:reverted", "deploy:assets:precompile"

# before "deploy:assets:precompile", "deploy:yarn_build_css"
4 changes: 4 additions & 0 deletions config/initializers/health_monitor.rb
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,10 @@

config.path = :health

config.file_absence.configure do |file_config|
file_config.filename = "public/remove-from-nginx"
end

config.error_callback = proc do |e|
Rails.logger.error "Health check failed with: #{e.message}"
Honeybadger.notify(e)
kayiwa marked this conversation as resolved.
Show resolved Hide resolved
Expand Down