Programming in Paradise

Tuesday, January 10, 2006

Switchtower Thoughts

I just created my first switchtower deployment which is actually working. Switchtower is a good idea but it definitely has some areas which need improvement. First of all the documentation is not that great. It's ok if you follow the existing recipe exactly, but as soon as things start to fall apart it is quite difficult to find information on how to do things the right way. Case in point: if you want to execute one of your tasks defined in deploy.rb you must use the following syntax:

rake remote_exec ACTION=mytask

Not exactly intuitive, and its not explicitly stated in the documentation on the wiki. Initially I tried the following:

rake mytask

But was told that Rake didn't know about mytask. To make matters worse, the Rake documentation site at http://docs.rubyrake.org/ comes up with a Rails Application Error message. Oops.

Next concern is that you have to have your repository available from your deployment machine. In my company there are a lot of times where this is not possible. There needs to be some sort of solution which allows the Rails app to be packaged up on the local machine and then installed on the remote machine. Perhaps an actual install builder which would be able to execute the same tasks when on the deployment machine might be a good solution. This would also help with Windows deployment...which brings me to another issue: you can't use Switchtower to deploy to Windows.

Ouch, no Windows deployment. This is a bummer and looks like it will be much more difficult to fix. The key here is to remove dependencies on POSIX commands (such as chmod) and instead use Ruby equivilents with graceful failure when those commands can't be executed (or don't need to be executed). This is what I did with Pyb back in the days, and what Ant does, and its the only way to really deal with cross-platform builds.

Another problem occurs when deploying from Windows to a *nix environment. Ruby paths are not the same on different platforms and basically things go bonkers when you take a Rails app authored in Windows and deploy it to a *nix system. This really should be easy to fix, perhaps by determining the platform and then having a task alter the scripts as needed. The same goes for chmodding the CGI and FCGI scripts - this should be done automatically as part of a build.

Anyhow, like I said, the ideas behind Switchtower are good, and I'm glad to see thought being put into the problem of deployment, but there is clearly more work to be done.

0 Comments:

Post a Comment

<< Home