vlad-push

Intro

Vlad is a simple Rake based deployment tool, similar to Capistrano, which allows for easily managing code deployments on multiple servers and various environments. I'm not going to take a deep dive in to Vlad here and now, but you can learn more about it here.

Vlad is designed around the idea of deploying from an SCM -- svn by default, but it also support git through a nice plugin (vlad-git). Some time back, I ran in to an issue where I was trying to deploy to an AWS cluster from a firewalled repo and opening it was not an option. Thus vlad-push was born.

vlad-push

vlad-push allows for deploying via Vlad sans SCM. And it's fairly simple. I takes your local code, wraps it up and pushes it to the remote server(s).

Installation

To install vlad-push, just install the gem. It will (of course) install Vlad if it isn't already installed.

gem install vlad-push

If installing via Bundler, I recomment that you also ':require => false', as I've heard reports that Bundler's auto require "feature" can sometime mess things up.

# file: Gemfile
source :rubygems
group :deployment do
  gem 'rake'
  gem 'vlad', :require => false
  gem 'vlad-push', :require => false
end

I'm also including Rake in there, but Vlad should take care of that for you via it's dependancies if you don't include it.

Configuration

Once installed, there are a few configuration steps, above and beyond Vlad's configuration. For the purpose of this post, I'm going to assume that you've already followed Vlad's instructions and configured you servers accordingly.

To make Vlad and vlad-push available to Rake, you'll need to set up your Rakefile accordingly.

In it's simplest form, you would want to add this:

# file: <APP_ROOT>/Rakefile
require 'vlad'
Vlad.load(:scm => :push)
# ':scm => :push' tells Vlad to use vlad-push.

If you want to be safer, and more importantly allow Rake to work without Vlad (and push) installed you'll want to do the following.

# file: <APP_ROOT>/Rakefile
begin
  require 'vlad'
  Vlad.load(:scm => :push)
rescue LoadError
  # do nothing
end

Either one of these two blocks will surface Vlad and vlad-push tasks within Rake.

$ bundle exec rake -T vlad
rake vlad:cleanup         # Clean up old releases.
rake vlad:create_extract  # Built the extracted tarball to be pushed from the CWD
rake vlad:debug           # Show the vlad setup.
rake vlad:deploy          # Runs push and update / deploy
rake vlad:invoke          # Invoke a single command on every remote server.
rake vlad:migrate         # Run the migrate rake task for the the app.
rake vlad:push            # Push current working directory to remote servers.
rake vlad:push_cleanup    # Clean up archive files created by push.
rake vlad:rollback        # Rolls back to a previous version and restarts.
rake vlad:setup           # Setup your servers.
rake vlad:setup_app       # Prepares application servers for deployment.
rake vlad:start           # (Re)Start the web and app servers
rake vlad:start_app       # (Re)Start the app servers
rake vlad:start_web       # (Re)Start the web servers
rake vlad:stop            # Stop the web and app servers
rake vlad:stop_app        # Stop the app servers
rake vlad:stop_web        # Stop the web servers
rake vlad:update          # Updates your application server to the latest revision.

If you output looks like the above, you've correctly setup Vlad and vlad-push.

At this point, you can run rake vlad:push with no additional configurations, however, there are a few default options that you may want to overwrite in your deploy.rb.

# file: <APP_ROOT>/config/deploy.rb
#
# These are the defaults:
#
# set :repository,    "/tmp/repo"
# set :extract_dir,   "/tmp"
# set :extract_file,  "vlad-push-extract-#{release_name}.tgz"

Usage

If you're familar with Vlad, the usage is almost identical, when setting up from scratch you would run the following, in order:

$ rake vlad:setup
$ rake vlad:push
$ rake vlad:update
$ rake vlad:start_app

Additionally, I have included a vlad:deploy task, which pushes and updates in one step.

$ rake vlad:deploy

That's it, you're done. I'm done. Enjoy.

Resources


Articles on vlad-push

vlad-push

Vlad is a simple Rake based deployment tool, similar to Capistrano, which allows for easily managing code deployments on multiple servers and various environments. I'm not going to take a deep dive in to Vlad here and now, but you can learn more about it here.

Continue reading