Recommendations for NGINX + Dancer deployment, no Starman
Hello, I'm looking to deploy a small (or multiple small) Dancer application on a small server (512MB). Memory efficiency and stability are more important than high-performance in this instance. I've switched from Apache to NGINX, which saved a lot of memory. I'm now looking to use either FastCGI or CGI with NGINX + Dancer - are there any examples for this kind of deployment? other recommendations? I want to avoid running an external process (e.g. plackup/starman/twiggy/etc.). Thanks! -gordon
On 11/01/2013 01:56 PM, Assaf Gordon wrote:
Hello,
I'm looking to deploy a small (or multiple small) Dancer application on a small server (512MB). Memory efficiency and stability are more important than high-performance in this instance.
I've switched from Apache to NGINX, which saved a lot of memory. I'm now looking to use either FastCGI or CGI with NGINX + Dancer - are there any examples for this kind of deployment? other recommendations? I want to avoid running an external process (e.g. plackup/starman/twiggy/etc.).
CGI doesn't make sense with Dancer + Nginx. FastCGI is an external process as well. Regards Racke -- LinuXia Systems => http://www.linuxia.de/ Expert Interchange Consulting and System Administration ICDEVGROUP => http://www.icdevgroup.org/ Interchange Development Team
I might be mistaken, but as far as I understand nginx cannot run CGI scripts. The only way to create dynamic pages with it is using an external process. (FastCGI or Starman or ...) Here is the link to the nginx wiki page: http://wiki.nginx.org/Configuration lists For some details: The Perl TV http://perltv.org/ uses the configuration I described here: http://perlmaven.com/getting-started-with-perl-dancer-on-digital-ocean (Starman + nginx) and runs on a 512 Mb instance. Both Starman and nginx run with 7 workers and if I understand this output: $ free total used free shared buffers cached Mem: 502980 483208 19772 0 10272 140072 -/+ buffers/cache: 332864 170116 Swap: 0 0 0 I could still increase those. Gabor On Fri, Nov 1, 2013 at 2:56 PM, Assaf Gordon <assafgordon@gmail.com> wrote:
Hello,
I'm looking to deploy a small (or multiple small) Dancer application on a small server (512MB). Memory efficiency and stability are more important than high-performance in this instance.
I've switched from Apache to NGINX, which saved a lot of memory. I'm now looking to use either FastCGI or CGI with NGINX + Dancer - are there any examples for this kind of deployment? other recommendations? I want to avoid running an external process (e.g. plackup/starman/twiggy/etc.).
Thanks! -gordon
Thanks Gabor and Stefan. On 11/01/2013 03:33 PM, Gabor Szabo wrote:
I might be mistaken, but as far as I understand nginx cannot run CGI scripts.
Based on your feedback, I've switched to lighttpd. For future reference, if anyone needs to deploy Dancer with lighttpd as CGI/FastCGI: As CGI: === $HTTP["host"] =~ "^cgi\.example\.com$" { # Default Root location - points to Dancer's public directory. server.document-root = "/home/gordon/projects/dancer_bootstrap_fontawesome_template/public" # If the URL matches a typical static file extension, but goes thought our CGI script, # then rewrite the CGI script out of the URL, and lighttpd will serve it directly as a static file. url.rewrite = ( "^/dispatch.cgi/(.+\.(js|css|gif|jpg|png|ico|txt|swf|html|htm|svg))$" => "/$1" ) # Default file, if the user asked for the root URL index-file.names = ( "dispatch.cgi" ) cgi.assign = ( ".cgi" => "/usr/bin/perl" ) } === As FastCGI: === $HTTP["host"] =~ "^fastcgi\.example\.com$" { # Default Root location - points to Dancer's public directory. server.document-root = "/home/gordon/projects/dancer_bootstrap_fontawesome_template/public" # If the URL matches a typical static file extension, but goes through our CGI script, # then rewrite the CGI script out of the URL, and lighttpd will serve it directly as a static file. url.rewrite = ( "^/dispatch.fcgi/(.+\.(js|css|gif|jpg|png|ico|txt|swf|html|htm|svg))$" => "/$1" ) # Default file, if the user asked for the root URL index-file.names = ( "dispatch.fcgi" ) fastcgi.server = ( ".fcgi" => (( "bin-path" => "/home/gordon/projects/dancer_bootstrap_fontawesome_template/public/dispatch.fcgi", "socket" => "/tmp/dancer_fcgi.socket", "check-local" => "disable", "min-procs" => 1, "max-procs" => 1, "idle-timeout" => 20, )) ) } === Best, -gordon
Hi, On Fri, Nov 1, 2013 at 12:56 PM, Assaf Gordon <assafgordon@gmail.com> wrote:
I'm looking to deploy a small (or multiple small) Dancer application on a small server (512MB). Memory efficiency and stability are more important than high-performance in this instance.
I've switched from Apache to NGINX, which saved a lot of memory. I'm now looking to use either FastCGI or CGI with NGINX + Dancer - are there any examples for this kind of deployment? other recommendations?
I want to avoid running an external process (e.g.
plackup/starman/twiggy/etc.).
Yeah… Running the external process would be my recomendation. Start::Server + Starlet with 1 or 2 workers for each app is my current setup for situations just like yours, low memory, low performance requirements, because it keeps me nimble in terms of upgrades. You might want to look at uWSGI server though. You could use one single instance to keep track of all your apps. I don't know if it has on-demand workers, but if it did, it could solve your entire problem. The problem is that it is so flexible that it will take some time to find the proper solution for it, but on the plus side the uWSGI mailing list is **very** welcome and responsive. I've been considering them on my stack for quite some time, and it would solve several problems with a single tool, but haven't found the time. :) Bye, -- Pedro Melo @pedromelo http://www.simplicidade.org/ xmpp:melo@simplicidade.org mailto:melo@simplicidade.org
participants (4)
-
Assaf Gordon -
Gabor Szabo -
Pedro Melo -
Stefan Hornburg (Racke)