Tony Rose
2007-Jan-30 10:46 UTC
[Mongrel] Update for thread: Multiple rails apps with Mongrel
Hi, I found another way to throw multiple rails apps under a single domain like: http://www.domain.com/app1 http://www.domain.com/app2 changes here... http://tonyrose023.blogspot.com/2007/01/multiple-rails-apps-with- mongrel.html Tony
Josh Richard
2007-Jan-30 20:39 UTC
[Mongrel] Update for thread: Multiple rails apps with Mongrel
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 Thanks to all involved with Mongrel. Hi Tony, This appears to clear up a lot of issues I have regarding how to setup a box with the configuration below. Thanks. That being said, I have a question. About my deployment: Debian, Apache 2.2, Mongrel Cluster 0.2.1 (3 mongrels per app), mongrel 1.0.1. At this time, I have a test app lives in /var/www/rails/app1 I am able to see the app1 configuring mongrel with the --prefix options following your instructions. However, I can not see the /images directories since the code has references to /images/foo.png I suspect the issue is with Apache. In the apache config I have an /images alias: Alias /images /var/www/rails/app1/current/public/images I also have a /stylesheets alias which appears to be working. There was talk in the list: http://rubyforge.org/pipermail/mongrel-users/2006-September/001534.html this does not seem right given the fact I am using mongrel_cluster. I could easily change the links, and image references but that seems kludgy. My goal here is to not break the ''mongrel_rails start'' development feature from the local copy and have the deployment enviroment (Apache) handle the site specific stuff. I am confused between using ProxyPass or a rewrite rule given this deployment. Any help you can provide would be appreciated. Thanks everyone! Regards, Josh Richard University of Minnesota Duluth, MN USA Tony Rose wrote:> Hi, > > I found another way to throw multiple rails apps under a single > domain like: > > http://www.domain.com/app1 > http://www.domain.com/app2 > > changes here... > > http://tonyrose023.blogspot.com/2007/01/multiple-rails-apps-with- > mongrel.html > > Tony > _______________________________________________ > Mongrel-users mailing list > Mongrel-users at rubyforge.org > http://rubyforge.org/mailman/listinfo/mongrel-users-----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.6 (GNU/Linux) iD8DBQFFv60YtK+gf29TyJQRAizlAJ9OyKqexTrJwjBF+wcW6FPkdmJI2ACfbXhO 7JP9oeJ2kFE1SAriYZu0k28=5Rgr -----END PGP SIGNATURE-----
Tony Rose
2007-Jan-31 05:01 UTC
[Mongrel] Update for thread: Multiple rails apps with Mongrel
Josh, You caught me, I forgot to document one step that I did... since my document root for my domain is: /var/www/html/ For each of the apps, I had to make a symlink from that apps public directory to my document root directory... and then the /images and / stylesheets loaded as I needed them to, and works as you would expect it to when you deploy changes to current... --> ln -s /var/www/rails/app1/current/public /var/www/html/app1 I''ll update my blog post now! Thanks for catching it. Tony On Jan 30, 2007, at 4:15 PM, mongrel-users-request at rubyforge.org wrote:> Thanks to all involved with Mongrel. > > Hi Tony, > > This appears to clear up a lot of issues I have regarding how to > setup a > box with the configuration below. Thanks. That being said, I have a > question. > > About my deployment: > Debian, Apache 2.2, Mongrel Cluster 0.2.1 (3 mongrels per app), > mongrel > 1.0.1. At this time, I have a test app lives in /var/www/rails/app1 > > I am able to see the app1 configuring mongrel with the --prefix > options > following your instructions. However, I can not see the /images > directories since the code has references to /images/foo.png > > I suspect the issue is with Apache. In the apache config I have an > /images alias: > > Alias /images /var/www/rails/app1/current/public/images > > I also have a /stylesheets alias which appears to be working. > > There was talk in the list: > http://rubyforge.org/pipermail/mongrel-users/2006-September/ > 001534.html > this does not seem right given the fact I am using mongrel_cluster. > > I could easily change the links, and image references but that seems > kludgy. My goal here is to not break the ''mongrel_rails start'' > development feature from the local copy and have the deployment > enviroment (Apache) handle the site specific stuff. > > I am confused between using ProxyPass or a rewrite rule given this > deployment. Any help you can provide would be appreciated. > > Thanks everyone! > > Regards, > > Josh Richard > University of Minnesota Duluth, MN USA > > Tony Rose wrote: >> Hi, >> >> I found another way to throw multiple rails apps under a single >> domain like: >> >> http://www.domain.com/app1 >> http://www.domain.com/app2 >> >> changes here... >> >> http://tonyrose023.blogspot.com/2007/01/multiple-rails-apps-with- >> mongrel.html >> >> Tony >> _______________________________________________ >> 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/20070130/7905bef6/attachment.html
Josh Richard
2007-Jan-31 19:37 UTC
[Mongrel] Update for thread: Multiple rails apps with Mongrel
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 Tony Rose wrote:> Josh, > > You caught me, I forgot to document one step that I did... since my > document root for my domain is: > > /var/www/html/ > > For each of the apps, I had to make a symlink from that apps public > directory to my document root directory... and then the /images and > /stylesheets loaded as I needed them to, and works as you would expect > it to when you deploy changes to current... > > --> ln -s /var/www/rails/app1/current/public /var/www/html/app1 > > I''ll update my blog post now! Thanks for catching it. > > Tony >No problem. I am still experiencing the issue after the symlink. However, I think I figured this out and wanted to reiterate findings as this may be useful to someone else tackling this issue. Here are some specifics: In a html file I have a static link as such: <img src="/images/foo.png"/> - From mongrel_rails start, I can see the image under: http://localhost:3000/images/foo.png I deploy the app using capistrano the site is under: http://server/app which put the new URL to the image: http://server/app/images/foo.png Kaboom. The symlink does not work for the images since they are still one directory down. What is interesting is the stylesheets have _always_ worked: <link href="/app/stylesheets/main.css?1170289309" media="all" rel="Stylesheet" type="text/css" /> and are generated by the <%= stylesheet_link_tag "main", :media => "all" %> call to ERB. This was the key! For each image link or URL reference in my site (not that many really), I modified the static links to use img_tag and link_to in ERB as: <%= image_tag(''foo'') %><br> <%= link_to ''Home'', :action => "list" %> This makes sense as image_tag assumes a path images relative to the root of the project. Since mongrel is running with the --prefix of app everything happens as expected and we have: in mongrel_rails start: http://localhost:3000/images/foo.png after deployment with capistrano: http://server/app/images/foo.png I am not sure the symlink is the right recommendation as this could be fixed by allowing ERB to generate URLS. I was able to find supportive evidence in the agile web development with rails skateboarding book, p 41. Thanks again. Josh Richard University of Minnesota Duluth -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.6 (GNU/Linux) iD8DBQFFwO/jtK+gf29TyJQRAqRcAKDVHQWx7Jqq12f8FXI3Xxa6osVpxwCglBni tfz7q+Iyu9s5hQq2bBe7hxw=LTC6 -----END PGP SIGNATURE-----