What dir should I deploy Rails apps into?
On CentOS Linux distributions (and subsequently RedHat), when you install the httpd package (for Apache 2), it creates
/var/www, and expects that your vhosts point to your web content here. The default vhost is typically dumped in
/var/www/htdocs, and subsequent sites/apps should be put in
The actual location shouldn't matter much, but it's common to see
/var/www/sitename, or simply
You've already stated a few of the reasons why some of the other locations (like
/home) are not really suited for this.
Personally, I prefer
/var/www/sitename since it's friendly to Apache and Rails, and is system-wide.
You may want to follow the Filesystem Hierarchy Standard (FHS) and place it in
/srv : Data for services provided by this system
I wouldn't place it in
/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
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
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.