Thursday, July 19, 2007

Capistrano on Windows client...

It was supposed to be easy: just read the Capistrano manual make a little magic with your deploy.rb file, and you're in business. Sounds wonderful, doesn't it? Would that it were so easy.

The documentation (manual and elsewhere) makes it clear that Cap'ping to a Windows server is pretty challenging... Cap is made for *nix machines. However, I didn't find anything about a Windows client, other than the statement that "you must have an svn client installed on your machine." I did -- RapidSVN, TortoiseSVN, and the svn client embedded in the Aptana IDE.

However, once I got to actually attempting to deploy my application, it failed every time with a "no such file or directory" error message and a reference to the repository trunk itself. No amount of hair-pulling (it was a VERY long weekend), searching the web, emailing a few contacts helped... not matter what I did, it continued to fail in exactly the same manner. I even built a new development environment on another machine just to make sure it wasn't some brain-dead Windows issue: no dice.

Tuesday night, I went to the local Ruby on Rails Meetup and got the answer from another Windows-based developer Hob Spillane -- thanks!

So... drum roll please... here's how to get Cap working on your system:

You MUST have the svn binaries installed on your Windows client machine and in your execution path before Cap can deploy successfully -- the GUI clients do not provide what Capistrano needs. The binary you need depends on the version of Apache that your provider is running: 2.0 and 2.2 require different binaries.

For my Apache 2.2, I went to the subversion download page, and clicked on the svn-win32-1.4.4.zip link, installed it in /usr/bin/svn/bin, added that directory to my PATH statement and -- voila! -- Capistrano deploys like a charm! (When I went to the download site, there was only the choice of a zip file, no setup.exe. That may change by the time you get there.)

If your version is Apache 2.0, go to this download page and chose the appropriate setup.exe or .zip file.

Nice...

7 comments:

  1. I've decided to bridge this gap and work on a dotnet file sync/diff/deployment tool that will work as easily on the command line as it will with nant. stay tuned I'll hook you up if youre interested

    ReplyDelete
  2. "You MUST have the svn binaries installed on your Windows client machine and in your execution path before Cap can deploy successfully."
    "For my Apache 2.2, I went to the subversion download page, and clicked on the svn-win32-1.4.4.zip link, installed it in /usr/bin/svn/bin."
    The above information you mentioned confused me. Which side should install the svn binaries, Windows client or *nix server?

    ReplyDelete
  3. What if I am not deploying to a machine running Apache? Instead I am deploying to a machine running the glassfish gem to serve up the whole magilla - quite magnificently in fact. What binaries should I get then?

    ReplyDelete
  4. @mistressjanna...

    I don't believe that the webserver you use makes any difference: the svn client is all about managing the source code for your application, and that operates independently of the web server.

    ReplyDelete
  5. You saved my friday evening. I spent couple of hours of hair pulling, Thank you very much.

    ReplyDelete