sqqqqquid

This commit is contained in:
John Bintz 2012-05-16 20:33:40 -04:00
parent b5b2bf2b90
commit 3b6ff0cfa6
10 changed files with 112 additions and 53 deletions

View File

@ -1,3 +0,0 @@
class god-debian {
}

View File

@ -0,0 +1,31 @@
class squid::debian($version, $config_template) {
$squid_user = 'squid'
$squid_group = 'squid'
user { $squid_user: uid => 6574 }
class { 'squid':
version => $version,
user => 'squid',
config_template => $config_template,
require => User['squid']
}
init_d_bundle { 'squid':
init_d_prolog => template('squid/debian/init-d-prolog'),
init_d_prerun => template('squid/debian/init-d-prerun'),
require => Class['squid']
}
exec { 'ensure-data-dir-ownership':
command => "chown -R ${squid_user}:${squid_group} ${squid::data}",
path => $base::path,
require => Class['squid']
}
logrotate_d { 'squid':
postrotate => 'service squid rotate',
pattern => "${squid::log}/access.log"
}
}

View File

@ -0,0 +1,47 @@
class squid($version, $user, $config_template) {
$build_command = template('squid/build-squid.sh')
$log_dir = log_path($name)
$pid = pid_path($name)
$data_dir = data_path($name)
$config_dir = config_path($name)
$config = "${config_dir}/squid.conf"
file { [ $log_dir, $data_dir, $config_dir ]:
ensure => directory
}
build_and_install { $name:
version => $version,
source => "http://www.squid-cache.org/Versions/v3/3.1/squid-${version}.tar.bz2",
configure => template('squid/configure'),
preconfigure => template('squid/preconfigure')
}
$squid_imgsrc_ip = extlookup('squid_imgsrc_ip')
$squid_cache_dir_size = extlookup('squid_cache_dir_size')
$config = '/etc/squid3/squid.conf'
file { $config:
content => template($config_template),
require => Exec['build-squid']
}
exec { 'squid -z':
require => [ File['/var/log/squid3'], File['/var/spool/squid3'] ],
path => '/usr/bin:/usr/sbin:/bin:/sbin',
unless => 'test -d /var/spool/squid3/10'
}
god_conf { $name: }
file { [
'/usr/share/squid3/errors/en/ERR_CANNOT_FORWARD',
'/usr/share/squid3/errors/templates/ERR_CANNOT_FORWARD'
]:
content => template('squid/error_page.html'),
require => Build_and_install['squid']
}
}

View File

@ -0,0 +1,33 @@
--disable-maintainer-mode \
--disable-dependency-tracking \
--srcdir=. \
--datadir=<%= data_dir %> \
--sysconfdir=<%= config_dir %> \
--enable-inline \
--enable-async-io=24 \
--enable-storeio=aufs \
--enable-removal-policies="heap,lru" \
--enable-delay-pools \
--enable-cache-digests \
--enable-kill-parent-hack \
--with-dl \
--with-aio \
--enable-zph-qos \
--disable-ipv6 \
--disable-unlinkd \
--disable-wccp \
--disable-wccpv2 \
--disable-ident-lookups \
--disable-auth \
--enable-follow-x-forwarded-for \
--enable-arp-acl \
--enable-esi \
--disable-translation \
--with-logdir=<%= log_dir %> \
--with-pidfile=<%= pid %> \
--with-filedescriptors=65536 \
--with-large-files \
--enable-linux-netfilter \
--with-default-user=<%= user %> \
--with-squid=<%= build_dir %> \
--enable-ltdl-convenience

View File

@ -0,0 +1 @@
CHOST="i686-pc-linux-gnu" CFLAGS="-O2 -pipe -fomit-frame-pointer"

View File

@ -1,19 +0,0 @@
class varnish-debian($version, $store_file_mb => '1024') {
$varnish_user = 'varnish'
$varnish_group = 'web'
user { $varnish_user:
ensure => present,
uid => 25678,
groups => [ 'web' ],
require => Group['web']
}
class { varnish:
version => $version,
require => Package[$packages],
store_file_mb
}
}

View File

@ -1,2 +0,0 @@
VARNISH_USERNAME=<%= varnish_user %>
VARNISH_GROUP=<%= varnish_group %>

View File

@ -1,13 +0,0 @@
### BEGIN INIT INFO
# Provides: varnish
# Required-Start: $local_fs $remote_fs $network
# Required-Stop: $local_fs $remote_fs $network
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: Start HTTP accelerator
# Description: This script provides a server-side cache
# to be run in front of a httpd and should
# listen on port 80 on a properly configured
# system
### END INIT INFO

View File

@ -1,15 +0,0 @@
class varnish-default-vcl {
$backend_port = '8080'
$assets_age = 86400
$no_ttl_time = "10m"
$healthy_grace_time = "1m"
$sick_grace_time = "24h"
$probe_interval = "3s"
file { $varnish::vcl_path:
content => template('varnish-default-vcl/default.vcl'),
require => [ Build_and_install[$name], Mkdir_p[$config_path] ],
}
}