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?
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.
FHS standard would suggest /srv/www/#{appname}
.
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.
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.
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.
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With