Deploying Catalyst Applications

Before you go automatically searching for the Apache section, stop and think: do you have a specific reason to use Apache? If not, then you might be much better off using nginx or lighttpd. They are easier to configure, faster, and consume less resources.

Here is the CPAN documentation on deployment. It talks about mod_perl vs. FastCGI, and standalone/external FastCGI mode, which is regarded as the most flexible deployment option.

Deployment without a web server

Catalyst comes with a built-in HTTP server for standalone deployment, myapp_server.pl. That server can use various engines, of which Catalyst::Engine::HTTP::Prefork is a high-performance pre-forking Catalyst engine and recommended. To serve your application with HTTP::Prefork, run:

CATALYST_ENGINE='HTTP::Prefork' script/mojomojo_server.pl

Init.d script for the standalone server

Plack

According to plackperl.org PSGI/Plack is the

Superglue interface between perl web application frameworks and web servers, just like Perl is the duct tape of the internet. PSGI is an interface between Perl web applications and web servers, and Plack is a Perl module and toolkit that contains PSGI middleware, helpers and adapters to web servers. PSGI and Plack are inspired by Python's WSGI and Ruby's Rack.

This means that after setting up your Catalyst application with one of the listed servers (like Starman, Starlet, Twiggy) you still need to configure your webserver (like nginx) to pass the requests on to your PSGI enabled application.

Gazelle

Let's demonstrate this with the new kid on the block: Gazelle.

Start the PSGI application:

$ start_server --path /path/to/app.sock\
  --backlog 16384 -- plackup -s Gazelle\
  -workers=20 --max-reqs-per-child 1000\
  --min-reqs-per-child 800 -E production\
  -a app.psgi

and configure nginx:

http {
 upstream app {
  server unix:/path/to/app.sock;
 }

 server {
  location / {
   proxy_pass http://app;
  }
  location ~ ^/(stylesheets|images)/ {
   root /path/to/webapp/public;
  }
 }
}

perlbal/plack/psgi

Example deployment using perl-based futuristical applications. Can handle large-scale production websites with load balancing, HA and infinite capabilities for customization and optimization.

nginx

The nginx web server leads lighttpd in terms of popularity and better resource utilization, according to WikiVS.

lighttpd

The lighttpd web server is lighter, simpler and considerably faster than Apache. If you don't have a specific reason to use Apache, lighttpd will probably do the job with less headache and overhead.

Apache

Apache is the heavyweight of web servers. If you don't have a specific reason to use it, consider nginx. If you choose Apache, the next choice is mod_perl vs FastCGI.

FastCGI

Reverse Proxy

mod_perl

Microsoft Internet Information Service - IIS

It is possible to run Catalyst under IIS with FastCGI, but only on IIS 6.0 (Microsoft Windows 2003), IIS 7.0 (Microsoft Windows 2008 and Vista) and hopefully its successors.

NOTE: Do not waste your time to get Catalyst App running as FastCGI on IIS 5.0 (Windows 2000) or IIS 5.1 (Windows XP) it simply is not possible despite the declared FastCGI support.

PAR deployment

Managing FastCGI Processes

Deployment on shared hosting

My tags:
 
Popular tags:
  deployment
Powered by Catalyst
Powered by MojoMojo Hosted by Shadowcat - Managed by Nordaaker