#!/bin/sh # Set default varnish memory cache size if not specified if [ -z "$MEMSIZE" ]; then export MEMSIZE=64M fi # Set varnish secret if not specified if [ ! -f /etc/varnish/secret ]; then if [ -z "$SECRET" ]; then SECRET=`cat /proc/sys/kernel/random/uuid` fi echo $SECRET > /etc/varnish/secret fi echo "Secret is `cat /etc/varnish/secret`" # Check vcl syntax varnishd -C -f /etc/varnish/default.vcl > /dev/null || exit 1 exec /usr/sbin/varnishd -f /etc/varnish/default.vcl -a 0.0.0.0:80 -T 0.0.0.0:6082 -S /etc/varnish/secret -F -s malloc,${MEMSIZE} $@