[Dancer-users] waltz of a typical dancer

P Kishor punk.kish at gmail.com
Mon Mar 8 15:57:12 CET 2010


On Mon, Mar 8, 2010 at 1:09 AM, Alexis Sukrieh <sukria at sukria.net> wrote:
> Le dimanche 07 mars 2010 à 13:23 -0600, P Kishor a écrit :
..
>> - suddenly be struck by a thought -- how am I going to have several
>> dances on the same dance floor?
>
> I'd go for a bunch of VirtualHosts, each of them either with a FastCGI
> dispatcher, or a proxy_balancer.
>

I do have VirtualHosts on my production server, so the above is
helpful. But, I don't have VirtualHosts on my laptop. I have
directories under my ~/Sites folder, and I access them as
http://localhost/app1, http://localhost/app2 and so on. So, now what
do I do? (more on this below).


..
>> - use Plack::Loader, and am dancing with apache,
>>   but have to screw around with RewriteRules.
>>   Also, seems slower than a pure dance.
>
> Indeed, the CGI dispatcher is the worst solution you can think of when
> it's about performance. You should at least use the FastCGI dispatcher.
>

Let's put the above observation right there in the not-so-quickstart-manual.

>>  - Want to run many dances on the same dance floor, fast, with least hassles.
>> - back to deployment manual. See I can use proxypass with virtualhost.
>>   but no virtualhosts on my laptop... only localhost/dir1,
>
> You can also deploy with mod_perl, and set your app under a specific
> directory.
>

Same concern as above with FCGI. See, here is what happens, in my mind
(and, by assumption, in the minds of other ordinary and not so savvy
developers such as me). I want, to the extent possible, an exact same
environment on my laptop as on the production server. I am fortunate
as we are an all Apple shop. This means, I don't have to learn two
different environments, two different directory hierarchies, and other
idiosyncrasies. That way, I can devote almost all my energies to
developing the app.

I have installed my own perl (5.10.1) on both my personal laptop and
my production Xserve, and have everything on both machines
identical... perl and Unix-y software stuff under /usr/local, web
sites under ~/Sites and so on. The only thing, and really, the only
thing different on the two machines is how the web apps are served.
Both are served by Apache2, but on the production server I have
<VirtualHosts *:80> so I can access the apps via their DNS names such
as http://app1.com and http://app2.org, but on my laptop I don't have
DNS resolution of local apps, so I access them as
http://localhost/app1 and localhost/app2

The above, I would guess, is the scenario with many developers. In
fact, most developers, and myself, under a slightly different
scenario, don't have access to a production server under their own
control. They usually have a shared web host that allows them to
install local perl modules, but occasionally croaks on compiled C
modules, and certainly doesn't allow them to screw around with
httpd.conf, instead, allowing them to rely on .htaccess in local
directories. So, the instructions have to account for this scenario.

So, I want to understand and test FCGI (or mod_perl) on my laptop so I
can also deploy it on my production server, given the above
non-overlap.

This is where I am stuck.


>
>> - look through the source code, and create a dispatch.fcgi
>> - config apache with fcgi, and get caught in a redirect loop.
>
> Use the example shown in the deployment guide:
> http://search.cpan.org/~sukria/Dancer-1.160/lib/Dancer/Deployment.pod#Running_from_Apache_via_FastCGI

Actually, I am stuck here as well. As noted above, since I don't have
VirtualHosts on my local laptop, so I have the following in my
httpd.conf

----- httpd.conf -----
<Directory /Users/punkish/Sites/punkishdance>
    Options Indexes FollowSymLinks MultiViews ExecCGI Includes
    AllowOverride All
    Order allow,deny
    Allow from all
    AddHandler fastcgi-script .fcgi
</Directory>
-----

and then, I have the following in my ~/Sites/app1/.htaccess

----- ~/Sites/app1/.htaccess -----
# Assuming that the base URI is http://localhost/punkish/
RewriteEngine On
RewriteBase /app1/

# If an actual file or directory is requested, serve directly
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d

# Otherwise, pass everything through to the dispatcher
RewriteRule ^(.*)$ dispatch.fcgi [QSA,L]
-----

Note, since I am not accessing http://app1.com, my dispatch.fcgi line
is not '/dispatch.fcgi'. But, now I am caught in a redirect loop. Here
is a snippet of what I get from my rewrite.log

