Multiple virtual hosts: one dancer instance or one per vhost?
I am investigating moving several virtual host web sites (some using plain CGI and some purely static) to using dancer2 and wonder (1) can one have one dancer process per vhost and (2) can one dancer process support multiple host? I would like to be able to choose either or a mix of the methods but it is important that the individual vhost sites be independent as far as the public views them. Some features that differ from host to host that must continue working: + TLS server certificates + client certificates (for private sections of a vhost) + mixed static and dynamic pages All sites will continue to be served with Apache 2.4. The candidate sites include: <https://usafa-1965.org> <https://psrr.info> <https://niceville.pm.org> <https://nwflug.org> <https://mbrowder.com> <https://computertechnwf.org> <https://freestatesofamerica.org> <https://novco1968tbs.com> <https://nwflorida.info> Only the first is using CGI currently, but I would like to expand most of the others to use some dynamic pages. Readers may be interested in the second site which has my own implementation of an animated steam loco and cars regularly crossing the front page. The scene includes flashing signals at a highway crossing. The scene uses only svg and html 5 code (and non-animated css). Thanks. Best regards, -Tom
Hi 2015-10-07 17:23 GMT+03:00 Tom Browder <tom.browder@gmail.com>:
I am investigating moving several virtual host web sites (some using plain CGI and some purely static) to using dancer2 and wonder
As I see the topic:
(1) can one have one dancer process per vhost and
You _may_ run one process per vhost, but even with very low traffic site it is better to run more than one worker. I think the most common setup for Dancer app is to run it with some Plack-capable server (like Starman) behind some reverse proxy (like nginx). https://metacpan.org/pod/Dancer::Deployment#Running-on-Perl-webservers-with-... plackup -E deployment -s Starman --workers=10 -p 5001 -a bin/app.pl You may choose suitable count of workers.
(2) can one dancer process support multiple host?
It is possible for static pages, but then why to use Dancer at all? When you need some dynamic features (like sessions), you are in trouble. Wbr, -- Kõike hääd, Gunnar
On Wed, Oct 7, 2015 at 9:39 AM, WK <wanradt@gmail.com> wrote: ...
I am investigating moving several virtual host web sites (some using plain CGI and some purely static) to using dancer2 and wonder
As I see the topic:
(1) can one have one dancer process per vhost and
You _may_ run one process per vhost, but even with very low traffic site it is better to run more than one worker.
Okay, I think that may be doable.
I think the most common setup for Dancer app is to run it with some Plack-capable server (like Starman) behind some reverse proxy (like nginx). ...
Without a clear set of docs for deployment, I'm not sure I want to leap into that steep learning curve.
(2) can one dancer process support multiple host? ... When you need some dynamic features (like sessions), you are in trouble.
Okay, so I won't try the single process. Thanks, Wbr! Best regards, -Tom
On 7 October 2015 at 08:15, Tom Browder <tom.browder@gmail.com> wrote:
On Wed, Oct 7, 2015 at 9:39 AM, WK <wanradt@gmail.com> wrote: ...
I think the most common setup for Dancer app is to run it with some Plack-capable server (like Starman) behind some reverse proxy (like nginx). ...
Without a clear set of docs for deployment, I'm not sure I want to leap into that steep learning curve.
If you are already dealing with virtual hosts, adding a reverse proxy should not be all that much more difficult. If you're running Apache, you can use the ProxyPass directive to reverse proxy everything served on a certain port, e.g. ProxyPass / http://localhost:5001/ ProxyPassReverse / http://localhost:5001/ and then run plackup to serve Dancer content on port 5001: plackup -s Starman --workers=10 -p 5001 bin/app.psgi If you want Apache to serve static content (images, js, css, etc.), you can use Apache's rewrite directives: RewriteEngine On RewriteRule ^/static/(.*) /path/to/public/$1 [L] ProxyPass / http://localhost:5001/ ProxyPassReverse / http://localhost:5001/ Anything under /static/ here gets served from the directory /path/to/public/ by Apache, and all other requests get served by Dancer. The server setup details for Dancer2 are very similar to those used by Mojolicious, Catalyst, and other PSGI-capable frameworks, so you can check their documentation for tips. I believe there was a Catalyst advent calendar article with a full nginx server config in it, and the Mojolicious wiki has some useful details too. Good luck! Amelia.
On Wed, Oct 7, 2015 at 11:00 AM, Amelia Ireland <aireland@lbl.gov> wrote:
On 7 October 2015 at 08:15, Tom Browder <tom.browder@gmail.com> wrote:
On Wed, Oct 7, 2015 at 9:39 AM, WK <wanradt@gmail.com> wrote: ...
I think the most common setup for Dancer app is to run it with some Plack-capable server (like Starman) behind some reverse proxy (like nginx). ... Without a clear set of docs for deployment, I'm not sure I want to leap into that steep learning curve.
If you are already dealing with virtual hosts, adding a reverse proxy should not be all that much more difficult. If you're running Apache, you can use the ProxyPass directive to reverse proxy everything served on a certain port, e.g. ....
Very helpful, Amelia, thanks very much! Best regards, -Tom
participants (3)
-
Amelia Ireland -
Tom Browder -
WK