views:

65

answers:

5

I would like to set up multiple Rails apps running simultaneously.

I'm using a basic installation with Rails and Mongrel. I'm pretty newbie when it comes to a server side thing.

What kind of options do I have to run multiple Rails app running at the same time on a local Mac?

A: 

I'm a Django (not Rails) coder, but I think you should launch the servers at different ports.

myfreeweb
+4  A: 

The only thing that stops you from running multiple rails apps on one machine is the ports.

If you want to run several apps while developing just use script/server -p <port number> for each of the apps.

If you have a production machine set up, I would recommend you to use phusion passenger with apache or nginx, and set up different virtual machines (or ports)

Jimmy Stenke
Running separate ports by hand gets unmanageable fast when you have more than one or two projects. Passenger is the solution.
Jonathan Julian
I agree, however, setting up passenger for development projects is a bit overkill. Usually you won't develop on more than one project anyway.
Jimmy Stenke
+1  A: 

Generally you start rails server using webrick or mongrel like

script/server

and

mongrel_rails start

respectively, that starts your server on port 3000 by default, ie. you can access your app on localhost:3000

To have multiple rails apps running on same machine, just start the servers by going to different rails application root directories on different ports like so

script/server -p 3001

or

mongrel_rails start -p 3001

Just for info, if you want to start rails apps in different environments then just pass -e option when you start the server like so

script/server -e production

or

script/server -e test_or_anyotherenv

If you don't give -e option, then it will by default start the server in development environment.

nas
+6  A: 

If you end up using Phusion Passenger, the Passenger Preference Pane can automatically configure your Apache virtual hosts for you. It's a lot easier than editing the Apache configuration and your /etc/hosts file each time you want to set up a new application.

agregoire
Thanks for your infor. The pane seems very useful. I'll try it.
TK
A: 

Initially, I used mongrel on different ports. Works just fine. But, as agregoire mentioned, Phusion Passenger and the Passenger PrefPane make your life so much easier. Checkout Ryan Bates's RailsCast, Passenger in Development, for a good tutorial on setting it up.

ssimmons