/superdeploy

A collection of useful utilities for Capistrano deployments

Primary LanguageRubyMIT LicenseMIT

SuperDeploy - Capistrano recipes that make development easier

Many of the tasks in it are cobbled together from a number of other sources. I’d credit them, if I hadn’t long since forgotten who wrote ‘em. If it’s you, just email me and I’ll do so.

Unique to this release are some log watching recipes:

plain

  • log - unified log tailer, unfiltered

  • log:short - unified log tailer, filtered for just Processing: lines and errors (incl. backtrace)

rich

  • log:google - assuming you use Google Analytics style parameters to track incoming hits (or intra-site hits too), shows you the combinations of campaign, source, medium, the number of hits for each, and the last content type

  • log:google_subtotals - rolls up the hits for each campaign, source, medium, & content (rather than every combination)

richest

  • log:smart - live log scraper; shows live and aggregate hits, unique IPs, load times, etc by URL hit. It aggregates errors, too - showing just the application-internal backtrace (stripping framework backtracing)

I use log:smart in production to give me a constant heartbeat of the app (what’s being used, what methods are running too slowly, any errors that have been happening, overall site load, etc). It’s particularly useful during a deployment, so you can make sure everything goes smoothly - or instantly and easily see what went wrong without slogging through a large log file.

Try it out and enjoy.

Installation

script/plugin install git://github.com/saizai/superdeploy.git
cap -T # See all you can do
cap log:smart # use the fancy live hits/errors/loadtimes watcher

Got other cool recipes?

Send me a pull request and I’ll merge ‘em in!

I’d like this to be a nice one-stop library of cool toys that make a Capistrano user’s life easier.

Known bugs

  • the hits/min exponential moving average has something wrong with it. Never got around to fixing.

  • log:smart is not very routing-savvy. If you use something other than simple URLs, it’s likely to get confused.

  • all log methods miss some hits. This is because underlyingly, Capistrano breaks stuff up arbitrarily (by size), rather than by paragraph of log. This could be fixed by writing a wrapper that acts as a buffer and stitches the log back together again. I never found it worth the bother. If you do, please feel free to commit a fix.

Recipe list

  $ cap -T
	cap capistrano:upgrade           # Update revisions log from Capistrano 1.x.
	cap deploy                       # Deploys your project.
	cap deploy:check                 # Test deployment dependencies.
	cap deploy:cleanup               # Clean up old releases.
	cap deploy:cold                  # Deploys and starts a `cold' application.
	cap deploy:configs:setup         # Create the shared configs directory on the...
	cap deploy:configs:symlink       # Override config files w/ whatever's in the...
	cap deploy:god:starling:restart  # Restart starling using god
	cap deploy:god:starling:start    # Start starling using god
	cap deploy:god:starling:stop     # Stop starling using god
	cap deploy:god:workling:restart  # Restart workling using god
	cap deploy:god:workling:start    # Start workling using god
	cap deploy:god:workling:stop     # Stop workling using god
	cap deploy:long_deploy           # like update:migrations, but will take down...
	cap deploy:migrate               # Run the migrate rake task.
	cap deploy:migrations            # Deploy and run pending migrations.
	cap deploy:mongrel:seesaw        # seesaw::bounce the server.
	cap deploy:mongrel:setup_sudoers # Allow mongrel_rails to be sudo-run w/out p...
	cap deploy:passenger:restart     # Restart using Passenger
	cap deploy:pending               # Displays the commits since your last deploy.
	cap deploy:pending:diff          # Displays the `diff' since your last deploy.
	cap deploy:rollback              # Rolls back to a previous version and resta...
	cap deploy:rollback:code         # Rolls back to the previously deployed vers...
	cap deploy:setup                 # Prepares one or more servers for deployment.
	cap deploy:start                 # Start app using god
	cap deploy:stop                  # Stop app using god
	cap deploy:symlink               # Updates the symlink to the most recently d...
	cap deploy:update                # Copies your project and updates the symlink.
	cap deploy:update_code           # Copies your project to the remote servers.
	cap deploy:upload                # Copy files to the currently deployed version.
	cap deploy:web:disable           # Present a maintenance page to visitors.
	cap deploy:web:enable            # Makes the application web-accessible again.
	cap invoke                       # Invoke a single command on the remote serv...
	cap log                          # Tail logs.
	cap log:google                   # Last column shows last ~1s of totals.
	cap log:google_subtotals         # Display live google analytics info, by sub...
	cap log:short                    # Tail just the hits and errors; pass name o...
	cap log:smart                    # Display live timings, hitcounts, unique IP...
	cap shell                        # Begin an interactive Capistrano session.
	cap sys:apt:install              # Installs a package using the aptitude comm...
	cap sys:apt:search               # Search for aptitude packages on remote server
	cap sys:apt:update               # Runs aptitude update on remote server
	cap sys:apt:upgrade              # Runs aptitude upgrade on remote server
	cap sys:gems:install             # Install a gem on the release servers
	cap sys:gems:list                # List gems on release servers
	cap sys:gems:remove              # Uninstall a gem from the release servers
	cap sys:gems:update              # Update all gems on release servers
	cap sys:ruby                     # Grep for ruby processes
	cap sys:ssh_setup                # Copies contents of ssh public keys into au...
	cap sys:uname                    # Check uname
	cap sys:uptime                   # Check uptime

Info

Author

Sai Emrys (saizai)

License

MIT or CC by-nc-sa (your pick) for my stuff; probably MIT for others’