Last active
October 10, 2015 08:47
-
-
Save mertonium/3664110 to your computer and use it in GitHub Desktop.
Capistrano task to notify Ratchet.io about deployment
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Whoa, I just saw the comments and updated the gist accordingly. Thanks @brianr & @ferblape !