I''m trying to set up several different Rails apps on the same domain, each one running Mongrel. After reading all of the documentation, it''s fairly clear how to use subdomains - create several Apache virtual hosts, each of which has a different ProxyPass and ProxyPassReverse command to redirect from different ports (ie, 3000, 3100), and then have each Mongrel instance (or cluster) set to the corresponding port (3000, 3100). [If this theory is incorrect, please let me know!] However, what I''m trying to acheive is to host them all under the same domain. In othe words, I would like to have www.domain.com/app1 www.domain.com/app2 I don''t know how to acheive this. Do I make each of them Virtual Hosts, each with their own ProxyPass? (But I haven''t been able to find any simple documentation online explaining how to set a Virtual Host at www.domain.com/app1 instead of app1.domain.com. I know fairly little about Apache.) I noticed in the Mongrel documentation mention of a --prefix command and I was wondering if that could be used to host multiple apps, but for one it''s not clear how that ties in with Apache, and secondly, the latest version of mongrel_rails doesn''t recognize that command. Any possibilities? Thank you. -- "Impossible is nothing." -------------- next part -------------- An HTML attachment was scrubbed... URL: http://rubyforge.org/pipermail/mongrel-users/attachments/20060907/06d59f5e/attachment.html
On Thu Sep 07, 2006 at 04:06:05PM -0500, zer0halo wrote:> I''m trying to set up several different Rails apps on the same domain, each > one running Mongrel. After reading all of the documentation, it''s fairly > clear how to use subdomains - create several Apache virtual hosts, each of > which has a different ProxyPass and ProxyPassReverse command to redirect > from different ports (ie, 3000, 3100), and then have each Mongrel instance > (or cluster) set to the corresponding port (3000, 3100). [If this theory is > incorrect, please let me know!] > > However, what I''m trying to acheive is to host them all under the same > domain. In othe words, I would like to have > > www.domain.com/app1 > www.domain.com/app2maybe you can hack the mongrel_rails script to setup a rails handler for each app? camping does it this way anyways
if I was smart and knowledgeable enough I''m sure I could :-) but I was hoping for a bit of a simpler solution. Running multiple Rails apps on the same domain is something that in general seems quite tough to do. I think this is an issue that needs resolving by the rails-gods at some point as it could be hindrance to rails growth. Otherwise it''s easy to draw comparisons with PHP where you just stick your apps in different folders under your Document Root (or use symlinks) and voila. Don''t get be wrong, I''m definitely a Rails fan, and this isn''t meant as a Rails vs PHP, but just pointing out something that is quite tricky in Rails - a framework which thrives on simplicity. It seems it should be as (relatively) straightforward as the rest of Rails is. Especially because Rails lends itself to creating little apps that each do their own thing well, but then at some point you want to combine them or mix and match, etc. On 9/7/06, carmen <_ at whats-your.name> wrote:> > On Thu Sep 07, 2006 at 04:06:05PM -0500, zer0halo wrote: > > I''m trying to set up several different Rails apps on the same domain, > each > > one running Mongrel. After reading all of the documentation, it''s fairly > > clear how to use subdomains - create several Apache virtual hosts, each > of > > which has a different ProxyPass and ProxyPassReverse command to redirect > > from different ports (ie, 3000, 3100), and then have each Mongrel > instance > > (or cluster) set to the corresponding port (3000, 3100). [If this theory > is > > incorrect, please let me know!] > > > > However, what I''m trying to acheive is to host them all under the same > > domain. In othe words, I would like to have > > > > www.domain.com/app1 > > www.domain.com/app2 > > maybe you can hack the mongrel_rails script to setup a rails handler for > each app? camping does it this way anyways > _______________________________________________ > Mongrel-users mailing list > Mongrel-users at rubyforge.org > http://rubyforge.org/mailman/listinfo/mongrel-users >-- "Impossible is nothing." -------------- next part -------------- An HTML attachment was scrubbed... URL: http://rubyforge.org/pipermail/mongrel-users/attachments/20060907/8319bff4/attachment.html
I think this is basically how we''re doing it. <Proxy balancer://app1balancer> 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 BalancerMember http://127.0.0.1:6004 </Proxy> <Proxy balancer://app2balancer> BalancerMember http://127.0.0.1:7000 BalancerMember http://127.0.0.1:7001 BalancerMember http://127.0.0.1:7002 BalancerMember http://127.0.0.1:7003 BalancerMember http://127.0.0.1:7004 </Proxy> <VirtualHost *:80> ProxyPass /app1/images ! ProxyPass /app1/stylesheets ! #continue with other static files that should be served by apache ProxyPass /app2/images ! ProxyPass /app2/stylesheets ! #continue with other static files that should be served by apache Alias /app1/images /path/to/public/images Alias /app1/stylesheets /path/to/public/stylesheets #continue with aliases for static content Alias /app2/images /path/to/public/images Alias /app2/stylesheets /path/to/public/stylesheets #continue with aliases for static content ProxyPass /app1 balancer://app1balancer ProxyPass /app2 balancer://app1balancer </VirtualHost> Bryan On Sep 7, 2006, at 4:06 PM, zer0halo wrote:> I''m trying to set up several different Rails apps on the same > domain, each one running Mongrel. After reading all of the > documentation, it''s fairly clear how to use subdomains - create > several Apache virtual hosts, each of which has a different > ProxyPass and ProxyPassReverse command to redirect from different > ports (ie, 3000, 3100), and then have each Mongrel instance (or > cluster) set to the corresponding port (3000, 3100). [If this > theory is incorrect, please let me know!] > > However, what I''m trying to acheive is to host them all under the > same domain. In othe words, I would like to have > > www.domain.com/app1 > www.domain.com/app2 > > I don''t know how to acheive this. Do I make each of them Virtual > Hosts, each with their own ProxyPass? (But I haven''t been able to > find any simple documentation online explaining how to set a > Virtual Host at www.domain.com/app1 instead of app1.domain.com. I > know fairly little about Apache.) > > I noticed in the Mongrel documentation mention of a --prefix > command and I was wondering if that could be used to host multiple > apps, but for one it''s not clear how that ties in with Apache, and > secondly, the latest version of mongrel_rails doesn''t recognize > that command. > > Any possibilities? Thank you. > > -- > "Impossible is nothing." > _______________________________________________ > Mongrel-users mailing list > Mongrel-users at rubyforge.org > http://rubyforge.org/mailman/listinfo/mongrel-users-------------- next part -------------- An HTML attachment was scrubbed... URL: http://rubyforge.org/pipermail/mongrel-users/attachments/20060907/e0dbab61/attachment.html
On Thu Sep 07, 2006 at 04:21:26PM -0500, zer0halo wrote:> if I was smart and knowledgeable enough I''m sure I could :-) > but I was hoping for a bit of a simpler solution. > > Running multiple Rails apps on the same domain is something that in general > seems quite tough to do.its not so much tough, as varying extensively with the terrain (eg, apache, lighttpd, mongrel). im sure therse something on google that can explain how to point subdirs to different local ports, via apache''s mod_proxy. proably even in the rails list archives. at most youll have to set an abstract_uri_root or something inenvironment.rb, on the rails side..> I think this is an issue that needs resolving by > the rails-gods at some point as it could be hindrance to rails growth. > Otherwise it''s easy to draw comparisons with PHP where you just stick your > apps in different folders under your Document Root (or use symlinks) and > voila.that is how it works with camping> Don''t get be wrong, I''m definitely a Rails fan, and this isn''t meant > as a Rails vs PHP, but just pointing out something that is quite tricky in > Rails - a framework which thrives on simplicity.thrives on presenting simplicity to the developer, you mean. thats part of it, but another angle is marketing. django and nitro arent as complex when it comes to ''what do i define in my schema and what do i define in code'' as rails, but somehow they have had exponentially less hype, from my vantage point..
Thanks, Bryan, I tried it and am partway there, but it''s still not working. http://domain/app1/controller/method does run the method and display the view, but the images and stylesheets are not loading (whether or not I have a ProxyPass for the images and stylesheets as you have below - I tried both with and without.) Also all links to other methods fail because .... http://domain/app1/controller redirects me to: http://domain/controller Which gives be an Apache ''page not found'' error. I presume that would be something to fix in routes.rb, but I tried a couple of things and they didn''t work. Thanks for any help. On 9/7/06, Bryan Thompson <bryan at galisys.com> wrote:> > I think this is basically how we''re doing it. > > <Proxy balancer://app1balancer> > 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 > BalancerMember http://127.0.0.1:6004 > </Proxy> > > <Proxy balancer://app2balancer> > BalancerMember http://127.0.0.1:7000 > BalancerMember http://127.0.0.1:7001 > BalancerMember http://127.0.0.1:7002 > BalancerMember http://127.0.0.1:7003 > BalancerMember http://127.0.0.1:7004 > </Proxy> > > <VirtualHost *:80> > ProxyPass /app1/images ! > ProxyPass /app1/stylesheets ! > #continue with other static files that should be served by apache > > ProxyPass /app2/images ! > ProxyPass /app2/stylesheets ! > #continue with other static files that should be served by apache > > Alias /app1/images /path/to/public/images > Alias /app1/stylesheets /path/to/public/stylesheets > #continue with aliases for static content > > Alias /app2/images /path/to/public/images > Alias /app2/stylesheets /path/to/public/stylesheets > #continue with aliases for static content > > ProxyPass /app1 balancer://app1balancer > ProxyPass /app2 balancer://app1balancer > </VirtualHost> > > Bryan > > On Sep 7, 2006, at 4:06 PM, zer0halo wrote: > > I''m trying to set up several different Rails apps on the same domain, each > one running Mongrel. After reading all of the documentation, it''s fairly > clear how to use subdomains - create several Apache virtual hosts, each of > which has a different ProxyPass and ProxyPassReverse command to redirect > from different ports (ie, 3000, 3100), and then have each Mongrel instance > (or cluster) set to the corresponding port (3000, 3100). [If this theory is > incorrect, please let me know!] > > However, what I''m trying to acheive is to host them all under the same > domain. In othe words, I would like to have > > www.domain.com/app1 > www.domain.com/app2 > > I don''t know how to acheive this. Do I make each of them Virtual Hosts, > each with their own ProxyPass? (But I haven''t been able to find any simple > documentation online explaining how to set a Virtual Host at > www.domain.com/app1 instead of app1.domain.com. I know fairly little about > Apache.) > > I noticed in the Mongrel documentation mention of a --prefix command and I > was wondering if that could be used to host multiple apps, but for one it''s > not clear how that ties in with Apache, and secondly, the latest version of > mongrel_rails doesn''t recognize that command. > > Any possibilities? Thank you. > > -- > "Impossible is nothing." > _______________________________________________ > Mongrel-users mailing list > Mongrel-users at rubyforge.org > http://rubyforge.org/mailman/listinfo/mongrel-users > > > _______________________________________________ > Mongrel-users mailing list > Mongrel-users at rubyforge.org > http://rubyforge.org/mailman/listinfo/mongrel-users > >-- "Impossible is nothing." -------------- next part -------------- An HTML attachment was scrubbed... URL: http://rubyforge.org/pipermail/mongrel-users/attachments/20060907/0f26c4f7/attachment-0001.html
Try putting: ActionController::AbstractRequest.relative_url_root = ''/app1'' in your production.rb e. zer0halo wrote:> Thanks, Bryan, I tried it and am partway there, but it''s still not > working. > > http://domain/app1/controller/method > > does run the method and display the view, but the images and > stylesheets are not loading (whether or not I have a ProxyPass for the > images and stylesheets as you have below - I tried both with and > without.) Also all links to other methods fail because .... > > http://domain/app1/controller > > redirects me to: > > http://domain/controller > > Which gives be an Apache ''page not found'' error. > > I presume that would be something to fix in routes.rb, but I tried a > couple of things and they didn''t work. > > Thanks for any help. > > On 9/7/06, * Bryan Thompson* <bryan at galisys.com > <mailto:bryan at galisys.com>> wrote: > > I think this is basically how we''re doing it. > > <Proxy balancer://app1balancer> > 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 > BalancerMember http://127.0.0.1:6004 > </Proxy> > > <Proxy balancer://app2balancer> > BalancerMember http://127.0.0.1:7000 > BalancerMember http://127.0.0.1:7001 > BalancerMember http://127.0.0.1:7002 > > BalancerMember http://127.0.0.1:7003 > BalancerMember http://127.0.0.1:7004 > </Proxy> > > <VirtualHost *:80> > ProxyPass /app1/images ! > ProxyPass /app1/stylesheets ! > #continue with other static files that should be served by apache > > ProxyPass /app2/images ! > ProxyPass /app2/stylesheets ! > #continue with other static files that should be served by apache > > Alias /app1/images /path/to/public/images > Alias /app1/stylesheets /path/to/public/stylesheets > > #continue with aliases for static content > > Alias /app2/images /path/to/public/images > Alias /app2/stylesheets /path/to/public/stylesheets > #continue with aliases for static content > > ProxyPass /app1 balancer://app1balancer > > ProxyPass /app2 balancer://app1balancer > </VirtualHost> > > Bryan > > On Sep 7, 2006, at 4:06 PM, zer0halo wrote: > > I''m trying to set up several different Rails apps on the same > domain, each one running Mongrel. After reading all of the > documentation, it''s fairly clear how to use subdomains - create > several Apache virtual hosts, each of which has a different > ProxyPass and ProxyPassReverse command to redirect from different > ports (ie, 3000, 3100), and then have each Mongrel instance (or > cluster) set to the corresponding port (3000, 3100). [If this > theory is incorrect, please let me know!] > > However, what I''m trying to acheive is to host them all under the > same domain. In othe words, I would like to have > > www.domain.com/app1 <http://www.domain.com/app1> > www.domain.com/app2 <http://www.domain.com/app2> > > I don''t know how to acheive this. Do I make each of them Virtual > Hosts, each with their own ProxyPass? (But I haven''t been able to > find any simple documentation online explaining how to set a > Virtual Host at www.domain.com/app1 <http://www.domain.com/app1> > instead of app1.domain.com <http://app1.domain.com>. I know fairly > little about Apache.) > > I noticed in the Mongrel documentation mention of a --prefix > command and I was wondering if that could be used to host multiple > apps, but for one it''s not clear how that ties in with Apache, and > secondly, the latest version of mongrel_rails doesn''t recognize > that command. > > Any possibilities? Thank you. > > -- > "Impossible is nothing." > _______________________________________________ > Mongrel-users mailing list > Mongrel-users at rubyforge.org <mailto:Mongrel-users at rubyforge.org> > http://rubyforge.org/mailman/listinfo/mongrel-users > > > _______________________________________________ > Mongrel-users mailing list > Mongrel-users at rubyforge.org <mailto:Mongrel-users at rubyforge.org> > http://rubyforge.org/mailman/listinfo/mongrel-users > > > > > -- > "Impossible is nothing." > ------------------------------------------------------------------------ > > _______________________________________________ > Mongrel-users mailing list > Mongrel-users at rubyforge.org > http://rubyforge.org/mailman/listinfo/mongrel-users-------------- next part -------------- An HTML attachment was scrubbed... URL: http://rubyforge.org/pipermail/mongrel-users/attachments/20060907/e9233264/attachment.html
in addition to relative_url_root you need to create a symlink in your application "public" directory like ln -s . app1 after this, static content like images, css etc. will work --Alex On 9/7/06, Eoin Curran <eoin at peelmeagrape.net> wrote:> > Try putting: > ActionController::AbstractRequest.relative_url_root > ''/app1'' > in your production.rb > > e. > > zer0halo wrote: > Thanks, Bryan, I tried it and am partway there, but it''s still not working. > > http://domain/app1/controller/method > > does run the method and display the view, but the images and stylesheets > are not loading (whether or not I have a ProxyPass for the images and > stylesheets as you have below - I tried both with and without.) Also all > links to other methods fail because .... > > http://domain/app1/controller > > redirects me to: > > http://domain/controller > > Which gives be an Apache ''page not found'' error. > > I presume that would be something to fix in routes.rb, but I tried a couple > of things and they didn''t work. > > Thanks for any help. > > > On 9/7/06, Bryan Thompson <bryan at galisys.com> wrote: > > > > > > > > I think this is basically how we''re doing it. > > > > > > <Proxy balancer://app1balancer> > > 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 > > BalancerMember http://127.0.0.1:6004 > > </Proxy> > > > > > > <Proxy balancer://app2balancer> > > BalancerMember http://127.0.0.1:7000 > > BalancerMember http://127.0.0.1:7001 > > BalancerMember http://127.0.0.1:7002 > > > > BalancerMember http://127.0.0.1:7003 > > BalancerMember http://127.0.0.1:7004 > > </Proxy> > > > > > > <VirtualHost *:80> > > ProxyPass /app1/images ! > > ProxyPass /app1/stylesheets ! > > #continue with other static files that should be served by apache > > > > > > ProxyPass /app2/images ! > > ProxyPass /app2/stylesheets ! > > #continue with other static files that should be served by apache > > > > > > Alias /app1/images /path/to/public/images > > Alias /app1/stylesheets /path/to/public/stylesheets > > > > #continue with aliases for static content > > > > > > Alias /app2/images /path/to/public/images > > Alias /app2/stylesheets /path/to/public/stylesheets > > #continue with aliases for static content > > > > > > ProxyPass /app1 balancer://app1balancer > > > > ProxyPass /app2 balancer://app1balancer > > </VirtualHost> > > > > > > > > Bryan > > > > > > > > On Sep 7, 2006, at 4:06 PM, zer0halo wrote: > > > > I''m trying to set up several different Rails apps on the same domain, each > one running Mongrel. After reading all of the documentation, it''s fairly > clear how to use subdomains - create several Apache virtual hosts, each of > which has a different ProxyPass and ProxyPassReverse command to redirect > from different ports (ie, 3000, 3100), and then have each Mongrel instance > (or cluster) set to the corresponding port (3000, 3100). [If this theory is > incorrect, please let me know!] > > > > However, what I''m trying to acheive is to host them all under the same > domain. In othe words, I would like to have > > > > www.domain.com/app1 > > www.domain.com/app2 > > > > I don''t know how to acheive this. Do I make each of them Virtual Hosts, > each with their own ProxyPass? (But I haven''t been able to find any simple > documentation online explaining how to set a Virtual Host at > www.domain.com/app1 instead of app1.domain.com. I know fairly little about > Apache.) > > > > I noticed in the Mongrel documentation mention of a --prefix command and I > was wondering if that could be used to host multiple apps, but for one it''s > not clear how that ties in with Apache, and secondly, the latest version of > mongrel_rails doesn''t recognize that command. > > > > Any possibilities? Thank you. > > > > -- > > "Impossible is nothing." > > > > _______________________________________________ > > Mongrel-users mailing list > > Mongrel-users at rubyforge.org > > http://rubyforge.org/mailman/listinfo/mongrel-users > > > > _______________________________________________ > > Mongrel-users mailing list > > Mongrel-users at rubyforge.org > > http://rubyforge.org/mailman/listinfo/mongrel-users > > > > > > > > -- > "Impossible is nothing." ________________________________ > > _______________________________________________ > Mongrel-users mailing list > Mongrel-users at rubyforge.org > http://rubyforge.org/mailman/listinfo/mongrel-users > > > _______________________________________________ > Mongrel-users mailing list > Mongrel-users at rubyforge.org > http://rubyforge.org/mailman/listinfo/mongrel-users > >
Thanks, everyone for trying to help me solve this. I tried both Alex''s and Eoin''s changes, but alas to no avail. After applying Eoin''s addition to environment.rb, the URL http://domain/app1 does correctly redirect to the default controller and method: http://domain/app1/items/index however when method ''items'' redirects to method ''list'', the output is http://domain/items/list (no app1) which sends the app into an endless loop. I keep getting the feeling the solution is somehow in routes.rb, but I don''t know what. My routes.rb is very simple. The root route is: map.connect '''', :controller => ''items'' default route is the usual: map.connect '':controller/:action/:id'' (I thought maybe changing the default route to map.connect''/app1/:controller/:action/:id'' would work, but it gives a "recognition failed" error. -- "Impossible is nothing." -------------- next part -------------- An HTML attachment was scrubbed... URL: http://rubyforge.org/pipermail/mongrel-users/attachments/20060907/e3ebf8c9/attachment.html
hi, I''ve missed parts of this conversation, but I can tell you: 1. in config/routes.rb insert line ActionController::AbstractRequest.relative_url_root = "/app1" 2. create a symlink in app1 "public": ln -s . app1 3. start mongrel or webrick ruby script/server OR mongrel_rails start -p 3000 4. connect directly to the server (without proxy) and test your application http://domain:3000/app1/ I''m 100% sure it will work have fun! --Alex On 9/7/06, zer0halo <zerohalo at gmail.com> wrote:> Thanks, everyone for trying to help me solve this. I tried both Alex''s and > Eoin''s changes, but alas to no avail. > > After applying Eoin''s addition to environment.rb, the URL > > http://domain/app1 > > does correctly redirect to the default controller and method: > > http://domain/app1/items/index > > however when method ''items'' redirects to method ''list'', the output is > > http://domain/items/list > > (no app1) > > which sends the app into an endless loop. > > I keep getting the feeling the solution is somehow in routes.rb, but I don''t > know what. My routes.rb is very simple. The root route is: > > map.connect '''', :controller => ''items'' > > default route is the usual: > > map.connect '':controller/:action/:id'' > > (I thought maybe changing the default route to map.connect > ''/app1/:controller/:action/:id'' would work, but it gives a "recognition > failed" error. > > > -- > "Impossible is nothing." > _______________________________________________ > Mongrel-users mailing list > Mongrel-users at rubyforge.org > http://rubyforge.org/mailman/listinfo/mongrel-users > >
On 9/7/06, zer0halo <zerohalo at gmail.com> wrote:> > if I was smart and knowledgeable enough I''m sure I could :-) > but I was hoping for a bit of a simpler solution. >One possibility that no one else seems to have mentioned yet is the `--prefix'' option that''s coming out in the 0.3.13.4 release [1]. I''m using this successfully to run multiple apps under a single domain with no modifications to Rails code. HTH, /Nick [1] http://mongrel.rubyforge.org/docs/howto.html -------------- next part -------------- An HTML attachment was scrubbed... URL: http://rubyforge.org/pipermail/mongrel-users/attachments/20060908/496dd1a3/attachment.html
On 9/7/06, Alexander Kabanov <shurikk at gmail.com> wrote:> > > 1. in config/routes.rb insert line > ActionController::AbstractRequest.relative_url_root = "/app1" > > 2. create a symlink in app1 "public": ln -s . app1 > > 3. start mongrel or webrick > ruby script/server OR > mongrel_rails start -p 3000 > > 4. connect directly to the server (without proxy) and test your > application > http://domain:3000/app1/ > > I''m 100% sure it will work > >Thanks, Alex. I tried the above and it does work. If I point to http://domain:3000/app1, my app works perfectly. However, when I turn on the ProxyPass in Apache to port 80, and then point to http://domain/app1 The app goes into an endless loop. Checking the logs, my app is initially correctly being routed to my default controller and method (ie: http://domain/app1/items/index). However when method ''items'' redirects to method ''view_list'', the application routes to: http://domain/items/view_list So basically it''s not applying the /app1 prefix to all redirects. Here''s a log excerpt when I access my app1 home page (just relevent lines): Processing ItemsController#index (for 172.27.6.134 at 2006-09-08 09:55:10) [GET] Parameters: {"action"=>"index", "controller"=>"items"} <snip> Redirected to http://domain/app1/items/view_list Completed in 0.03146 (31 reqs/sec) | DB: 0.00549 (17%) | 302 Found [ http://domain/items/view_list] As you can see, the last line is the problem - no app1 So it seems I''m still missing a step. My settings in my apache conf are simple: <VirtualHost *> DocumentRoot /var/www # the usual other settings <snip> ProxyPass /app1 http://localhost:3000 ProxyPassReverse /app1 http://localhost:3000 ProxyPreserveHost on </VirtualHost> What am I still missing? -- "Impossible is nothing." -------------- next part -------------- An HTML attachment was scrubbed... URL: http://rubyforge.org/pipermail/mongrel-users/attachments/20060908/987d0cad/attachment.html
On Fri, 2006-09-08 at 09:17 -0500, Nick Sieger wrote:> On 9/7/06, zer0halo <zerohalo at gmail.com> wrote: > if I was smart and knowledgeable enough I''m sure I could :-) > but I was hoping for a bit of a simpler solution. > > One possibility that no one else seems to have mentioned yet is the > `--prefix'' option that''s coming out in the 0.3.13.4 release [1]. I''m > using this successfully to run multiple apps under a single domain > with no modifications to Rails code. > > HTH, > > /Nick > > [1] http://mongrel.rubyforge.org/docs/howto.htmlQuick correction Nick, you don''t need to modify Rails code as long as you slavishly utilize all the URL related helpers (like link_to()). If you had any hand coded links then those will have to change. -- Zed A. Shaw http://www.zedshaw.com/ http://mongrel.rubyforge.org/ http://www.lingr.com/room/3yXhqKbfPy8 -- Come get help.
On 9/8/06, Zed Shaw <zedshaw at zedshaw.com> wrote:> > > One possibility that no one else seems to have mentioned yet is the > > `--prefix'' option that''s coming out in the 0.3.13.4 release [1]. I''m > > using this successfully to run multiple apps under a single domain > > with no modifications to Rails code. > > > > HTH, > > > > /Nick > > > > [1] http://mongrel.rubyforge.org/docs/howto.html > > Quick correction Nick, you don''t need to modify Rails code as long as > you slavishly utilize all the URL related helpers (like link_to()). If > you had any hand coded links then those will have to change. > > >Zed, first off, thanks for writing/releasing mongrel. Terrific app -- filled a dire need. I had read the How-To page and thought of the --prefix option, but I have the latest mongrel gem install (just did and update now to be sure) and it doesn''t recognize the --prefix option or list i with start -h. If I can get the --prefix command working (I guess with the next release?), what does Apache need in that case? To summarize this thread, I''m trying to run multiple rails apps, each running their own instance of mongrel (or cluster), on the same domain, ie. http://domain/app1, http://domain/app2. I''ve been told to use ProxyPass in Apache to redirect from the mongrel port (ie, 3000) to port 80, but as you can see from the thread, it''s not working. -- "Impossible is nothing." -------------- next part -------------- An HTML attachment was scrubbed... URL: http://rubyforge.org/pipermail/mongrel-users/attachments/20060908/b652d6b2/attachment-0001.html
On 9/8/06, Zed Shaw <zedshaw at zedshaw.com> wrote:> > > Quick correction Nick, you don''t need to modify Rails code as long as > you slavishly utilize all the URL related helpers (like link_to()). If > you had any hand coded links then those will have to change.Thanks for the clarification, it''s good to be aware of that point. /Nick -------------- next part -------------- An HTML attachment was scrubbed... URL: http://rubyforge.org/pipermail/mongrel-users/attachments/20060908/70a00313/attachment.html
On Fri, 2006-09-08 at 10:26 -0500, zer0halo wrote:>> > Zed, first off, thanks for writing/releasing mongrel. Terrific app -- > filled a dire need. > > I had read the How-To page and thought of the --prefix option, but I > have the latest mongrel gem install (just did and update now to be > sure) and it doesn''t recognize the --prefix option or list i with > start -h. >Yeah, you need the pre-release, which was going to get released as official but I decided to try and fix up the naming clashes for people first. You can install the pre-release with: gem install mongrel --source=http://mongrel.rubyforge.org/releases/ And it''s not built for win32 yet.> If I can get the --prefix command working (I guess with the next > release?), what does Apache need in that case? To summarize this > thread, I''m trying to run multiple rails apps, each running their own > instance of mongrel (or cluster), on the same domain, ie. > http://domain/app1, http://domain/app2. I''ve been told to use > ProxyPass in Apache to redirect from the mongrel port (ie, 3000) to > port 80, but as you can see from the thread, it''s not working.I believe that you just have to make sure the URI path (/app2/controller/action) gets passed back to the mongrel server as-is. Don''t rewrite it, just route it. If you''re not sure what apache is sending mongrel, run one mongrel with -B and go look at the log/mongrel_debug/files.log and log/mongrel_debug/rails.log for clues. -- Zed A. Shaw http://www.zedshaw.com/ http://mongrel.rubyforge.org/ http://www.lingr.com/room/3yXhqKbfPy8 -- Come get help.
On 9/8/06, Zed Shaw <zedshaw at zedshaw.com> wrote:> > You can install the pre-release with: > > gem install mongrel --source=http://mongrel.rubyforge.org/releases/Got it. Tx. --prefix works now in that I can run by app at: http://domain:3000/app1 without any change in routes.rb However, the Apache part still doesn''t work. If I go to http://domain/app1, I get nothing (no error, just blank). My log/development.log is empty which means that Rails isn''t even getting that far. I believe that you just have to make sure the URI path> (/app2/controller/action) gets passed back to the mongrel server as-is. > Don''t rewrite it, just route it.I''m afraid you lost me here. How do I do that? If you''re not sure what apache is sending mongrel, run one mongrel with> -B and go look at the log/mongrel_debug/files.log and > log/mongrel_debug/rails.log for clues.I checked the logs and the REQUEST_PATH and PATH_INFO are both logged as /controller/action. I''m assmuing it should be /app1/controller/action, and that''s the problem, but I don''t know how to fix that. How? -- "Impossible is nothing." -------------- next part -------------- An HTML attachment was scrubbed... URL: http://rubyforge.org/pipermail/mongrel-users/attachments/20060908/d5fae4fe/attachment.html
ProxyPass /app1 http://127.0.0.1:3000/app1 ProxyPassReverse /app1 http://127.0.0.1:3000/app1 You need to have the proxy pass the new directory name. Now if only I could figure out how to get Apache 1.3.x to accept: ProxyPass /app/javascripts ! 1.3 doesn''t like the !... On 9/8/06, zer0halo <zerohalo at gmail.com> wrote:> > > On 9/8/06, Zed Shaw <zedshaw at zedshaw.com> wrote: > > You can install the pre-release with: > > > > gem install mongrel > --source=http://mongrel.rubyforge.org/releases/ > > Got it. Tx. --prefix works now in that I can run by app at: > > http://domain:3000/app1 > > without any change in routes.rb > > However, the Apache part still doesn''t work. If I go to http://domain/app1 , > I get nothing (no error, just blank). My log/development.log is empty which > means that Rails isn''t even getting that far. > > > I believe that you just have to make sure the URI path > > (/app2/controller/action) gets passed back to the mongrel server as-is. > > Don''t rewrite it, just route it. > > I''m afraid you lost me here. How do I do that? > > > If you''re not sure what apache is sending mongrel, run one mongrel with > > -B and go look at the log/mongrel_debug/files.log and > > log/mongrel_debug/rails.log for clues. > > I checked the logs and the REQUEST_PATH and PATH_INFO are both logged as > /controller/action. I''m assmuing it should be /app1/controller/action, and > that''s the problem, but I don''t know how to fix that. How? > > > > -- > "Impossible is nothing." > _______________________________________________ > Mongrel-users mailing list > Mongrel-users at rubyforge.org > http://rubyforge.org/mailman/listinfo/mongrel-users > >
On 9/8/06, Joey Geiger <jgeiger at gmail.com> wrote:> > ProxyPass /app1 http://127.0.0.1:3000/app1 > ProxyPassReverse /app1 http://127.0.0.1:3000/app1 > > You need to have the proxy pass the new directory name. >Victory! That was the missing piece. I had my ProxyPass as localhost:3000 instead of localhost:3000/app1. Zed, I guess that''s what you meant earlier -- sorry, I''m not that smart and didn''t catch it the first time around. I think it would be very helpful to have a how-to on this in the Mongrel documentation (or at least the Rails Wiki -- I''ll try to add a page there), for the sake of other poor souls. The solution was simple, but like with many things in Rails, for those of us not "in the know" it''s not always obvious. As a side comment, it would be great if someone wrote a book on Rails deployment, as that seems to stump a lot of people (including a long-time PHP coder friend of mine who I convinced to try Rails, which he did and found the "joy of development" but also experienced the "pain of deployment"), and is a stumbling-block to Rails adoption. There is info out there but it takes a lot of digging, googling, asking on mailing lists, etc. Some solid documentation covering various platforms and situations would be a God-send, I think. Thanks very much to all on this list who helped me with this. -- "Impossible is nothing." -------------- next part -------------- An HTML attachment was scrubbed... URL: http://rubyforge.org/pipermail/mongrel-users/attachments/20060908/fd989ccd/attachment-0001.html
I starred this conversation so that I would remember to add it to the Apache best practices documentation I wrote for mongrel. Consider it done (soon). http://mongrel.rubyforge.org/docs/apache.html I am waiting for pre-release to go live before adding prefix related information to the page, though. As for your books on deployment, Ezra and Zed may have you covered here soon. On 9/8/06, zer0halo <zerohalo at gmail.com> wrote:> On 9/8/06, Joey Geiger <jgeiger at gmail.com> wrote: > > ProxyPass /app1 http://127.0.0.1:3000/app1 > > ProxyPassReverse /app1 http://127.0.0.1:3000/app1 > > > > You need to have the proxy pass the new directory name. > > > > Victory! That was the missing piece. I had my ProxyPass as localhost:3000 > instead of localhost:3000/app1. Zed, I guess that''s what you meant earlier > -- sorry, I''m not that smart and didn''t catch it the first time around. > > I think it would be very helpful to have a how-to on this in the Mongrel > documentation (or at least the Rails Wiki -- I''ll try to add a page there), > for the sake of other poor souls. The solution was simple, but like with > many things in Rails, for those of us not "in the know" it''s not always > obvious. > > As a side comment, it would be great if someone wrote a book on Rails > deployment, as that seems to stump a lot of people (including a long-time > PHP coder friend of mine who I convinced to try Rails, which he did and > found the "joy of development" but also experienced the "pain of > deployment"), and is a stumbling-block to Rails adoption. There is info out > there but it takes a lot of digging, googling, asking on mailing lists, etc. > Some solid documentation covering various platforms and situations would be > a God-send, I think. > > Thanks very much to all on this list who helped me with this. > > -- > "Impossible is nothing." > _______________________________________________ > Mongrel-users mailing list > Mongrel-users at rubyforge.org > http://rubyforge.org/mailman/listinfo/mongrel-users > >-- Charles Brian Quinn self-promotion: www.seebq.com highgroove studios: www.highgroove.com slingshot hosting: www.slingshothosting.com
On 9/8/06, Charles Brian Quinn <me at seebq.com> wrote:> > I starred this conversation so that I would remember to add it to the > Apache best practices documentation I wrote for mongrel. Consider it > done (soon). > > http://mongrel.rubyforge.org/docs/apache.html > >Awesome! -- "Impossible is nothing." -------------- next part -------------- An HTML attachment was scrubbed... URL: http://rubyforge.org/pipermail/mongrel-users/attachments/20060908/3e22bc51/attachment.html
Hi All, On 9/8/06, Charles Brian Quinn <me at seebq.com> wrote:> > I starred this conversation so that I would remember to add it to the > Apache best practices documentation I wrote for mongrel. Consider it > done (soon). > > http://mongrel.rubyforge.org/docs/apache.html > > I am waiting for pre-release to go live before adding prefix related > information to the page, though. > > As for your books on deployment, Ezra and Zed may have you covered here > soon. > > On 9/8/06, zer0halo <zerohalo at gmail.com> wrote: > > On 9/8/06, Joey Geiger <jgeiger at gmail.com> wrote: > > > ProxyPass /app1 http://127.0.0.1:3000/app1 > > > ProxyPassReverse /app1 http://127.0.0.1:3000/app1 > > > > > As a side comment, it would be great if someone wrote a book on Rails > > deployment, as that seems to stump a lot of people (including a > long-time > > PHP coder friend of mine who I convinced to try Rails, which he did and > > found the "joy of development" but also experienced the "pain of > > deployment"), and is a stumbling-block to Rails adoption. There is info > out > > there but it takes a lot of digging, googling, asking on mailing lists, > etc. > > Some solid documentation covering various platforms and situations would > be > > a God-send, I think. > > > > Thanks very much to all on this list who helped me with this. > > > > -- >Not sure what topics Ezra and others are gonna cover in their books on Rails deployment, but it appears that there isn''t a lot of people who grok Apache deployment issues. I hope that Ezra and others will take the challenge of the following quote from http://mongrel.rubyforge.org/docs/apache.html "These instructions by Philip Hallstrom should get you started, but refer to the Apache folks for anything more complex or weird." BR, ~A -------------- next part -------------- An HTML attachment was scrubbed... URL: http://rubyforge.org/pipermail/mongrel-users/attachments/20060908/e910c9c7/attachment.html