Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
tree: 2095b50c38
Fetching contributors…

Octocat-spinner-32-eaf2f5

Cannot retrieve contributors at this time

file 69 lines (56 sloc) 1.719 kb
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69
# .deb files generated by the dpkg-buildpackage may change with new versions
package :varnish do
  noop do
    pre :install, 'svn co http://varnish-cache.org/svn/tags/varnish-2.0.6 /tmp/varnish >/dev/null 2>&1'
    pre :install, 'ls && cd /tmp/varnish/varnish-cache && dpkg-buildpackage >/dev/null 2>&1'
    pre :install, 'dpkg -i /tmp/varnish/libvarnish1_2.0.6-2_i386.deb >/dev/null 2>&1'
    pre :install, 'dpkg -i /tmp/varnish/varnish_2.0.6-2_i386.deb >/dev/null 2>&1'
  end

  verify do
    has_executable '/usr/sbin/varnishd'
  end

  requires :subversion, :varnish_deps
end

package :varnish_deps do
  apt 'autotools-dev automake1.9 libtool autoconf libncurses-dev xsltproc quilt'
end

package :varnish_config do
  noop do
    post :install, '/etc/init.d/varnish stop'
  end

  requires :varnish_cfg, :varnish_vcl
end

package :varnish_cfg do
  config_file = '/etc/default/varnish'
  config_text = %q[
# varnish-config
NFILES=131072
MEMLOCK=82000
DAEMON_OPTS="-a :80 -f /etc/varnish/default.vcl -s file,/var/lib/varnish/varnish_storage.bin,1G"
].lstrip

  push_text config_text, config_file do
    pre :install, "touch #{config_file} && rm #{config_file} && touch #{config_file}" # clear the file
  end

  verify do
    file_contains config_file, 'varnish-config'
  end
end

package :varnish_vcl do
  config_file = '/etc/varnish/default.vcl'
  config_text = %q[
# varnish-config

backend default {
.host = "127.0.0.1";
.port = "8080";
}

sub vcl_recv {
unset req.http.cookie;
}
].lstrip

  push_text config_text, config_file do
    pre :install, "touch #{config_file} && rm #{config_file} && touch #{config_file}" # clear the file
  end

  verify do
    file_contains config_file, 'varnish-config'
  end
end
Something went wrong with that request. Please try again.