What dir should I deploy Rails apps into?
What would be a reasonable and logical directory into which to deploy my production Rails apps on a Linux system?
Some candidates...
/var/rails <= There's a /var/www so this would be consistent with that
pattern. But I.T. guys have complained about stuff in /var
before.
/home/my_home_dir/rails <= OK, not /var, but I'm not the only developer.
Seems like it really ought to be a systemwide
location.
/home/rails <= I don't know. That just seems weird.
/rails <= Seems even weirder.
What is the least astonishing, most normal thing to do here?
(Background info -- a Rails app is a bunch of server side code written in Ruby along with a public
dir containing JavaScript, CSS, and maybe a little HTML. The public
dir is mapped to an Apache vhost. Apache handles the Ruby code through a module called Passenger or mod_rails
.)
Thanks for the help, all. I think I'm going to go with /opt/deployed_rails_apps
. (I like long, expository directory names, and tab completion.) /var/...
is also a good place, but I've gotten stern grumbling from I.T. when I tried to deploy stuff there. If it were my own machine I might go with /var
or /srv
.
Solution 1:
I think /opt would be the place for an application like this. I agree with following the FHS as suggested by chmeee, but I don't agree that a Rails app is a service per se.
Solution 2:
You may want to follow the Filesystem Hierarchy Standard (FHS) and place it in
/srv : Data for services provided by this system
EDIT:
I wouldn't place it in /opt
:
/opt : Add-on application software packages
It's purpose says:
/opt is reserved for the installation of add-on application software packages.
A package to be installed in /opt must locate its static files in a separate /opt/ or /opt/ directory tree, where is a name that describes the software package and is the provider's LANANA registered name.
I don't think a developed application is a 'software package'.
The rationale for /srv
is
This main purpose of specifying this is so that users may find the location of the data files for particular service, and so that services which require a single tree for readonly data, writable data and scripts (such as cgi scripts) can be reasonably placed.
I understand that a rails app is a cgi script and should be placed in /srv
.