Subscribe

Online Capistrano Tutorial Session #2

Posted by Jamis on Monday, August 4

The first online Capistrano tutorial session was very successful, thanks to everyone who participated. Now, it’s time to try again!

The second online Capistrano tutorial session is now open for registration: http://events.capify.org/events/2.

It is scheduled for Wednesday, August 13th, at 7pm (Mountain time), and will last two hours (plus up to an hour at the end for Q&A). As before, this tutorial is targeted at beginning Capistrano users, those will little or no prior experience. (If you’re looking for a session for more advanced users, keep watching this space—I’ll probably do one of those eventually, as soon as I can write a curriculum for it.)

1 comment

Pattern: Conditional Configuration

Posted by Jamis on Monday, July 14

Here’s a pattern that I’ve been using and seeing more and more often. The problem it solves is this: how do I configure Capistrano differently for some set of predetermined scenarios? The most common usage of it is when configuring Capistrano to deploy to different staging locations, and you want to configure each stage differently.

The cleanest solution simply involves creating a different task for each scenario. Within each task, you set variables, declare roles, and load files:

1
2
3
4
5
6
7
8
9
10
11
task :scenario_a do
  set :deploy_to, "/path/to/scenario_a"
  role :web, "scenario_a.web"
  role :app, "scenario_a.app"
end

task :scenario_b do
  set :deploy_to, "/path/to/scenario_b"
  role :web, "scenario_b.web"
  role :app, "scenario_b.app"
end

When you then go to invoke a task (like deploy), you simply invoke the scenario task you want first:

  $ cap scenario_a deploy

Capistrano simply invokes the task in the same order they were specified, so in this case, it will first call scenario_a (which will set up the deploy_to variable and the roles) and then will call deploy, which will use the settings you gave.

It’s really a quite powerful pattern for conditional configuration.

1 comment

Capistrano Links on del.icio.us

Posted by Tyler on Thursday, July 10

Call for links!

We want to centralize the wide breadth of knowledge that has spread accross the World Wide Web into one, easy to bookmark location:

del.icio.us/capistrano_links/

Have you written about Capistrano?

If you have, please send us a link (or links for that matter) to capistrano_links@filmprog.com.

We will then summarize your content in the notes field for easy reading and searching. You'll now have one place to go for the all the content available on the web concerning Capistrano.

But what if I have old information?

That's great! Because sometimes there are people out there who, for various reasons, are not able to upgrade to the latest version of cap. Just let us know what version (approximations are fine) of Capistrano you wrote the article for. And it will get tagged accordingly.

Were all in this together

The faster you send us your link the better the account will be! Don't wait, send your link now!

3 comments

Online Capistrano Tutorial Session

Posted by Jamis on Sunday, July 6

When: Tuesday, July 15, 2008, at 7:00 PM MDT (what's this is my own time zone?)
Where: Online, via Campfire
Duration: 2 hours
Seats: 10
Cost: $10
Sponsors: SliceHost — awesome VPS hosting!

To register, go here: http://events.capify.org/events/1.

This tutorial will focus on using Capistrano to deploy a Rails application from a Subversion repository. It will be targeted at beginners (so if you already have experience with Capistrano, you might not find much value here). Attendees will be given temporary shell access to a server, and a simple Rails application will be provided. During the course of the tutorial, attendees will configure and deploy the Rails application.

If there is sufficient interest, and this format of presentation works well enough, I may offer subsequent sessions on more advanced topics, including (but not limited to) deployment using Git, non-Rails deployment, and non-deployment uses of Capistrano.

What version(s) of Capistrano will be covered?

This tutorial will only cover the most recent version of Capistrano (2.4.3, as of this writing). You do not need to have it preinstalled, as the tutorial will include instruction on installation if needed.

Older versions of Capistrano will not be covered, but if you have specific questions about an older version of Capistrano, you may ask them during the course of the tutorial.

Why Campfire (instead of e.g. IRC)?

For one thing, Campfire lets you easily paste images and code into the stream of the chat. This lets people follow along without having to jump to external links, potentially losing the context and the flow of the tutorial.

For another thing, Campfire provides transcripts. This means that I can easily email attendees a transcript of the session when the session is finished. (If things go well, and if there is enough interest, I may even offer the transcript for sale later, for a few dollars, to people who were unable to attend.)

If the session were very large (40, 50, or more people) Campfire might not be as good a fit for what I have in mind. But for a group of 10, it’s just about perfect.

Why only 10 people?

This session is just an experiment, to see how well this venue can work for teaching people how to use Capistrano. If it works well, I may experiment with larger groups later. For now, though, ten seems about right for a tutorial session. More than that and I think it would get difficult to give each attendee sufficient attention. I fully intend for these to be hands-on opportunities, where attendees will actually follow along and deploy an application.

Why $10, instead of free, or $100?

As mentioned above, this is just an experiment, not a money-making opportunity (yet!). If there is sufficient demand, subsequent sessions may cost more. The $10/seat is mostly just minimal compensation for the time I'm putting into organizing the session and creating the curriculum.

Also, if this initial experiment were free, the danger would be people signing up without commitment. By requiring people to pay for the privilege of attending, they are more likely to show up, and less likely to be frivolous or merely casually interested.

Why Subversion instead of Git, or CVS, etc.?

Because most Rails devs are still using Subversion. Besides which, once you can deploy from subversion, switching SCM’s isn’t that much of a jump. If there’s enough interest, I may offer another session sometime on Git-based deployment.

What should I expect if I sign up?

Once you sign up and your payment is received, you’ll receive an email with (among other things) a URL to a web page. This web page will initially just have the tutorial’s date and time on it, along with a list of software you should already have installed and configured on your server before the tutorial begins (including Ruby, Subversion, etc.).

A couple of hours before the session starts it will be updated with a URL to the Campfire room, as well as your login credentials to the server, and the location of the Subversion repository hosting the Rails application.

You may sign into the Campfire room any time after the URL is available. The session will start at the indicated time, with a few minutes spent on introductions and waiting for stragglers. The tutorial will then begin and will run for approximately two hours.

Once the tutorial ends, your access to the Campfire chat room and the tutorial server will be terminated. A transcript of the tutorial will be emailed to you.

For people who were unable to attend, the transcript may be made available for a small fee (probably just a few dollars for this first tutorial).

Tentative outline

The following outline is tentative and is subject to change:

  • Installing Capistrano
  • Configuring Capistrano for your Rails project
  • cap deploy:check
  • cap deploy:setup
  • cap deploy:cold
  • cap deploy
  • cap deploy:rollback
  • cap deploy:cleanup
  • cap deploy:migrations
  • Overriding tasks
  • Extending tasks
  • Customizing deployment

Register!

Sound good? Then sign up!

5 comments