When puppet meets nginx
At $WORK I started using Nginx a while ago, first as a front end to my mongrel instances for puppet. Recently I began to use it for one of its most know features : reverse proxy (and caching too). Of course this work had to be puppetized !
This is a summary of what I’ve done :
- Basic setup
- Automatic setup of the status page, exploited by a munin plugin
- An “include” directory, can be specific to a host through the usual $fqdn source selection system (as well as the nginx.conf file).
- A “reverse proxy” specific class that uses a template embedding some ruby (see the previous post). My cache dir is under tmpfs, to speed up the whole thing.
This setup is mostly inspired by this post. I use a local dnsmasq setup to resolve both internal & external requests. This way I can manage vhosts being accessible from inside ou outside our network. It’s incredibly flexible and allows you to get the most from your infrastructure.
The puppet class :
This is the munin plugins that are automatically distributed with the box.
One of the generated graphs :