Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Code snippets from presentation "Varnish Configuration Step by Step"
------ Slide 8 ------
sudo su -
yum install -y gcc make pkgconfig pcre-devel ncurses-devel
cd /usr/src
wget http://repo.varnish-cache.org/source/varnish-3.0.2.tar.gz -O - | tar xz
cd varnish-3.0.2
./configure
make && make install
exit
------ Slide 10 ------
varnishadm -T localhost:2000 ban.url "^/$"
varnishadm -T localhost:2000 ban.url "^/.*"
sudo /usr/local/sbin/varnishd -s malloc,130M -u nobody -g nobody -p cli_timeout=30 -p thread_pool_add_delay=2 -p thread_pool_min=400 -p thread_pool_max=4000 -p session_linger=100 -f /etc/varnish/<your_config>.vcl -T 127.0.0.1:2000 -a 0.0.0.0:80
------ Slide 12 ------
# If not yet installed: sudo yum install -y make
wget https://github.com/comotion/security.vcl/tarball/master -O - | tar xz
cd <comotion-security-dir>/vcl/
sudo make
cd ..
sudo ln -s $PWD/vcl/ /etc/varnish/security
include "/etc/varnish/security/main.vcl";
------ Slide 15 ------
sudo rpm -Uvh http://yum.newrelic.com/pub/newrelic/el5/x86_64/newrelic-repo-5-3.noarch.rpm
sudo yum install -y newrelic-sysmond
sudo nrsysmond-config --set license_key=<your_license_key>
sudo /etc/init.d/newrelic-sysmond start
------ Slide 19 ------
sudo su -
yum install -y munin-node munin
cd /usr/share/munin/plugins/
wget https://raw.github.com/munin-monitoring/contrib/master/plugins/varnish/varnish_allocated
wget https://raw.github.com/munin-monitoring/contrib/master/plugins/varnish/varnish_cachehitratio
wget https://raw.github.com/munin-monitoring/contrib/master/plugins/varnish/varnish_healthy_backends
wget https://raw.github.com/munin-monitoring/contrib/master/plugins/varnish/varnish_hitrate
wget https://raw.github.com/munin-monitoring/contrib/master/plugins/varnish/varnish_total_objects
chmod a+x /usr/share/munin/plugins/varnish_*
ln -s /usr/share/munin/plugins/varnish_* /etc/munin/plugins/
exit
------ Slide 20 ------
[varnish*]
user root
# Uncomment to set network traffic warning at 400K
# [if_*]
# env.warning 400000
contact.me.command mail -s "Munin notification" admin@example.com
contact.me.always_send warning critical
------ Slide 26 ------
MAILTO=admin@example.com
00 08 * * Mon root /etc/varnish/email_varnish_reports.sh
sudo yum install -y mutt
sudo service crond restart
------ Slide 28 ------
sudo yum install -y lighttpd
server.port = 8081
server.document-root = server_root + "/html"
$HTTP["remoteip"] !~ "127.0.0.1" {
url.access-deny = ( "" )
}
sudo service lighttpd start
------ Slide 31 ------
sudo su -
mkdir -p /package
cd /package
wget http://cr.yp.to/daemontools/daemontools-0.76.tar.gz
tar zxpf daemontools-0.76.tar.gz
rm -f daemontools-0.76.tar.gz
cd admin/daemontools-0.76
sed -i '/extern int errno/{s/^/\/* /;s/$/ *\//;G;s/$/#include <errno.h>/;}' src/error.h
package/install
mkdir /var/service
mkdir -m 1755 /var/service/varnish
------ Slide 33 ------
mkdir -m 755 /var/service/varnish/log
cd /var/service/varnish/log
wget http://qmail.jms1.net/scripts/service-any-log-run
mv service-any-log-run run
chmod 755 run
ln -s /var/service/varnish /service/varnish
svstat /service/varnish /service/varnish/log
------ Slide 34 ------
start on runlevel [12345]
stop on runlevel [^12345]
respawn
exec /command/svscanboot
@kimlindholm

This comment has been minimized.

Copy link
Owner Author

kimlindholm commented Feb 19, 2012

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.