[Dancer-users] Deployment pod

Sarah Fuller sarah at averna.id.au
Thu Nov 10 04:22:03 CET 2011


Hi Matt,

Just quickly in response to a previous thread. Yes, its indeed nice to see
another Australian on here. In fact there seems to be people from all parts
of the world here which is nice. :)

This was taken from my test server running debian squeeze. Well hopefully
this is what you had in mind.



NGINX:

upstream backend {
        server unix:/tmp/example.sock;
    }

server {
  listen 80;
  server_name  example.com

  access_log  /var/log/nginx/example.com.access.log;
  error_log  /var/log/nginx/example.com.error.log;

  location /images {
    expires     31d;
    add_header Cache-control public;
    root /home/example/app/public;
  }

  location /css {
    expires     31d;
    add_header Cache-control public;
    root /home/example/app/public;
  }

  location /javascripts {
    expires     31d;
    add_header Cache-control public;
    root /home/example/app/public;
  }

  location /favicon.ico {
    expires     31d;
    add_header Cache-control public;
    root /home/example/app/public;
  }


  root /home/example/app/public;

      location / {
        try_files $uri @proxy;
        access_log off;
      }

      location @proxy {
            proxy_no_cache $cookie_nocache  $arg_nocache$arg_comment;
            proxy_no_cache $http_pragma     $http_authorization;
            proxy_set_header Host $http_host;
            proxy_set_header X-Forwarded-Host $host;
            proxy_set_header X-Real-IP $remote_addr;
            proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
            proxy_pass       http://backend;
      }



BACKEND:

Then the backend is started like so: sudo -u www-data plackup -E production
-s Starman --workers=16 -l /tmp/example.sock -a /home/example/app/bin/app.pl

Ideally you'd want this wrapped up in a init script and monitored. I could
provide a init script also but the one I knocked up isn't exactly best
practice.


Hope this helps.

Sarah.





On Thu, Nov 10, 2011 at 11:56 AM, Matthew Vickers <mvickers at quispiam.com>wrote:

>
> Sarah,
>
> Do you have a basic example of nginx and sockets you could share ?  I have
> been unable to get that setup to work, albeit I only spent a small amount
> of time on it.
>
> Matt
>
>
>
> ----- "Sarah Fuller" ** wrote:
> >
>
> Great job! One thing though and i could be wrong here so maybe someone
> more experienced will speak up. Anyway the point is with nginx Unix sockets
> are kinda awesome. Seems a shame to not have an example listed for them.
> On 10/11/2011 8:57 AM, "Assaf Gordon" <gordon at cshl.edu> wrote:
> >
>
>> Here's my latest draft:
>> >
>> https://github.com/agordon/Dancer/blob/topic/deployment_pod/lib/Dancer/Deployment.pod
>> >
>> > It's pretty much ready (from my narrow Apache point-of-view).
>> >
>> > 1. I have verified all the different apache configurations - they all
>> work (barring any typos).
>> >
>> > 2. included is a section on serving static files directly (requested by
>> someone on the mailing list).
>> >
>> > 3. Added a section on load-balancing in apache using mod_proxy_balancer
>> >
>> > 4. Elaborated about deploying multiple Dancer applications on same
>> server.
>> >
>> > 5. Simplified (IMHO) the configuration Stanzas - removed fluff like
>> "ServerName" etc. which is not always relevant.
>> >
>> > 6. Change some of the Apache configuration examples, the old POD show
>> changing the "documentroot" - that's not needed.
>> >
>> > 7. with NGINX+Proxy, simplified the example, removed fluff, and made it
>> use TCP socket instead of a unix socket - to be more in line with the other
>> examples.
>> >
>> > 8. Other stuff - copied as-is. I'm not familiar with those things (e.g.
>> PerlBal, Balance, UBic, etc.) - so proofreading is still required.
>> >
>> >
>> > Comments and corrections are welcomed,
>> >  -gordon
>> > _______________________________________________
>> > Dancer-users mailing list
>> > Dancer-users at perldancer.org
>> > http://www.backup-manager.org/cgi-bin/listinfo/dancer-users
>> >
>>
>
> > _______________________________________________ Dancer-users mailing
> list Dancer-users at perldancer.org
> http://www.backup-manager.org/cgi-bin/listinfo/dancer-users **
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.backup-manager.org/pipermail/dancer-users/attachments/20111110/d91907ef/attachment-0001.htm>


More information about the Dancer-users mailing list