Skip to content

Instantly share code, notes, and snippets.

@ShadySQL
Forked from kimlindholm/gist:1819143
Last active August 29, 2015 14:08
Show Gist options
  • Save ShadySQL/49f3360457524a3af371 to your computer and use it in GitHub Desktop.
Save ShadySQL/49f3360457524a3af371 to your computer and use it in GitHub Desktop.
------ 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" [email protected]
contact.me.always_send warning critical
------ Slide 26 ------
[email protected]
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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment