Topic: How to deploy several apps on a single server

I'm a fairly new Rails newbie.

Ok, now I have 2 rails apps. Let's say I use a forum and a gallery. I have two questions:

1. How do I deploy these 2 apps on the same server like for example: and host/gallery? Is it possible? Do I have to play with mod_rewrite? Do I have to make virtual hosts and instead? Where can I find example of such setup?

2. Suppose I'm a internet provider of some sort. How can I offer the same application to several customers? Do I have to copy it several times (??). I'd rather have a a set of config files and start from different files. How would special files like logs, etc. coexists? Again, where can I find information on such setup?

Thanks for your input.


Re: How to deploy several apps on a single server

The answer is "it depends." What server software are you using? Are they all Rails apps? Do you control the source?

Re: How to deploy several apps on a single server

Ho, sorry for being so vague.

Yes, I'm talking about a Unix system, I have full access to the OS (root, etc.) but it really doesn't matter here. I'm using Apache or lightpd. All applications are "rails" apps.

I'm a php survivor, and on php, I could see how to do that, make the application under a "mount" point, to organise them like, etc. In fact, the mount point is a "parameter" of the application that I setup at installation time.

But I couldn't figure out how to do the same with Rails. In Rails book, I learn how to handcraft "nice" REST URL list "" and I understand how they work (route.rb, rails' internal convensions, etc.) inside a single, self contained application. But now let's imagine that I have 2 such applications that generate nice URL ( for the forum app, and for the gallery app. How do I "merge" them on a single server?

Do I have to write an extensive set of rewriting routes to properly route each URL to the proper application? Or is there another kind of magic that I'm missing?

Re: How to deploy several apps on a single server

It's easier than you think. Just set up proxies in Apache and have lighttpd listen on the proxied ports. I'm using Pound and Mongrel for about half my apps and lighttpd for the rest. In all cases, Apache listens on port 80 and proxies to my port.

For lighttpd, I have a server (and several fcgi processes) for each app. Apache proxies to a given port and each lighttpd listens for its appropriate port.

For Pound/Mongrel, I have Apache proxy all requests to my domain(s) to a single port, then have Pound do the name-based resolution and load balancing. Mongrel clusters listen on the ports specified in my pound.conf.


Re: How to deploy several apps on a single server

OK, I read back the apache proxy manual. I'll need to map all controllers I want to use in a rails app:

ProxyPass /forum http://localhost:3000/forum
ProxyPass /gallery http://localhost:3001/gallery
ProxyPass /blog http://localhost:3002/blog

and hope that there is no path clash between applications.
Is that correct, or is there a simpler way?

Re: How to deploy several apps on a single server

Here's great information about what I think you want to do... … o-and-you/

Re: How to deploy several apps on a single server

Yes, exactly! Thanks.