Skip to content

Instantly share code, notes, and snippets.

@mertonium
Last active October 10, 2015 08:47
Show Gist options
  • Save mertonium/3664110 to your computer and use it in GitHub Desktop.
Save mertonium/3664110 to your computer and use it in GitHub Desktop.
Capistrano task to notify Ratchet.io about deployment
# I am trying out Ratchet.io and I want to add their deployment notification to my
# normal capistrano deployment process. Here is my first working attempt.
# Add this task to your deploy.rb
namespace :rollbar do
task :notify, :roles => [:web] do
set :revision, `git log -n 1 --pretty=format:"%H"`
set :local_user, `whoami`
set :rollbar_token, YOUR_ACCESS_TOKEN
rails_env = fetch(:rails_env, 'production')
run "curl https://api.rollbar.com/api/1/deploy/ -F access_token=#{rollbar_token} -F environment=#{rails_env} -F revision=#{revision} -F local_username=#{local_user} >/dev/null 2>&1", :once => true
end
end
# Then add this task to your deployment flow, i.e.
after "deploy:restart", "rollbar:notify"
@mertonium
Copy link
Author

Whoa, I just saw the comments and updated the gist accordingly. Thanks @brianr & @ferblape !

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment