# Where in the filesystem to place the rails application root?

**URL:** <https://www.ruby-forum.com/t/where-in-the-filesystem-to-place-the-rails-application-root/77263>\
**Category:** Rails\
**Created:** [March 6, 2006, 3:20pm UTC](https://www.ruby-forum.com/t/where-in-the-filesystem-to-place-the-rails-application-root/77263 "2006-03-06T15:20:54Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![byrnejb](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/b/d2c977/32.png) [@byrnejb](https://www.ruby-forum.com/u/byrnejb)\
**Post date:** [March 6, 2006, 3:20pm UTC](https://www.ruby-forum.com/t/where-in-the-filesystem-to-place-the-rails-application-root/77263/1 "2006-03-06T15:20:54Z")

</div>

This is a minor Linux administrative issue having to do with deploying  
rails applications. I am considering where to place the root of our  
rails application and I would appreciate some suggestions, along with  
supporting rationale, from those of you that have deployed a rails  
appliction for general enterprise use. I am thinking along the lines of  
using “/opt/ruby/rails/” or some variation on this but I  
thought that I would ask first and see if there exists a concensus on  
where these things should be placed.

The environments that I need to consider are these:

Prototype and Initial release: Rails Application + Apache 2 +  
PostgreSQL 8.1 all on one machine.

Possible future deployment: Rails Application + Apache 2 + mod\_fcgid on  
one or more machines, PostgreSQL on a second.

It is also possible, albeit unlikely, that more than one rails  
application will be deployed on a single machine, accepting the  
constraints that special measures are needed to effect this  
configuration safely.

Regards,  
Jim

---

<div class="post-metadata">

**Author:** ![byrnejb](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/b/d2c977/32.png) [@byrnejb](https://www.ruby-forum.com/u/byrnejb)\
**Post date:** [March 6, 2006, 3:31pm UTC](https://www.ruby-forum.com/t/where-in-the-filesystem-to-place-the-rails-application-root/77263/2 "2006-03-06T15:31:14Z")

</div>

I would use /var/www/rails/ as the container for Rails apps being  
deployed under Linux w/Apache2. This would be analogous to using  
/var/www/perl-bin for mod\_perl apps. But I can certainly see how /opt  
would seem like a good place, as well.

If you have more than one user that needs to deploy Rails apps on your  
server, then I would amend the above to be /var/www/rails/, for  
each user’s Rails apps. However, to make that really work, I think you  
would need to use LightTPD, so you could spawn independent LightTPD  
processes for each user, thus giving them their own FastCGI listeners  
that they could then control through ./script/process/reaper.

-Brian

---

<div class="post-metadata">

**Author:** ![byrnejb](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/b/d2c977/32.png) [@byrnejb](https://www.ruby-forum.com/u/byrnejb)\
**Post date:** [March 7, 2006, 7:05pm UTC](https://www.ruby-forum.com/t/where-in-the-filesystem-to-place-the-rails-application-root/77263/3 "2006-03-07T19:05:38Z")

</div>

Thank you both.

Regards,  
Jim

---

<div class="post-metadata">

**Author:** ![byrnejb](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/b/d2c977/32.png) [@byrnejb](https://www.ruby-forum.com/u/byrnejb)\
**Post date:** [March 7, 2006, 7:32pm UTC](https://www.ruby-forum.com/t/where-in-the-filesystem-to-place-the-rails-application-root/77263/4 "2006-03-07T19:32:12Z")

</div>

> If you have more than one user that needs to deploy Rails apps on  
> your  
> server, then I would

recommend webapp-config, nee [http://www.vhost-tools.org](http://www.vhost-tools.org)

which makes deploying multiple versions of apps in multiple locations  
for multiple users…much easier. Capistrano’s second cousin, Medusa…

unfortunately it didnt catch the bug that i just found in collaboa where  
it gets stuck in and endless loop rolling back the changeset synchs over  
and over causing each request to take 45 seconds, but thats another  
story…

---

<div class="post-metadata">

**Author:** ![byrnejb](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/b/d2c977/32.png) [@byrnejb](https://www.ruby-forum.com/u/byrnejb)\
**Post date:** [March 6, 2006, 6:18pm UTC](https://www.ruby-forum.com/t/where-in-the-filesystem-to-place-the-rails-application-root/77263/5 "2006-03-06T18:18:57Z")

</div>

On Mar 6, 2006, at 6:20 AM, James B. wrote:

> This is a minor Linux administrative issue having to do with deploying  
> rails applications. I am considering where to place the root of our  
> rails application and I would appreciate some suggestions, along with  
> supporting rationale, from those of you that have deployed a rails  
> appliction for general enterprise use.

snip…

> Possible future deployment: Rails Application + Apache 2 +  
> mod\_fcgid on  
> one or more machines, PostgreSQL on a second.

I just completed such a rollout last week.

We created a user with strictly controlled permissions on all the  
machines,  
and put the code in the home directory of the application user.

It makes sense to me as applications run as a user, why not have a user  
to run the application? The security setup is easy, and it’s easy to  
keep  
track of that the app is doing under top, etc.

–  
– Tom M.
