Dancer deployment bugs with Plack::Handler::Apache2
Hello, I've deployed two Dancer applications on one apache server using "Plack::Handler::Apache2" (one is the "SimpleCrud" test page mentioned yesterday), and I'm experiencing very strange bugs: It seems the two applications are conflicting, when routes or templates from one application are used by the other. That is, the deployment in Apache is as follows: ========= <Location /labmembers/gordon/simple_crud> SetHandler perl-script PerlHandler Plack::Handler::Apache2 PerlSetVar psgi_app /home/gordon/projects/simple_crud_sortable/bin/app.pl </Location> <VirtualHost *:80> ServerName xxxxx.cshl.edu ServerAlias xxxxx DocumentRoot /var/www/data/xxxxx/ <Location "/"> Order Deny,Allow Deny from all Allow from cshl.edu SetHandler perl-script PerlHandler Plack::Handler::Apache2 PerlSetVar psgi_app /var/www/data/xxxxx/dancer/bin/app.pl </Location> </VirtualHost> ========= And when I browse to the virtual server ( http://xxxxx.cshl.edu ), I most of the times get the correct page, but sometimes I get this error: === '/home/gordon/projects/simple_crud_sortable/views/about/index.tt' is not a regular file at /usr/lib/perl5/site_perl/5.8.8/Dancer.pm line 161 === That is: visiting the new application somehow tries to fetch a template from the "simple_crud" application (probably because a wrong route from "simple_crud" was used). I know it sound strange (or unbelievable?), but it has happened several times (not always, though, so it's hard to pin-point). Additionally, several static files (css/images) sometimes returns HTTP-404 - which I guess is also related to routes mix-up. Also, viewing the "/var/log/httpd/error_log" file, I can see dancer debug messages trying to match rountes from my other application even if I visit "http://cancan.cshl.edu/labmembers/gordon/simple_crud/genes". Has any one encountered such behavior ? Or is no one deploying production application using "Plack::Handler::Apache2" ? Thanks, -gordon
Hi, On Wed, Oct 19, 2011 at 5:33 PM, Assaf Gordon <gordon@cshl.edu> wrote:
Hello,
I've deployed two Dancer applications on one apache server using "Plack::Handler::Apache2" (one is the "SimpleCrud" test page mentioned yesterday), and I'm experiencing very strange bugs:
It seems the two applications are conflicting, when routes or templates from one application are used by the other.
Known side-effect of the good design decisions Dancer1 took :). You can search the Mailing list, this was discussed before. The recommendation is to start each app with plackup using your favorite server (I recommend Starman for this) and then use your apache (or nginx if you can) as a frontend server for both apps using reverse proxy (HTTP based, no fastcgi). Current Dancer uses a lot of global variables and if you don't take enormous care to switch the global configuration/status, those problems will show up. Dancer2 (alpha? beta?) is said to solve this problems, but I have no personal experience with it so far. Best regards, -- Pedro Melo @pedromelo http://www.simplicidade.org/ http://about.me/melo xmpp:melo@simplicidade.org mailto:melo@simplicidade.org
Hi Pedro, Pedro Melo wrote, On 10/19/11 14:28:
On Wed, Oct 19, 2011 at 5:33 PM, Assaf Gordon <gordon@cshl.edu> wrote:
It seems the two applications are conflicting, when routes or templates from one application are used by the other.
Known side-effect of the good design decisions Dancer1 took :). You can search the Mailing list, this was discussed before.
Thanks for confirming this. I'm indeed guilty of not looking in the mailing list first, the problem is acknowledged (but never resolved). My tiny contribution will be to add a warning to the "deployment guide": https://github.com/agordon/Dancer/commit/abaeceec5c010c4557ee0ed4daab70eda1b... BTW, What's the best way to search the mailing list ? The archives aren't too friendly (http://lists.perldancer.org/cgi-bin/listinfo/dancer-users). -gordon
2011/10/19 Pedro Melo <melo@simplicidade.org>:
Hi,
On Wed, Oct 19, 2011 at 5:33 PM, Assaf Gordon <gordon@cshl.edu> wrote:
Hello,
I've deployed two Dancer applications on one apache server using "Plack::Handler::Apache2" (one is the "SimpleCrud" test page mentioned yesterday), and I'm experiencing very strange bugs:
It seems the two applications are conflicting, when routes or templates from one application are used by the other.
Known side-effect of the good design decisions Dancer1 took :). You can search the Mailing list, this was discussed before.
Exactly.
The recommendation is to start each app with plackup using your favorite server (I recommend Starman for this) and then use your apache (or nginx if you can) as a frontend server for both apps using reverse proxy (HTTP based, no fastcgi).
Yes, that's a good workaround for this deisgn issue in Dancer 1.
Current Dancer uses a lot of global variables and if you don't take enormous care to switch the global configuration/status, those problems will show up.
Dancer2 (alpha? beta?) is said to solve this problems, but I have no personal experience with it so far.
Totally. Dancer 2 solved entirely this issue thanks to a complete new design where everything is scoped properly. By the way, Dancer 2 is almost finished and should be able to run a lot of existing applications. I welcome very much upgrade reports. Regards,
participants (3)
-
Alexis Sukrieh -
Assaf Gordon -
Pedro Melo