[Dancer-users] Dancer deployment still confusing, difficult and a non-starter

P Kishor punk.kish at gmail.com
Sat Jul 31 18:38:39 CEST 2010


First, the perldancer.org domain was out for several days and emails
to dancer-users mailing would bounce back ("rejected by recipient
domain"). A conversation on IRC channel revealed that the DNS server
was down, but nothing could be done about it until Sukrieh returned
from a vacation. Would it be possible to not have such a single point
of failure or blocking in the canonical, root domain of the web
framework please? It gives the impression that the project has been
abandoned.

Nevertheless, while I am able to very quickly download, install and
even create a basic dancer app, its deployment still remains a mystery
to me. First, I will describe my working scenario in the hope that
there might others with the same scenario, and then I will list what
all I attempted and failed.

I apologize for this email's length, but my hope is that it will lead
to clearer and easier deployment notes with Dancer.

I develop on my MacBook with Perl 5.12.1 installed under
/usr/local/bin. My web projects live under ~/Sites, and are served by
Apache2 running from /usr/local/apache2 (all custom installations).
Any custom Perl libraries I develop go under ~/Library/Perl, and are
available to all my web projects. I try to mimic the conditions on the
actual production server as much as possible. One such server is a Mac
OS X server, so its layout is almost identical to my MacBook, but
another is a shared web host, most likely some variant of Linux. On
that I get an html docs folder in my home folder, but I don't get
access to tinkering with Apache which does all the serving. I can, for
the most part, request custom Perl module installations, and I can use
.htaccess files.

Since these applications eventually get served from their own domain
names, I try to not develop using http://localhost/app1 and
http://localhost/app2. Doing so confuses me with regards to relative
URLs and makes for a bit trickier development. Instead, I use virtual
hosts with Apache, and I add the name of the virtual host to my
/etc/hosts file. This allows me to get to my apps via
http://app1.local and http://app2.local and so on. This way, when I
eventually put the app in production, all I have to do is change the
the host name from app1.local to app1.org and so on.

While developing, I don't really worry about speed, so I just use cgi
scripts with Apache... no persistent environment here. In fact, while
on the Xserve I can install any persistent environment, on the shared
web server I may not even have access to a persistent environment at
all. So, I have to develop using the least common denominator, and
then deploy with the best possible tools. Also, whatever deployment I
choose, it is most likely to be Apache based. While it may not be the
fastest, Apache is tried and tested, is available by default on
whichever server I choose, and is even required by other projects.

Now, on to deployment. The docs at Dancer::Deployment say that deploying

    http://localhost/dance/dispatch.cgi
    500 Internal Server Error - Wrong

    http://localhost/dance/dispatch.cgi/
    200 OK - Right

The above give me a generic Apache 404 error

    script not found or unable to stat: /Users/punkish/Sites/dance/dispatch.cgi
    File does not exist: /Users/punkish/Sites/dance/missing.html

Actually, both of the above are wrong. It should really be

    http://localhost/myapp/public/dispatch.cgi/

But, then I get the following errors in Apache logs

    Unable to open /Users/punkish/Sites/dance/logs/development.log for
writing, unable to log at
/usr/local/lib/perl5/site_perl/5.12.1/Dancer/Logger/File.pm line 32,
<DATA> line 16.
    Unable to open /Users/punkish/Sites/dance/logs/development.log for
writing, unable to log at
/usr/local/lib/perl5/site_perl/5.12.1/Dancer/Logger/File.pm line 32.
    Error while loading /Users/punkish/Sites/dance/app.psgi: unable to
load application dance : Can't locate dance.pm in @INC (@INC contains:
/Users/punkish/Sites/dance/public/lib
/usr/local/lib/perl5/site_perl/5.12.1/darwin-2level
/usr/local/lib/perl5/site_perl/5.12.1
/usr/local/lib/perl5/5.12.1/darwin-2level /usr/local/lib/perl5/5.12.1
/usr/local/lib/perl5/site_perl .) at (eval 60) line 2.
    BEGIN failed--compilation aborted at (eval 60) line 2.
    Premature end of script headers: dispatch.cgi
    File does not exist: /Users/punkish/Sites/dance/favicon.ico,
referer: http://dance.local/public/dispatch.cgi/
    File does not exist: /Users/punkish/Sites/dance/missing.html,
referer: http://dance.local/public/dispatch.cgi/

I can fix the errors re. not being able to open development.log for
writing by changing permissions on it

    chmod -R 777 logs

but, the Dancer script that creates the logs folder should have set
the permissions correctly automatically so Apache can write to it.

Nevertheless, the other error is more serious... app.psgi is unable to
load application dance because it can't locate dance.pm in @INC. If
you see above, @INC contains 'dance/public/lib', but 'lib' is actually
sitting one level above under 'dance'. So, I move 'lib' down to
'dance/public'. But, now I get a dancer 404, and the following errors
in Apache logs

    File does not exist: /Users/punkish/Sites/dance/css, referer:
http://dance.local/public/dispatch.cgi/
    File does not exist: /Users/punkish/Sites/dance/missing.html,
referer: http://dance.local/public/dispatch.cgi/
    File does not exist: /Users/punkish/Sites/dance/favicon.ico,
referer: http://dance.local/public/dispatch.cgi/
    File does not exist: /Users/punkish/Sites/dance/missing.html,
referer: http://dance.local/public/dispatch.cgi/

So, the interesting thing is, now I am getting the 404 via the dancer
404 template. So, dancer is running, and responding, but it is unable
to grok the route. Plus, all the paths in the template are now wrong.

Now what do I do?


-- 
Puneet Kishor http://www.punkish.org
Carbon Model http://carbonmodel.org
Charter Member, Open Source Geospatial Foundation http://www.osgeo.org
Science Commons Fellow, http://sciencecommons.org/about/whoweare/kishor
Nelson Institute, UW-Madison http://www.nelson.wisc.edu
-----------------------------------------------------------------------
Assertions are politics; backing up assertions with evidence is science
=======================================================================


More information about the Dancer-users mailing list