views:

297

answers:

6

I wonder what's the best deployment directory for Rails apps? Some developers use directories such as /u/apps/#{appname}. Are there any advantages when using /u/apps/#{appname} instead of /var/www/#{appname} or other OS default directories?

Obviously I want to pick the directory with the best security properties and the least friction for setting up the server environment.

How do you deploy your Rails apps? Why are you using a specific directory? Do you think it really matters anyway?

+3  A: 

I tend to create a dedicated user for each rails app I run and install, and add that user to the www-data group. So, I tend to have /home/mephisto/www, /home/warehouse/www and so on.

I do this purely for organization, and I don't think it matters much.

changelog
I also put my apps in the /home directory, though I put them in /home/rails/<app>.
Yardboy
+2  A: 

I use Ubuntu and deploy under /var/rails/appname (underneath that are /releases and /current from Capistrano).

I do this to have a little separation between app types: rails, php, static, ...

I don't think it really matters, as long as you set permissions and ownership properly.

Daniel Beardsley
+3  A: 

As other people have said, it really doesn't matter where you keep your applications - the thing that does matter is that you're consistent about it, so that whichever server you're on, its just a case of going to the usual location.

I think the only reason people use /u/apps/#{appname} is that it's Capistrano's default setting - certainly it seems odd to me doing things that way.

Jon Wood
+1  A: 

Like the other posters I think you should just put them wherever feels most natural. Read man hier if you'd like to see what directories in the standard UNIX hierarchy are meant for. I like putting things somewhere logical under /var

Another very important consideration is that you should never put your Rails application directory somewhere where RAILS_ROOT will be accessible on the web. So sticking an entire Rails application in the subdirectory of a regular site is a big no-no.

nertzy
Nice tip on that second paragraph.
changelog
+2  A: 

FHS standard would suggest /srv/www/#{appname}.

Abie
and that is exactly where I put it.
Honza
+1  A: 

The CPanel based shared hosting account I use seems to favour /home/etc/rails_apps/...

I think it's fairly arbitrary - as long as they aren't in your public html directory.

Noel Walters