pragmatist
Patrick Joyce

May 17, 2007

Harnessing Capistrano: Notes Part 2

Jamis just made a joke about the sea of macs. I guess I’m not the only one who thought that it was noteworthy.

there are before and after hooks as well as a bunch of callbacks. start and finish are only tied to top level tasks.

Upgrading to Capistrano 2.0

shouldn’t be too bad unless you did a lot of customization.

  1. capify . to set up.
  2. 3rd party extensions like mongrel cluster won’t work.
  3. overridden or extended tasks might blow up
  4. some of the variables have been changed
    #* there is a “compat” mode that provides a facade of tasks with 1.4 names delegating to 2.0 cap -Ff compat
    #* seems like compat mode would be a good way to figure out what has been deprecated in your resumes and what you need to change.
  5. cap -Ff upgrade upgrade:revisions dropped the revisions log in 2.0. There will be a file in each release directory that says called “revision” that specifies the revision that was built.

Done with the slides.

Questions

Why wasn’t Capistrano developed as an extension to rake?

Similarities are mostly superficial. Rake is dependency oriented. Capistrano is declarative. Rake for local, Capistrano for remote and hasn’t encountered much overlap.

What is up with Ezra’s shell?

I don’t really know what they are talking about but I’ll need to know.

What is the recommended way for setting environment variables?

There is some method that you can pass

What other types of cluster admin tasks do you do?

Cap isn’t moving away from deployment. Deployment will always be a central task, but Cap 2 makes it much more modular and more accessible for sysadmins. 37s uses for troubleshooting. Their sysadmin keeps cap shell all the time. Uses to check filespace etc, which was a big deal before they moved to using S3 (they were running out of space) Someone uses for their config files. They set their apache config files as erb templates.

Design question: Dependency checking is a very hardwired syntax have you thought about a more general way to do dependency checking?

He didn’t know there were other options. Just wanted to get something working. Open to someone coming up with a better way to do it. Need to support windows as a platform to deploy from limits choices. Example Jamis had to declined patch do to cd syntax differs on windows from POSIX.

Most deploy example seem to be simple. Where can you go for examples of more advanced stuff?

Eventually: Capify.org The wiki is a cool tool also. Right now the best place is the list. Another good place is blogs example. Tim Lucas. Capistrano is soft of hard to learn. There is an O’Reilly book that covers the basics, but is small and doesn’t get into detail.

How do you parametrize tasks?

Suggestion: use either environment variables or capistrano variable. Do it the same way you would parametrize a Rake task.

Isn’t it kind of messy to use environment variables?

The problem isn’t so technical, but how do you specify those on the command line. Jamis likes the env variable. Dirty on windows (what isn’t? that’s mine) A task that needs to take many parameters is a smell. Can prompt by using lambda.

Demo of “CocoaCapistrano” little ssl like thing

How did you record your scripting demos?

wrote a script called text_movie. The demos were smoke and mirrors.

What do you do with long running migrations (order of days)?

He doesn’t know. There longest migration was 3 hours. The guy asking now just runs them and prays. Another guy uses Capistrano to kick off the processes and has a separate system to do the migration and monitor it.

Deployment Migration. Can’t running deploy without migration break?

Yes. But safer than messing up data. Very hard to stop alter table on a row with 4 million rows. You can roll back if you blow up your app by not doing a migration. If you think deploy should migrate by default you can make it by putting an after hook. This is what they do at Shopify.

More Articles on Software & Product Development

Agile With a Lowercase “a”
”Agile“ is an adjective. It is not a noun. It isn’t something you do, it is something you are.
How Do You End Up With A Great Product A Year From Now?
Nail the next two weeks. 26 times in a row.
Build it Twice
Resist the urge to abstract until you've learned what is general to a class of problems and what is specific to each problem.