<div dir="ltr">Maybe better to use nginx with it's backends instead of Apache? Or it's not possible in your situation?<br></div><div class="gmail_extra"><br><br><div class="gmail_quote">2013/9/18 Juan José 'Peco' San Martín <span dir="ltr"><<a href="mailto:jsanmartin@gmail.com" target="_blank">jsanmartin@gmail.com</a>></span><br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div><div><br></div><div>What Pedro said works joining multiple apps in one. <a href="http://search.cpan.org/~xsawyerx/Dancer2-0.09/lib/Dancer2/Cookbook.pod#Running_multiple_apps_with_Plack::Builder" target="_blank">More info here.</a> Thank you!<br>
<br><span lang="en"><span>I have</span> <span>some issues with</span> <span>how</span> <span>each application</span> <span>locates</span> <span>resources</span><span>.</span> <span>It seems that both </span><span>are using the same</span> <span>paths for</span> <span>libraries</span> <span>or views</span><span>.</span></span><br>
<br></div><div>Suppose the next structure:<br><br></div><div>pathX<br></div><div> |__app1<br></div><div> |__app2 <br><br></div><div>cd pathX<br><br></div><div><i>plackup -a app.psgi </i><br>Error while loading pathX/app.psgi: Can't locate App1.pm in @INC ....<br>
<br></div><div><i>plackup -I app1/lib -I app2/lib app.psgi </i><br>Route exception: pathX/views/<a href="http://index.tt" target="_blank">index.tt</a> is not a regular file or reference...<br><br></div>How can I establish different environments (and paths) for each app?.<br>
<br>Although this could be very useful, it's not the best solution when you want to keep one server with multiple and isolated apps (of different developers/teams).<br><br>Anyway, thank you!.</div></div><div class="gmail_extra">
<br><br><div class="gmail_quote">2013/9/18 Pedro Melo <span dir="ltr"><<a href="mailto:melo@simplicidade.org" target="_blank">melo@simplicidade.org</a>></span><br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div><div class="h5">
<div dir="ltr">Hi,<div class="gmail_extra"><br><div class="gmail_quote"><div>On Tue, Sep 17, 2013 at 10:36 AM, Juan José 'Peco' San Martín <span dir="ltr"><<a href="mailto:jsanmartin@gmail.com" target="_blank">jsanmartin@gmail.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div><div><div>I have 2 different Dancer apps (app1 and app2). Each one working very well on different servers under Apache and Plack::Handler::Apache2.<br>
</div><br></div>Now, I would like put both applications in just one server, so I adjusted the Apache config just adding the two Location sections.</div>
<br><div>If I use the first app, everything works, but when I try the second one, it seems that Dancer2 (with Plack::Handler::Apache2) still looks for the paths of the first app (so it fails because it can not find my app2 modules).<br>
<br></div><div>Example (how to reproduce the behaviour)<br></div><div><br></div><div>0) Dancer 2.06<br><br></div><div>1) Adjust Apache config to add the Locations of the two apps<br><br></div><div># Apache location<br></div>
<div><div><div><Location /app1><br> SetHandler perl-script<br> PerlHandler Plack::Handler::Apache2<br></div> PerlSetVar psgi_app /path/app1/bin/<a href="http://app.pl" target="_blank">app.pl</a><br>
</Location><div><br><Location /app2><br>
SetHandler perl-script<br> PerlHandler Plack::Handler::Apache2<br></div> PerlSetVar psgi_app /path/app2/bin/<a href="http://app.pl" target="_blank">app.pl</a><br></Location><br><br></div><div>2) Try app1 => it works!<br>
<br></div>
<div>3) Try app2 => fails with the next message: Error while loading /app2/<a href="http://app.pl" target="_blank">app.pl</a>: Can't locate App2.pm in @INC (@INC contains /path/app1/lib/ /usr/local....)<br><br></div>
<div>Where App2 is the main module at (app2/lib/) called from app2/bin/<a href="http://app.pl" target="_blank">app.pl</a> after use Dancer2.<br></div></div></div></blockquote><div><br></div></div><div>Try this: create a merged.psgi file with this content:</div>
<div><br></div><div>use Plack::Builder;</div><div>use App1;</div><div>use App2;</div><div><br></div><div>builder {</div><div> mount '/app1' => App1->dance;</div><div><div> mount '/app2' => App2->dance;</div>
</div><div>};</div><div><br></div><div><br></div><div>And then use it on Apache with:</div><div><br></div><div><div><Location /><div><br> SetHandler perl-script<br> PerlHandler Plack::Handler::Apache2<br>
</div></div> PerlSetVar psgi_app /path/to/merged.psgi<br></Location><br></div><div><br></div><div>I have not tested this, I don't have a mod_perl2 at hand anymore, but it should work.</div><div><br></div><div>
Bye,</div>
</div><div>-- <br>Pedro Melo<br>@pedromelo<br><a href="http://www.simplicidade.org/" target="_blank">http://www.simplicidade.org/</a><br><a href="mailto:xmpp%3Amelo@simplicidade.org" target="_blank">xmpp:melo@simplicidade.org</a><br>
mailto:<a href="mailto:melo@simplicidade.org" target="_blank">melo@simplicidade.org</a>
</div></div></div>
<br></div></div><div class="im">_______________________________________________<br>
dancer-users mailing list<br>
<a href="mailto:dancer-users@dancer.pm" target="_blank">dancer-users@dancer.pm</a><br>
<a href="http://lists.preshweb.co.uk/mailman/listinfo/dancer-users" target="_blank">http://lists.preshweb.co.uk/mailman/listinfo/dancer-users</a><br>
<br></div></blockquote></div><br></div>
<br>_______________________________________________<br>
dancer-users mailing list<br>
<a href="mailto:dancer-users@dancer.pm">dancer-users@dancer.pm</a><br>
<a href="http://lists.preshweb.co.uk/mailman/listinfo/dancer-users" target="_blank">http://lists.preshweb.co.uk/mailman/listinfo/dancer-users</a><br>
<br></blockquote></div><br></div>