redir#7] (3) [perdir /Users/punkish/Sites/app1/] add path info
postfix: /Users/punkish/Sites/app1/dispatch.fcgi ->
/Users/punkish/Sites/app1/dispatch.fcgi/dispatch.fcgi/dispatch.fcgi/dispatch.fcgi/dispatch.fcgi/dispatch.fcgi/dispatch.fcgi/Puneet-Kishor
redir#7] (3) [perdir /Users/punkish/Sites/app1/] strip per-dir prefix:
/Users/punkish/Sites/app1/dispatch.fcgi/dispatch.fcgi/dispatch.fcgi/dispatch.fcgi/dispatch.fcgi/dispatch.fcgi/dispatch.fcgi/Puneet-Kishor
-> dispatch.fcgi/dispatch.fcgi/dispatch.fcgi/dispatch.fcgi/dispatch.fcgi/dispatch.fcgi/dispatch.fcgi/Puneet-Kishor
redir#7] (3) [perdir /Users/punkish/Sites/app1/] applying pattern
'^(.*)$' to uri
'dispatch.fcgi/dispatch.fcgi/dispatch.fcgi/dispatch.fcgi/dispatch.fcgi/dispatch.fcgi/dispatch.fcgi/Puneet-Kishor'
redir#7] (2) [perdir /Users/punkish/Sites/app1/] rewrite
'dispatch.fcgi/dispatch.fcgi/dispatch.fcgi/dispatch.fcgi/dispatch.fcgi/dispatch.fcgi/dispatch.fcgi/Puneet-Kishor'
-> 'dispatch.fcgi/dispatch.fcgi/dispatch.fcgi/dispatch.fcgi/dispatch.fcgi/dispatch.fcgi/dispatch.fcgi/dispatch.fcgi/Puneet-Kishor'
redir#7] (3) [perdir /Users/punkish/Sites/app1/] add per-dir prefix:
dispatch.fcgi/dispatch.fcgi/dispatch.fcgi/dispatch.fcgi/dispatch.fcgi/dispatch.fcgi/dispatch.fcgi/dispatch.fcgi/Puneet-Kishor
-> /Users/punkish/Sites/app1/dispatch.fcgi/dispatch.fcgi/dispatch.fcgi/dispatch.fcgi/dispatch.fcgi/dispatch.fcgi/dispatch.fcgi/dispatch.fcgi/Puneet-Kishor
redir#7] (2) [perdir /Users/punkish/Sites/app1/] trying to replace
prefix /Users/punkish/Sites/app1/ with /app1/
redir#7] (1) [perdir /Users/punkish/Sites/app1/] internal redirect
with /app1/dispatch.fcgi/dispatch.fcgi/dispatch.fcgi/dispatch.fcgi/dispatch.fcgi/dispatch.fcgi/dispatch.fcgi/dispatch.fcgi/Puneet-Kishor
[INTERNAL REDIRECT]
redir#8] (3) [perdir /Users/punkish/Sites/app1/] add path info
postfix: /Users/punkish/Sites/app1/dispatch.fcgi ->
/Users/punkish/Sites/app1/dispatch.fcgi/dispatch.fcgi/dispatch.fcgi/dispatch.fcgi/dispatch.fcgi/dispatch.fcgi/dispatch.fcgi/dispatch.fcgi/Puneet-Kishor
redir#8] (3) [perdir /Users/punkish/Sites/app1/] strip per-dir prefix:
/Users/punkish/Sites/app1/dispatch.fcgi/dispatch.fcgi/dispatch.fcgi/dispatch.fcgi/dispatch.fcgi/dispatch.fcgi/dispatch.fcgi/dispatch.fcgi/Puneet-Kishor
-> dispatch.fcgi/dispatch.fcgi/dispatch.fcgi/dispatch.fcgi/dispatch.fcgi/dispatch.fcgi/dispatch.fcgi/dispatch.fcgi/Puneet-Kishor
redir#8] (3) [perdir /Users/punkish/Sites/app1/] applying pattern
'^(.*)$' to uri
'dispatch.fcgi/dispatch.fcgi/dispatch.fcgi/dispatch.fcgi/dispatch.fcgi/dispatch.fcgi/dispatch.fcgi/dispatch.fcgi/Puneet-Kishor'
redir#8] (2) [perdir /Users/punkish/Sites/app1/] rewrite
'dispatch.fcgi/dispatch.fcgi/dispatch.fcgi/dispatch.fcgi/dispatch.fcgi/dispatch.fcgi/dispatch.fcgi/dispatch.fcgi/Puneet-Kishor'
-> 'dispatch.fcgi/dispatch.fcgi/dispatch.fcgi/dispatch.fcgi/dispatch.fcgi/dispatch.fcgi/dispatch.fcgi/dispatch.fcgi/dispatch.fcgi/Puneet-Kishor'
redir#8] (3) [perdir /Users/punkish/Sites/app1/] add per-dir prefix:
dispatch.fcgi/dispatch.fcgi/dispatch.fcgi/dispatch.fcgi/dispatch.fcgi/dispatch.fcgi/dispatch.fcgi/dispatch.fcgi/dispatch.fcgi/Puneet-Kishor
-> /Users/punkish/Sites/app1/dispatch.fcgi/dispatch.fcgi/dispatch.fcgi/dispatch.fcgi/dispatch.fcgi/dispatch.fcgi/dispatch.fcgi/dispatch.fcgi/dispatch.fcgi/Puneet-Kishor
redir#8] (2) [perdir /Users/punkish/Sites/app1/] trying to replace
prefix /Users/punkish/Sites/app1/ with /app1/
redir#8] (1) [perdir /Users/punkish/Sites/app1/] internal redirect
with /app1/dispatch.fcgi/dispatch.fcgi/dispatch.fcgi/dispatch.fcgi/dispatch.fcgi/dispatch.fcgi/dispatch.fcgi/dispatch.fcgi/dispatch.fcgi/Puneet-Kishor
[INTERNAL REDIRECT]
redir#9] (3) [perdir /Users/punkish/Sites/app1/] add path info
postfix: /Users/punkish/Sites/app1/dispatch.fcgi ->
/Users/punkish/Sites/app1/dispatch.fcgi/dispatch.fcgi/dispatch.fcgi/dispatch.fcgi/dispatch.fcgi/dispatch.fcgi/dispatch.fcgi/dispatch.fcgi/dispatch.fcgi/Puneet-Kishor
redir#9] (3) [perdir /Users/punkish/Sites/app1/] strip per-dir prefix:
/Users/punkish/Sites/app1/dispatch.fcgi/dispatch.fcgi/dispatch.fcgi/dispatch.fcgi/dispatch.fcgi/dispatch.fcgi/dispatch.fcgi/dispatch.fcgi/dispatch.fcgi/Puneet-Kishor
-> dispatch.fcgi/dispatch.fcgi/dispatch.fcgi/dispatch.fcgi/dispatch.fcgi/dispatch.fcgi/dispatch.fcgi/dispatch.fcgi/dispatch.fcgi/Puneet-Kishor
redir#9] (3) [perdir /Users/punkish/Sites/app1/] applying pattern
'^(.*)$' to uri
'dispatch.fcgi/dispatch.fcgi/dispatch.fcgi/dispatch.fcgi/dispatch.fcgi/dispatch.fcgi/dispatch.fcgi/dispatch.fcgi/dispatch.fcgi/Puneet-Kishor'
redir#9] (2) [perdir /Users/punkish/Sites/app1/] rewrite
'dispatch.fcgi/dispatch.fcgi/dispatch.fcgi/dispatch.fcgi/dispatch.fcgi/dispatch.fcgi/dispatch.fcgi/dispatch.fcgi/dispatch.fcgi/Puneet-Kishor'
-> 'dispatch.fcgi/dispatch.fcgi/dispatch.fcgi/dispatch.fcgi/dispatch.fcgi/dispatch.fcgi/dispatch.fcgi/dispatch.fcgi/dispatch.fcgi/dispatch.fcgi/Puneet-Kishor'
redir#9] (3) [perdir /Users/punkish/Sites/app1/] add per-dir prefix:
dispatch.fcgi/dispatch.fcgi/dispatch.fcgi/dispatch.fcgi/dispatch.fcgi/dispatch.fcgi/dispatch.fcgi/dispatch.fcgi/dispatch.fcgi/dispatch.fcgi/Puneet-Kishor
-> /Users/punkish/Sites/app1/dispatch.fcgi/dispatch.fcgi/dispatch.fcgi/dispatch.fcgi/dispatch.fcgi/dispatch.fcgi/dispatch.fcgi/dispatch.fcgi/dispatch.fcgi/dispatch.fcgi/Puneet-Kishor
redir#9] (2) [perdir /Users/punkish/Sites/app1/] trying to replace
prefix /Users/punkish/Sites/app1/ with /app1/
redir#9] (1) [perdir /Users/punkish/Sites/app1/] internal redirect
with /app1/dispatch.fcgi/dispatch.fcgi/dispatch.fcgi/dispatch.fcgi/dispatch.fcgi/dispatch.fcgi/dispatch.fcgi/dispatch.fcgi/dispatch.fcgi/dispatch.fcgi/Puneet-Kishor
[INTERNAL REDIRECT]
redir#10] (3) [perdir /Users/punkish/Sites/app1/] add path info
postfix: /Users/punkish/Sites/app1/dispatch.fcgi ->
/Users/punkish/Sites/app1/dispatch.fcgi/dispatch.fcgi/dispatch.fcgi/dispatch.fcgi/dispatch.fcgi/dispatch.fcgi/dispatch.fcgi/dispatch.fcgi/dispatch.fcgi/dispatch.fcgi/Puneet-Kishor
redir#10] (3) [perdir /Users/punkish/Sites/app1/] strip per-dir
prefix: /Users/punkish/Sites/app1/dispatch.fcgi/dispatch.fcgi/dispatch.fcgi/dispatch.fcgi/dispatch.fcgi/dispatch.fcgi/dispatch.fcgi/dispatch.fcgi/dispatch.fcgi/dispatch.fcgi/Puneet-Kishor
-> dispatch.fcgi/dispatch.fcgi/dispatch.fcgi/dispatch.fcgi/dispatch.fcgi/dispatch.fcgi/dispatch.fcgi/dispatch.fcgi/dispatch.fcgi/dispatch.fcgi/Puneet-Kishor
redir#10] (3) [perdir /Users/punkish/Sites/app1/] applying pattern
'^(.*)$' to uri
'dispatch.fcgi/dispatch.fcgi/dispatch.fcgi/dispatch.fcgi/dispatch.fcgi/dispatch.fcgi/dispatch.fcgi/dispatch.fcgi/dispatch.fcgi/dispatch.fcgi/Puneet-Kishor'
redir#10] (2) [perdir /Users/punkish/Sites/app1/] rewrite
'dispatch.fcgi/dispatch.fcgi/dispatch.fcgi/dispatch.fcgi/dispatch.fcgi/dispatch.fcgi/dispatch.fcgi/dispatch.fcgi/dispatch.fcgi/dispatch.fcgi/Puneet-Kishor'
-> 'dispatch.fcgi/dispatch.fcgi/dispatch.fcgi/dispatch.fcgi/dispatch.fcgi/dispatch.fcgi/dispatch.fcgi/dispatch.fcgi/dispatch.fcgi/dispatch.fcgi/dispatch.fcgi/Puneet-Kishor'
redir#10] (3) [perdir /Users/punkish/Sites/app1/] add per-dir prefix:
dispatch.fcgi/dispatch.fcgi/dispatch.fcgi/dispatch.fcgi/dispatch.fcgi/dispatch.fcgi/dispatch.fcgi/dispatch.fcgi/dispatch.fcgi/dispatch.fcgi/dispatch.fcgi/Puneet-Kishor
-> /Users/punkish/Sites/app1/dispatch.fcgi/dispatch.fcgi/dispatch.fcgi/dispatch.fcgi/dispatch.fcgi/dispatch.fcgi/dispatch.fcgi/dispatch.fcgi/dispatch.fcgi/dispatch.fcgi/dispatch.fcgi/Puneet-Kishor
redir#10] (2) [perdir /Users/punkish/Sites/app1/] trying to replace
prefix /Users/punkish/Sites/app1/ with /app1/
redir#10] (1) [perdir /Users/punkish/Sites/app1/] internal redirect
with /app1/dispatch.fcgi/dispatch.fcgi/dispatch.fcgi/dispatch.fcgi/dispatch.fcgi/dispatch.fcgi/dispatch.fcgi/dispatch.fcgi/dispatch.fcgi/dispatch.fcgi/dispatch.fcgi/Puneet-Kishor
[INTERNAL REDIRECT]

So, the summary of my experience is:

- be amazed by dancer,
- discover that in reality I have to make my setup a bit more
  complicated than quickstart
- go into several recommended directions, and get stuck.

Here is what I want to help you all with -- change the dancer experience to:

- be amazed by dancer,
- continue to be amazed by dancer.

I look forward to assisting the dancer team achieve the above.


-- 
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