Skip to content

al/pushr

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

56 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Pushr

Deploy Rails applications by Github Post-Receive URLs launching Capistrano’s tasks (cap deploy, cap staging deploy) or by pushing button in web GUI and get notifications by Twitter, IRC or Jabber.

Why? Because my friend Machal still cannot fix Capistrano on his Windows box and can now deploy with GitGUI. (No need to launch “DOS” for him when only thing he did is fixing some CSS or updating some assets.)

Currently runs deployment for about 5 Rails apps.

What?

Pushr assumes this:

  • You deploy a Rails application with Capistrano in standard settings

  • You have installed Capistrano et al. on the server you are deploying

  • You have generated SSH keys for the server you are deploying on

  • You are willing and able to run a Ruby application open to teh internet on the same machine as your Rails application

  • You are not anxiously awaiting how the cap deploy task ends. You just check the results from time to time.

  • You have tests for your application and you run them in Capistrano before hook (so you don’t end up deploying breakz)

  • You have set a post-receive hook for your repository, calling specific URL. See section below for Github guide.

Pushr calls a Capistrano deploy task specified in config.yml (or deploy by default) whenever you push to the repository with the hook.

You can also deploy by literally pushing a button in Pushr’s web-interface.

Pushr logs the Capistrano output into a file and can be configured to send updates to a Twitter, IRC, or XMPP (Jabber) account.

You can easily add more notifiers.

Want to try it out?

Install or update following Rubygems on the local machine or server where you want to run it:

$ sudo gem install sinatra rack haml capistrano capistrano-ext rackup

You will also need one of Thin, Mongrel or Webrick installed.

Rename and edit the configuration file:

$ cp config.example.yml config.yml
$ vim config.yml

Run the app in development mode:

rake

Set up *Github Post-Receive URL* (github.com/guides/post-receive-hooks) in your repo’s administration to:

http://{USERNAME SET IN CONFIG}:{PASSWORD SET IN CONFIG}@{YOUR SERVER}:4000

Load the URL in the browser. Fill the ugly HTTP-Auth box with the credentials from config.yml. You should see some info about deployed revision.

Click “Test Hook” at Github or do a git push to the git repo. You should see something POSTed in your terminal. Your application is updated with Capistrano. Done.

(Of course, you can use Git’s post-receive hook in any repo, not just on Github. You would be curl-ing that URL or something like that then.)

If you’re satisfied with what you see, you should run and control Pushr on the server/port of your choice using rake start:production[server,port]/rake stop:production[server,port]. For example

$ rake start:production[mongrel,4005]
$ rake stop:production[mongrel,4005]

By default rake start/rake stop will start/stop Pushr on Thin running on port 4000. Run rake -T for further information about available tasks.

Run tail -f deploy.log to see what’s really going on.

Configure notifiers in your config.yml file to get realtime updates about your projects’ deployments.

NOTE: Notifiers would require more gems, obviously, such as XmppNotifier would require the xmppr gem.

You can use Pushr without Github, obviously: you just need to setup a post-receive hook in your .git/hooks/post-receive with curl or something like that.

More information

Get more information in these articles:

Todos

  • Disable deploy with ‘[nodeploy]` declaration in commit message

  • !

    Visualize deploy.log on webpage in a sparkline graph (succeeded/failed deploys, show relevant portion of deploy.log for each deploy, etc)

  • Background the notifiers

About

Deploy Rails applications automatically by running Capistrano tasks with Git post-commit hooks

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Ruby 100.0%