[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: squid internet object cache and various how-to questions



You (Craig Sanders) wrote:
> I'm making a debian package of the Squid Internet Object Cache (the 
> freeware descendant of the now-commercial Harvest Cached).  Useful for
> people who want to run apache but need a proxy cache as well.

Great! I have just installed it here and it seems to run well. I was
thinking about making a debian package for this myself but if
you want to maintain it that's even better ;)

> I've got the package ready in very simple form, but it has no fancy
> postinst scripts or anything to do auto-configuration etc.  I've just
> started running it myself, so I wouldn't even know where to start doing
> auto config stuff yet...that'll have to wait until I have a better feel
> for the package.

There's not much to be configured, the only things are:
- RAM cahce size
- disk cache size
- access restrictions

> I have set up it's conffiles: /etc/squid.conf and /etc/init.d/squid - a 
> first for me, none of my previous packages really required conffiles.  
> Learn something new every day :-)
> 
> OK, what I want to know is, should I release this now, or should I wait 
> until I've got time to do some smarter postinst stuff like grepping for 
> hostname and inserting that in /etc/squid.conf etc etc etc.

I think it would be better to wait, as this sounds as an "alpha" release.
If you release it now chances are that this will be part of the final
1.1 release. Not bad at all (would be great to have) but if you are
not sure the package is bugfree...

> Not knowing much about autoconf, I just hacked the various Makefile.in
> files to insert $(debprefix) before $(bindir) etc in relevant places
> such as the install rule, and also make sure that log files went to
> /var/log/squid/* rather than squid's $(localstatedir)/logs.

No, just configure it with configure -prefix=/usr/lib/squid (I think
that is the appropriate location for it) and adjust the rest of the
stuff, like log file locations, in the configuration file.

Do not hack the install part of the Makefile - this is a small package
and you can easily write the installation part (to debian-tmp/usr/lib/squid/..)
by hand in the debian.rules file.

> Then I build the binary with debprefix undefined, and install it with
> debprefix=debian-tmp/
> 
> This works for me, and seems like a reasonably elegant solution (i.e.
> minimal changes to the original source)....just wondering if anyone has
> a better/cleaner/tidier way?

Yeah just move the instalation part to the debain.rules file..

> Also, I suppose it's a good idea to run 'make realclean' to clean up the 
> autoconf stuff before making the source archive or the .diff.gz file?  
> Not doing this could cause some confusion/difficulties for porters to 
> other architectures.

Yep.

Another thing is that squid (the beta7) regulary crashes on our
site. Therefor it is mandatory that you run it with the RunCache
wrapper. I have put some hard work in a /etc/init.d/squid file
to get this right, so I might as well post it here so that you
don't have to reinvent the wheel. Ofcourse you'll have to adjust
the pathnames a bit. As you can see I chose /var/spool/squid for
the cahce directory, which is the "right" location IMHO.

---------------------
#! /bin/sh
#
# squid		Startup script for the SQUID caching HTTP server.
#		This one is a bit different then usual because
#		a it has a shell script wrapper around it to watch
#		over it.
#
# Version:	@(#)squid.rc  1.00  18-May-1996  MvS.
#

PATH=/bin:/usr/bin:/sbin:/usr/sbin
DIR=/usr/local/squid/bin

case "$1" in
  start)
    # If a server is running, do not restart.
    pid="`pidof -o %PPID -o $$ $DIR/squid`"
    if [ "$pid" = "" ]
    then
	echo "starting squid through RunCache..."
	cd /var/spool/squid
	$DIR/RunCache < /dev/null > /dev/console 2>&1 &
	sleep 2
    fi
    ;;
  stop)
    # First kill the watch process, then the daemon.
    kill -9 "`pidof -o %PPID -o $$ $DIR/RunCache`" > /dev/null 2>&1
    start-stop-daemon --stop --verbose --exec $DIR/squid
    ;;
  reload)
    echo "Reloading squid configuration files"
    start-stop-daemon --stop --signal 1 --quiet --exec $DIR/squid
    ;;
  *)
    echo "Usage: /etc/init.d/squid {start|stop|reload}"
    exit 1
    ;;
esac

exit 0
=============================================

Mike.
-- 
  Miquel van    | Cistron Internet Services   --    Alphen aan den Rijn.
  Smoorenburg,  | mailto:info@cistron.nl          http://www.cistron.nl/
miquels@het.net | Tel: +31-172-419445 (Voice) 430979 (Fax) 442580 (Data)


Reply to: