Skip to content

Instantly share code, notes, and snippets.

@aslam
Forked from wearethefoos/varnish3.rb
Last active September 6, 2017 04:39
Show Gist options
  • Save aslam/022ec19fb9b1b1b96c99c09b2f43d9c3 to your computer and use it in GitHub Desktop.
Save aslam/022ec19fb9b1b1b96c99c09b2f43d9c3 to your computer and use it in GitHub Desktop.
Install Varnish-3.0.2 on OSX with homebrew
##
# Install Varnish 3.0.2 on OSX with the following Brew command:
# $> brew install https://gist.githubusercontent.com/aslam/022ec19fb9b1b1b96c99c09b2f43d9c3/raw/d731e4bb44830a352397e3cb79f1aea47bed6483/varnish3.rb
#
# You also might have to run:
# $> sudo brew link varnish3
# To symlink the install.
##
require 'formula'
class Varnish3 <Formula
url 'http://repo.varnish-cache.org/source/varnish-3.0.2.tar.gz'
homepage 'http://www.varnish-cache.org/'
sha256 '973f60625e9690e0989e1bbc73c37ea53fc6291b8f7b03d617b76f8084a4a243'
depends_on 'pkg-config' => :build
depends_on 'pcre' => :build
# needs
skip_clean :all
def install
# http://www.varnish-cache.org/trac/wiki/Installation
# system "./autogen.sh"
system "./configure", "--enable-debugging-symbols",
"--enable-developer-warnings",
"--enable-dependency-tracking",
"--disable-dependency-tracking",
"--prefix=#{prefix}",
"--localstatedir=#{var}"
system "make"
system "make install"
(var+'varnish3').mkpath
(prefix+'org.varnish-cache.varnishd.plist').write startup_plist
(prefix+'org.varnish-cache.varnishd.plist').chmod 0644
end
def startup_plist; <<-EOPLIST.undent
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>Label</key>
<string>org.varnish-cache.varnishd</string>
<key>ProgramArguments</key>
<array>
<string>/usr/local/sbin/varnishd</string>
<string>-f</string>
<string>config/varnish/authServer.vcl</string>
<string>-s</string>
<string>malloc,1G</string>
<string>-T</string>
<string>127.0.0.1:6083</string>
<string>-a</string>
<string>0.0.0.0:3002</string>
</array>
<key>KeepAlive</key>
<true/>
<key>RunAtLoad</key>
<true/>
<key>WorkingDirectory</key>
<string>/usr/local/sbin</string>
<key>StandardErrorPath</key>
<string>/var/log/varnish.log</string>
<key>StandardOutPath</key>
<string>/var/log/varnish.log</string>
</dict>
</plist>
EOPLIST
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment