My first formula: Squid Proxy Server

Clint Byrum clint at ubuntu.com
Tue Aug 16 18:28:35 UTC 2011


Excerpts from Ahmed Kamal's message of Tue Aug 16 10:06:16 -0700 2011:
> On 08/16/2011 06:18 PM, Vincenzo Ciaglia wrote:
> > Hi all, i've written my very first formula for Ensemble as my starting
> > point in the Project. It's about Squid Proxy Server.
> >
> > It is in Revision 1 and we should start from here to work with other
> > related services:
> > http://bazaar.launchpad.net/~vciaglia/+junk/ensemble-dev/files/head:/squid/

First, this is great! Thanks for your interest. A few points:

* Unless you intend to assign copyright to Canonical, you may want
to adjust the Copyright notice in the copyright file to be your own
copyrights.  Also make sure GPL-3 is your desired license for the formula.

* I'm curious why you added squid-common to the apt-get line. Apt
automatically resolves dependencies, so you shouldn't actually need to
specify this.

* This formula won't actually do anything, as squid's default config
is to only provide caching for 127.0.0.1. You'll need to modify squid's
config file to provide access to your desired clients. If your intention is
to run squid as a standalone proxy for various netmasks, you can do this 
through config settings:

https://ensemble.ubuntu.com/docs/drafts/service-config.html

Note that this link may change, check:

https://ensemble.ubuntu.com/docs/

For its new location if you get a 404.


So you would have a config.yaml something like

options:
    name: netmasks
    description: netmasks to grant access to
    type: str

And then once you deploy you do

ensemble set my-squid-service netmasks="192.168.1.0/24 192.168.2.0/24"

Which you'd then need to somehow get into squid's configuration file with
a config-changed hook. Augeas has a squid lense.. might start there.

Also you need to add an 'open-port' command to tell ensemble what ports the
service provides. 3128 is the default, so thats probably the one you want.
Since squid is running as of the installation, you can open-port there.


> Hi Vincenzo,
> 
> Great news! I'm glad you're enjoying ensemble, and are progressing at a 
> huge rate. I noticed there was a squid formula bug, which I've assigned 
> to you
> https://bugs.launchpad.net/principia/+bug/819424
> 
> You mention doing more complex formulas, but I actually think squid 
> could grow into something much more complex. For example, in the context 
> of being deployed as a service, it would probably need to be configured 
> in caching reverse-proxy mode, and would need to relate to web servers 

Squid has a nice use case for forward proxy too.. while not as common in
Ensemble's world, there are times where one needs to go fetch URLs and cache
those results.. for instance an RSS feed reader web app that needs to refresh
periodically.

These can all be relations.

Vincenzo, I suggest you look at the haproxy formula for examples of how to
do a reverseproxy. :)

And, as Ahmed suggested, please do come in to #ubuntu-ensemble if you get
blocked.




More information about the Ensemble mailing list