I have moved!

My new blog is at lindsaar.net

All the old content will stay here though. But check out the new blog

¿ 14/8/2007 - Capistrano and Ruby on Rails on OpenBSD

So, here we are on OpenBSD, got the rails app working, got the Apache talking, and all of this is wrapped up in a chrooted environment.

Life is good.

Now, we just have to set up the Capistrano deployment and we will be fine... no problem I hear you say.

Well, you are mostly right.

Some gotchas (rapidly):

  1. The user that Capistrano uses to ssh in has to have a POSIX shell... that basically means BASH.  So if the account you are using for Capistrano uses TCSH... it ain't gonna werk Caap'n!
  2. You are deploying into a chrooted environment... chrooted... got it?  Repeat after me, ch root ed.  That means... actually... lets get out of this list and i'll explain more fully.
Capistrano does a near little thing when it deploys your app.  It deploys it into a releases directory with a date.

It then makes a symlink from releases/200708BLAH/ to your current directory.  This way, changing versions of your app is as simple as changing the symlink.

But you are in a chrooted environment. 

So looking at the symlink you get something like:

current -> /var/www/rails/appname/releases/20070809BLAH

Which won't work, because you are chrooted into /var/www and so there is no /var/www there is just /

A simple solution is to make a var directory in your /var/www directory, and then make a symlink like so:

cd /var/www
mkdir var
cd var
ln -s ../ www


Then, when the app follows the symlink to /var/www, it gets put back up to /var/www and then can change down through /var/www without having to actually get to the real /var/www....

Confused? So was I... . end of class.

Of course... it sets up a loop in your directory structure.... I'm welcome to comments on the security implications of this (I can't think of any off hand) but you wouldn't want to run a script that drills down through the directory tree.... as it might take some time..............

blogLater


Mikel
Post A Comment! :: Send to a Friend!

About Me

AKA Raasdnil, this site is about web coding, hosting and all other matters that relate to this... especially Ruby on Rails!

Links