From 030fdb6d250785561f90e4c43efbf7148e5b9868 Mon Sep 17 00:00:00 2001 From: ingvar Date: Wed, 16 May 2007 21:08:43 +0000 Subject: [PATCH] * Wed May 16 2007 Ingvar Hagelund - 1.0.svn-20070516 - Wrapping up for 1.0.4 - Changes in sysconfig and init scripts. Syncing with files in trunk/debian git-svn-id: svn+ssh://projects.linpro.no/svn/varnish/trunk@1440 d4fa192b-c00b-0410-8231-f00ffab90ce4 --- varnish-cache/redhat/varnish.initrc | 33 ++++--- varnish-cache/redhat/varnish.spec | 15 ++-- varnish-cache/redhat/varnish.sysconfig | 119 ++++++++++++++++--------- varnish-cache/redhat/varnishlog.initrc | 33 +++---- 4 files changed, 115 insertions(+), 85 deletions(-) diff --git a/varnish-cache/redhat/varnish.initrc b/varnish-cache/redhat/varnish.initrc index f65c7af3..106bbd52 100755 --- a/varnish-cache/redhat/varnish.initrc +++ b/varnish-cache/redhat/varnish.initrc @@ -13,16 +13,21 @@ RETVAL=0 PROCNAME=varnishd +PIDFILE=/var/run/varnish.pid +LOCKFILE=/var/lock/subsys/varnish +# Include varnish defaults . /etc/sysconfig/varnish -if [ "$DAEMON" = "" ]; then DAEMON="/usr/sbin/varnishd"; fi -DAEMON_OPTS="-a ${VARNISH_LISTEN_ADDRESS}:${VARNISH_LISTEN_PORT} \ - -h ${VARNISH_HASHOPTION} \ - -f ${VARNISH_VCL_CONF} \ - -T ${VARNISH_ADMIN_LISTEN_ADDRESS}:${VARNISH_ADMIN_LISTEN_PORT} \ - -t ${VARNISH_TTL} \ - -w ${VARNISH_MIN_WORKER_THREADS},${VARNISH_MAX_WORKER_THREADS},${VARNISH_WORKER_THREAD_TIMEOUT} \ - -s ${VARNISH_BACKEND_STORAGE}" + +DAEMON="/usr/sbin/varnishd" + +# $DAEMON_OPTS is set in /etc/sysconfig/varnish. At least, one +# have to set up a backend. +if [ "$DAEMON_OPTS" = "" ]; then + echo "No values specified in DAEMON_OPTS. Please read the varnishd(1)" + echo "manpage and put configuration options in /etc/sysconfig/varnish" + exit 1 +fi mkdir -p /var/run/varnish 2>/dev/null @@ -34,14 +39,14 @@ ulimit -n ${NFILES} case "$1" in start) echo -n "Starting varnish HTTP accelerator: " - daemon $DAEMON "$DAEMON_OPTS" + daemon --pidfile ${PIDFILE} ${DAEMON} "$DAEMON_OPTS" -P ${PIDFILE} sleep 1 pkill -0 $PROCNAME RETVAL=$? if [ $RETVAL -eq 0 ] then echo_success - touch /var/lock/subsys/varnish + touch $LOCKFILE else echo_failure fi @@ -49,19 +54,19 @@ case "$1" in ;; stop) echo -n "Stopping varnish HTTP accelerator: " - killproc $DAEMON + killproc -p $PIDFILE $DAEMON RETVAL=$? if [ $RETVAL -eq 0 ] then echo_success - rm -f /var/lock/subsys/varnish + rm -f $LOCKFILE $PIDFILE else echo_failure fi echo ;; status) - status $PROCNAME + status -p $PIDFILE $PROCNAME RETVAL=$? ;; restart|reload) @@ -70,7 +75,7 @@ case "$1" in RETVAL=$? ;; condrestart) - if [ -f /var/lock/subsys/varnish ]; then + if [ -f $PIDFILE ]; then $0 stop $0 start RETVAL=$? diff --git a/varnish-cache/redhat/varnish.spec b/varnish-cache/redhat/varnish.spec index cfbbccb1..4d93439d 100644 --- a/varnish-cache/redhat/varnish.spec +++ b/varnish-cache/redhat/varnish.spec @@ -1,7 +1,7 @@ Summary: Varnish is a high-performance HTTP accelerator Name: varnish Version: 1.0.svn -Release: 20070511%{?dist} +Release: 20070516%{?dist} License: BSD-like Group: System Environment/Daemons URL: http://www.varnish-cache.org/ @@ -62,7 +62,7 @@ sed -i 's|^runpath_var=LD_RUN_PATH|runpath_var=DIE_RPATH_DIE|g' libtool %{__make} %{?_smp_mflags} -sed -e ' s/8080/80/g ' etc/vcl.conf > redhat/vcl.conf +sed -e ' s/8080/80/g ' etc/default.vcl > redhat/default.vcl %install rm -rf %{buildroot} @@ -77,7 +77,7 @@ find %{buildroot}/%{_libdir}/ -name '*.so' -type l -exec rm -f {} ';' mkdir -p %{buildroot}/var/lib/varnish mkdir -p %{buildroot}/var/log/varnish -%{__install} -D -m 0644 redhat/vcl.conf %{buildroot}%{_sysconfdir}/varnish/vcl.conf +%{__install} -D -m 0644 redhat/default.vcl %{buildroot}%{_sysconfdir}/varnish/default.vcl %{__install} -D -m 0644 redhat/varnish.sysconfig %{buildroot}%{_sysconfdir}/sysconfig/varnish %{__install} -D -m 0644 redhat/varnish.logrotate %{buildroot}%{_sysconfdir}/logrotate.d/varnish %{__install} -D -m 0755 redhat/varnish.initrc %{buildroot}%{_sysconfdir}/init.d/varnish @@ -94,9 +94,9 @@ rm -rf %{buildroot} %{_var}/log/varnish %{_mandir}/man1/*.1* %{_mandir}/man7/*.7* -%doc INSTALL LICENSE README redhat/README.redhat redhat/vcl.conf ChangeLog +%doc INSTALL LICENSE README redhat/README.redhat redhat/default.vcl ChangeLog %dir %{_sysconfdir}/varnish/ -%config(noreplace) %{_sysconfdir}/varnish/vcl.conf +%config(noreplace) %{_sysconfdir}/varnish/default.vcl %config(noreplace) %{_sysconfdir}/sysconfig/varnish %config(noreplace) %{_sysconfdir}/logrotate.d/varnish %{_sysconfdir}/init.d/varnish @@ -137,6 +137,11 @@ fi %postun libs -p /sbin/ldconfig %changelog +* Wed May 16 2007 Ingvar Hagelund - 1.0.svn-20070516 +- Wrapping up for 1.0.4 +- Changes in sysconfig and init scripts. Syncing with files in + trunk/debian + * Fri May 11 2007 Ingvar Hagelund - 1.0.svn-20070511 - Threw latest changes into svn trunk - Removed the conversion of manpages into utf8. They are all utf8 in trunk diff --git a/varnish-cache/redhat/varnish.sysconfig b/varnish-cache/redhat/varnish.sysconfig index dfd2b3bb..2a410f98 100644 --- a/varnish-cache/redhat/varnish.sysconfig +++ b/varnish-cache/redhat/varnish.sysconfig @@ -1,54 +1,87 @@ +# Configuration file for varnish # -# Default variables for varnish +# /etc/init.d/varnish expects the variable $DAEMON_OPTS to be set from this +# shell script fragment. # -# The main daemon binary -VARNISHD=/usr/sbin/varnish - -# VCL Configuration file. This is the "main configuration file" -VARNISH_VCL_CONF=/etc/varnish/vcl.conf - - -# Default address and port to bind to. -# To make varnish accept normal http traffic, -# change the listen port to 80 -VARNISH_LISTEN_ADDRESS=0.0.0.0 -VARNISH_LISTEN_PORT=6081 - - -# Telnet admin interface listen address and port -VARNISH_ADMIN_LISTEN_ADDRESS=127.0.0.1 -VARNISH_ADMIN_LISTEN_PORT=6082 - - -# The minimum number of threads to start -VARNISH_MIN_WORKER_THREADS=1 - - -# Maximum number of worker threads -VARNISH_MAX_WORKER_THREADS=1000 - - -# Timeout value in seconds for threads to return -VARNISH_WORKER_THREAD_TIMEOUT=10 - +# Maximum number of open files (for ulimit -n) +NFILES=131072 -# Hash algorithm to be used -VARNISH_HASHOPTION=classic +# This file contains 4 alternatives, please use only one. +## Alternative 1, Minimal configuration, no VCL +# +# Listen on port 6081, administration on localhost:6082, and forward to +# content server on localhost:8080. Use a fixed-size cache file. +# +DAEMON_OPTS="-a :6081 \ + -T localhost:6082 \ + -b localhost:8080 \ + -s file,/var/lib/varnish/varnish_storage.bin,1G" -# Maximum size of the backend storagefile in bytes -VARNISH_BACKEND_STORAGE_SIZE=10240000 -VARNISH_BACKEND_STORAGE_FILE=/var/lib/varnish/varnish_storage.bin +## Alternative 2, Configuration with VCL +# +# Listen on port 6081, administration on localhost:6082, and forward to +# one content server selected by the vcl file, based on the request. Use a +# fixed-size cache file. +# +# DAEMON_OPTS="-a :6081 \ +# -T localhost:6082 \ +# -f /etc/varnish/default.vcl \ +# -s file,/var/lib/varnish/varnish_storage.bin,1G" -# Backend storage specification -VARNISH_BACKEND_STORAGE="file,${VARNISH_BACKEND_STORAGE_FILE},${VARNISH_BACKEND_STORAGE_SIZE}" +## Alternative 3, Advanced configuration +# +# See varnishd(1) for more information. +# +# # Main configuration file. You probably want to change it :) +# VARNISH_VCL_CONF=/etc/varnish/default.vcl +# +# # Default address and port to bind to +# # Blank address means all IPv4 and IPv6 interfaces, otherwise specify +# # a host name, an IPv4 dotted quad, or an IPv6 address in brackets. +# VARNISH_LISTEN_ADDRESS= +# VARNISH_LISTEN_PORT=6081 +# +# # Telnet admin interface listen address and port +# VARNISH_ADMIN_LISTEN_ADDRESS=127.0.0.1 +# VARNISH_ADMIN_LISTEN_PORT=6082 +# +# # The minimum number of worker threads to start +# VARNISH_MIN_THREADS=1 +# +# # The Maximum number of worker threads to start +# VARNISH_MAX_THREADS=1000 +# +# # Idle timeout for worker threads +# VARNISH_THREAD_TIMEOUT=120 +# +# # Cache file location +# VARNISH_STORAGE_FILE=/var/lib/varnish/varnish_storage.bin +# +# # Cache file size: in bytes, optionally using k / M / G / T suffix, +# # or in percentage of available disk space using the % suffix. +# VARNISH_STORAGE_SIZE=1G +# +# # Backend storage specification +# VARNISH_STORAGE="file,${VARNISH_STORAGE_FILE},${VARNISH_STORAGE_SIZE}" +# +# # Default TTL used when the backend does not specify one +# VARNISH_TTL=120 +# +# # DAEMON_OPTS is used by the init script. If you add or remove options, make +# # sure you update this section, too. +# DAEMON_OPTS="-a ${VARNISH_LISTEN_ADDRESS}:${VARNISH_LISTEN_PORT} \ +# -f ${VARNISH_VCL_CONF} \ +# -T ${VARNISH_ADMIN_LISTEN_ADDRESS}:${VARNISH_ADMIN_LISTEN_PORT} \ +# -t ${VARNISH_TTL} \ +# -w ${VARNISH_MIN_THREADS},${VARNISH_MAX_THREADS},${VARNISH_THREAD_TIMEOUT} \ +# -s ${VARNISH_STORAGE}" +# -# Set default ttl in secounds -VARNISH_TTL=120 -# The Maximum number of open files (ulimit) -# Default : 131072 (system default is usually 1024) -NFILES=131072 +## Alternative 4, Do It Yourself. See varnishd(1) for more information. +# +# DAEMON_OPTS="" diff --git a/varnish-cache/redhat/varnishlog.initrc b/varnish-cache/redhat/varnishlog.initrc index a801f4c5..d8119582 100644 --- a/varnish-cache/redhat/varnishlog.initrc +++ b/varnish-cache/redhat/varnishlog.initrc @@ -14,23 +14,10 @@ RETVAL=0 PROCNAME=varnishlog -. /etc/sysconfig/varnish - -if [ "$LOGDAEMON" = "" ] -then - DAEMON="/usr/bin/varnishlog" -else - DAEMON="$LOGDAEMON" -fi - -if [ "$LOGPIDFILE" = "" ] -then - PIDFILE="/var/run/varnish/varnishlog.pid" -else - PIDFILE="$LOGPIDFILE" -fi - -if [ "$LOGFILE" = "" ]; then LOGFILE="/var/log/varnish/varnish.log"; fi +DAEMON="/usr/bin/varnishlog" +PIDFILE="/var/run/varnish/varnishlog.pid" +LOCKFILE="/var/lock/subsys/varnishlog" +LOGFILE="/var/log/varnish/varnish.log" DAEMON_OPTS="-a -w ${LOGFILE} -D -P $PIDFILE" @@ -40,14 +27,14 @@ mkdir -p /var/run/varnish 2>/dev/null case "$1" in start) echo -n "Starting varnish logging daeon: " - daemon $DAEMON "$DAEMON_OPTS" + daemon --pidfile $PIDFILE $DAEMON "$DAEMON_OPTS" sleep 1 pkill -0 $PROCNAME RETVAL=$? if [ $RETVAL -eq 0 ] then echo_success - touch /var/lock/subsys/varnishlog + touch $LOCKFILE else echo_failure fi @@ -55,19 +42,19 @@ case "$1" in ;; stop) echo -n "Stopping varnish logging daemon: " - killproc $DAEMON + killproc -p $PIDFILE $DAEMON RETVAL=$? if [ $RETVAL -eq 0 ] then echo_success - rm -f /var/lock/subsys/varnishlog + rm -f $LOCKFILE $PIDFILE else echo_failure fi echo ;; status) - status $PROCNAME + status -p $PIDFILE $PROCNAME RETVAL=$? ;; restart|reload) @@ -76,7 +63,7 @@ case "$1" in RETVAL=$? ;; condrestart) - if [ -f /var/lock/subsys/varnishlog ]; then + if [ -f $PIDFILE ]; then $0 stop $0 start RETVAL=$? -- 2.39.5