johnmcauley-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org
2007-Sep-26 15:10 UTC
One server with two rails applications
Hello all, I have one machine and two ruby applications, app1 and app2. Currently, I have an Apache server and a mongrel server. Apache runs on port 80 and proxies to mongrel on port 3001, which runs app1. But I wish to run both applications on the one machine. There is documentation that suggests clustering. But each application will need it''s own URL, http://localhost/app1 and http://localhost/app2. Can anyone direct me on how to do this? Thanks, j --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
johnmcauley-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org wrote:> Hello all, > > I have one machine and two ruby applications, app1 and app2. > Currently, I have an Apache server and a mongrel server. Apache runs > on port 80 and proxies to mongrel on port 3001, which runs app1. But > I wish to run both applications on the one machine. There is > documentation that suggests clustering. But each application will > need it''s own URL, http://localhost/app1 and http://localhost/app2. > Can anyone direct me on how to do this? >Apache rewrite rules that rewrites urls matching /app1 to the balancer (or the single instance if you''re not using mod_proxy_balancer) for the first mongrel and similarly for the second ? Fred -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
On 26-Sep-07, at 11:37 AM, Frederick Cheung wrote:> > johnmcauley-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org wrote: >> Hello all, >> >> I have one machine and two ruby applications, app1 and app2. >> Currently, I have an Apache server and a mongrel server. Apache runs >> on port 80 and proxies to mongrel on port 3001, which runs app1. But >> I wish to run both applications on the one machine. There is >> documentation that suggests clustering. But each application will >> need it''s own URL, http://localhost/app1 and http://localhost/app2. >> Can anyone direct me on how to do this? >> > > Apache rewrite rules that rewrites urls matching /app1 to the balancer > (or the single instance if you''re not using mod_proxy_balancer) for > the > first mongrel and similarly for the second ? > > FredJohn - you''re gonna want to look into virtual hosts. Virtual hosts allow you to serve multiple sites from one IP address. Here''s a sample server_one.com vhost. Sending server_one.com requests to a cluster of 4 mongrels- Duplicate it, and change for a second to answer on the same ip. Not the below may need some more params to work plus the correct mods installed. <VirtualHost www.server_one.com:80> ServerName www. server_one.com ServerAlias www. server_one.com server_one.com DocumentRoot /var/www/apps/server_one/current/public <Proxy balancer://server_one_cluster> BalancerMember http://127.0.0.1:6000 BalancerMember http://127.0.0.1:6001 BalancerMember http://127.0.0.1:6002 BalancerMember http://127.0.0.1:6003 </Proxy> </VirtualHost> Jodi --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
On 9/26/07, Frederick Cheung <rails-mailing-list-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org> wrote:> > Apache rewrite rules that rewrites urls matching /app1But neither app1 nor app2 will have URLs like that by default. How do you configure Rails to prepend "/app1" to every URL that it creates? -- Hassan Schroeder ------------------------ hassan.schroeder-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Try this guide for full setup of Apache (with virtual hosts) and a mongrel cluster. http://blog.codahale.com/2006/06/19/time-for-a-grown-up-server-rails-mongrel-apache-capistrano-and-you/ Helzer --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Hassan Schroeder wrote:> On 9/26/07, Frederick Cheung <rails-mailing-list-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org> wrote: >> >> Apache rewrite rules that rewrites urls matching /app1 > > But neither app1 nor app2 will have URLs like that by default. > > How do you configure Rails to prepend "/app1" to every URL that it > creates? >You could fix that with routing I think. Or you could go the virtual host way (my preference) Fred -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
On 9/26/07, Frederick Cheung <rails-mailing-list-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org> wrote:> > > How do you configure Rails to prepend "/app1" to every URL that it > > creates? > > > You could fix that with routing I think.? Can you be more explicit?> Or you could go the virtual host way (my preference)But that''s not what the OP asked for. And for future reference I''d also like to know if it''s possible... -- Hassan Schroeder ------------------------ hassan.schroeder-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
I changed map.connect '':controller/:action/:id'' to map.connect ''foo/:controller/:action/:id'' and restarted the server. See also http://greg.agiletortoise.com/2006/08/23/set-base-path-for-rails-app/ Fred -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
On 9/26/07, Frederick Cheung <rails-mailing-list-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org> wrote:> > I changed map.connect '':controller/:action/:id'' to > map.connect ''foo/:controller/:action/:id'' > and restarted the server. > > See also > http://greg.agiletortoise.com/2006/08/23/set-base-path-for-rails-app/Both good info, thanks! -- Hassan Schroeder ------------------------ hassan.schroeder-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
johnmcauley-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org
2007-Sep-28 14:35 UTC
Re: One server with two rails applications
If you choose this approach you are, as far as I can gather, forced to change all your hrefs & forms in the applications to mimic this sort of set up. I.e application: test, controller: teams, action: list URL: http://localhost/test/teams/list But it is quite a job to rename all the URLs in the application. Is there another way around this? On Sep 26, 5:07 pm, "Hassan Schroeder" <hassan.schroe...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> On 9/26/07, Frederick Cheung <rails-mailing-l...-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org> wrote: > > > > > I changed map.connect '':controller/:action/:id'' to > > map.connect ''foo/:controller/:action/:id'' > > and restarted the server. > > > See also > >http://greg.agiletortoise.com/2006/08/23/set-base-path-for-rails-app/ > > Both good info, thanks! > > -- > Hassan Schroeder ------------------------ hassan.schroe...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org--~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
On 28 Sep 2007, at 15:35, johnmcauley-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org wrote:> > If you choose this approach you are, as far as I can gather, forced to > change all your hrefs & forms in the applications to mimic this sort > of set up. > I.e application: test, controller: teams, action: list > URL: http://localhost/test/teams/list > But it is quite a job to rename all the URLs in the application. > > Is there another way around this?Setting the routes as I did should automatically prepend test/ to urls generated from url_for (or the things that use it (form_tag/for, link_to etc...); at least it did when I tried it. Fred> > On Sep 26, 5:07 pm, "Hassan Schroeder" <hassan.schroe...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> > wrote: >> On 9/26/07, Frederick Cheung <rails-mailing-l...-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org> >> wrote: >> >> >> >>> I changed map.connect '':controller/:action/:id'' to >>> map.connect ''foo/:controller/:action/:id'' >>> and restarted the server. >> >>> See also >>> http://greg.agiletortoise.com/2006/08/23/set-base-path-for-rails- >>> app/ >> >> Both good info, thanks! >> >> -- >> Hassan Schroeder ------------------------ hassan.schroe...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org > > > >--~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
I use this setup, just pass --prefix=/app1 or --prefix=/app2 into mongrel. The only changes you will need to make are image urls in your stylesheets. On Sep 28, 8:39 am, Frederick Cheung <frederick.che...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> On 28 Sep 2007, at 15:35, johnmcau...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org wrote: > > > > > If you choose this approach you are, as far as I can gather, forced to > > change all your hrefs & forms in the applications to mimic this sort > > of set up. > > I.e application: test, controller: teams, action: list > > URL:http://localhost/test/teams/list > > But it is quite a job to rename all the URLs in the application. > > > Is there another way around this? > > Setting the routes as I did should automatically prepend test/ to > urls generated from url_for (or the things that use it (form_tag/for, > link_to etc...); at least it did when I tried it. > > Fred > > > > > On Sep 26, 5:07 pm, "Hassan Schroeder" <hassan.schroe...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> > > wrote: > >> On 9/26/07, Frederick Cheung <rails-mailing-l...-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org> > >> wrote: > > >>> I changed map.connect '':controller/:action/:id'' to > >>> map.connect ''foo/:controller/:action/:id'' > >>> and restarted the server. > > >>> See also > >>>http://greg.agiletortoise.com/2006/08/23/set-base-path-for-rails- > >>> app/ > > >> Both good info, thanks! > > >> -- > >> Hassan Schroeder ------------------------ hassan.schroe...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org--~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---