Adding dancer2 to an existing web site.
I have a web site with primarily static content and a few Perl CGI scripts. 1. Can I start integrating dancer2 a bit at a time without a wholesale site rewrite? 2. What is recommended as the best way to deploy dancer2 under Apache 2.4? Thanks. Best regards, -Tom
On 16 Jul 2015, at 12:39, Tom Browder <tom.browder@gmail.com> wrote:
I have a web site with primarily static content and a few Perl CGI scripts.
1. Can I start integrating dancer2 a bit at a time without a wholesale site rewrite? Yep
2. What is recommended as the best way to deploy dancer2 under Apache 2.4?
Run Dancer under starman or whatever proxy from apache to starman one call at a time as you are happy with it When all done - remove apache and use nginx as the proxy ;-) — Clive
On Jul 16, 2015 6:56 AM, "Clive Eisen" <clive@hildebrand.co.uk> wrote:
2. What is recommended as the best way to deploy dancer2 under Apache 2.4?
Run Dancer under starman or whatever
proxy from apache to starman one call at a time as you are happy with it When all done - remove apache and use nginx as the proxy ;-)
Hm, I have a lot invested in my Apache configuration, and I love its virtual host handling. I tried nginx some time ago and I'm not sure it can do all I need to do with client certificate handling (and the docs left a lot to be desired). But I'm open to a rethink. Thanks, Clive. Best regards, -Tom
On Thu, 2015-07-16 at 08:05 -0500, Tom Browder wrote:
On Jul 16, 2015 6:56 AM, "Clive Eisen" <clive@hildebrand.co.uk> wrote:
2. What is recommended as the best way to deploy dancer2 under Apache 2.4?
Run Dancer under starman or whatever
proxy from apache to starman one call at a time as you are happy with it When all done - remove apache and use nginx as the proxy ;-)
Hm, I have a lot invested in my Apache configuration, and I love its virtual host handling. I tried nginx some time ago and I'm not sure it can do all I need to do with client certificate handling (and the docs left a lot to be desired). But I'm open to a rethink.
The easiest way to use Dancer with Apache is via FastCGI: https://metacpan.org/pod/Dancer::Deployment#Running-as-a-cgi-script-or-fast-... -under-Apache Note that for 2.4 you will need: Require all granted Instead of: Order allow,deny Allow from all There are some occasions when you might want to use Apache as a proxy to Starman instead, but for most use-cases FastCGI is easier and quicker. MST has a good little blog about deploying web apps in general: http://shadow.cat/blog/matt-s-trout/mstpan-2/ Andy
On Jul 16, 2015 8:57 AM, "Andrew Beverley" <andy@andybev.com> wrote:
On Thu, 2015-07-16 at 08:05 -0500, Tom Browder wrote:
On Jul 16, 2015 6:56 AM, "Clive Eisen" <clive@hildebrand.co.uk> wrote:
2. What is recommended as the best way to deploy dancer2 under Apache 2.4? ... The easiest way to use Dancer with Apache is via FastCG: ...
Thanks for some good advice, Andy! Best regards, -Tom
On Thu, 16 Jul 2015, Andrew Beverley wrote:
The easiest way to use Dancer with Apache is via FastCGI:
https://metacpan.org/pod/Dancer::Deployment#Running-as-a-cgi-script-or-fast-...
That link points to the RewriteEngine version. I use: ScriptAlias /myapp /path/to/myapp/bin/dispatch.fcgi Note: - dispatch.fcgi is NOT in the document root - Do NOT detach -- in dispatch.fcgi -- my $server = Plack::Handler::FCGI->new(nproc => 1, detach => 0); - Running the same code as stand-alone for testing needs some tweeks I have a scriptalias in my config.yml scriptalias: "/myapp" and a plugin that exports the DSL keyword scriptalias Loading sub-apps like this: if (setting('environment') eq 'production') { load_app 'Subapp', prefix => '/subapp'; } else { load_app 'Subapp', prefix => scriptalias . '/subapp'; } Mmm, maybe overkill... setting some $scriptalias can construct a prefix "$scriptalias/subapp" Running 'perl bin/app.pl' just works. One can use this to slowly convert /cgi-bin/subapp1.pl /cgi-bin/subapp2.pl to /myapp/subapp1 /myapp/subapp2 HTH, Henk
participants (4)
-
Andrew Beverley -
Clive Eisen -
hvo.pm@xs4all.nl -
Tom Browder