Commit d4552555 authored by Lasse Karstensen's avatar Lasse Karstensen

Moving Redhat packaging files out of the tree.

Redhat packaging files for the official varnish-cache.org
RPMs will from now on live in a separate git repository.

This decouples source releases (including release tagging) and
the packaging work, which makes the release process easier.
parent dd0e126a
Packaging
=========
Varnish Cache packaging files are kept outside of the main distribution.
The main reason for this is to decouple the development work from the packaging work.
We want to be able to tag a release and do a tarball release without having
to wait for the packagers to finish their work/changes.
Official packages
-----------------
The official Debian and Redhat packages are built by the Varnish Cache team
and made available on http://repo.varnish-cache.org/ .
Packaging files for Debian:
git://git.varnish-cache.org/varnish-cache-debian.git
Packaging files for Redhat:
https://github.com/varnish/varnish-cache-redhat
Scripts that run the builds are available on:
https://github.com/varnish/pkg-varnish-cache
Third-party packages
--------------------
Varnish Cache is built and packaged in many different operating systems and
distributions. Please see the wiki for more information.
#
EXTRA_DIST = \
README.redhat \
varnish.initrc \
varnish.logrotate \
varnish_reload_vcl \
varnish.spec \
varnish.sysconfig \
varnishlog.initrc \
varnishncsa.initrc \
varnish.params \
varnish.service \
varnishncsa.service \
varnishlog.service \
find-provides
GCC
===
Varnish requires a GCC-compiler compatible with the compiler used to
build varnish with. This means GCC 3.4.6 on a standard RHEL4 system.
Varnish should work fine with GCC 3.3 and above.
Building a RPM package from a git checkout
==========================================
You may build an rpm package direct from a git checkout. Here is an
example on how you may do this:
git clone git://git.varnish-cache.org/varnish-cache
cd varnish-cache
sed -i "s/^Release: .*/Release: 0.git$(date +%Y%m%d)%{?dist}/" \
redhat/varnish.spec
./autogen.sh && ./configure
make dist && rpmbuild -ts varnish-trunk.tar.gz
This builds a source rpm. Then you can, for example on a RHEL5 system,
do something like this:
rpmbuild --define "dist .el5" --rebuild /path/to/varnish-3.0-0.git20110203.src.rpm
Configuration of addresses and ports
====================================
In this package, varnish is configured to make the accelerator daemon
listen to port 6081. The administration interface listens to port 6082
on 127.0.0.1. Addresses and ports can be changed in
/etc/sysconfig/varnish.
The admin interface can be accessed by standard telnet.
The default config will try to forward http requests to
localhost:80. You may change this in /etc/varnish/vcl.conf. Please
read the vcl(7) man page for more information on the vcl language.
To gain actual value from varnish, you may want to move the listening
port to port 80, and your webserver to 8080 or similar.
Running with jemalloc on ppc or ppc64 on fedora: Edit and recompile
===================================================================
To get a package through to Fedora, it has to build in Red Hat's Koji
build environment. Their ppc and ppc64 builders run mock on a RHEL
ppc64 kernel. Our use of jemalloc does not work on this kernel, and
the build stays unsuccessful. As ppc64 is not the primary target of
varnish development, it may take some time to get this bug fixed.
To get the package through to Fedora, jemalloc is disabled in the ppc
and ppc64 builds.
Now, varnish with jemalloc enabled is known to work at least on the
ppc (32bit) kernel in Fedora 9. If you run on ppc, and have a workload
that suits jemalloc better, you might want to change the specfile and
recompile. We would very much like feedback from anyone running
varnish on Fedora's own ppc64 kernel.
#! /bin/sh
# This script is used to inject the Varnish ABI into the provides.
set -x
if [ -x /usr/lib/rpm/redhat/find-provides ]; then
/usr/lib/rpm/redhat/find-provides "$@"
elif [ -x /usr/lib/rpm/find-provides ]; then
/usr/lib/rpm/find-provides "$@"
fi
cd $(dirname $0)/..
printf '#include "vcs_version.h"\nVCS_Version\n' \
| cpp - -Iinclude | sed -e '/^"/!d' -e 's/\"//g' -e 's/^/varnishabi-strict-/'
printf '#include "vrt.h"\nvarnishabi- VRT_MAJOR_VERSION . VRT_MINOR_VERSION\n' \
| cpp - -Iinclude \
| sed -e '/^varnishabi-/!d' -e 's/U//g' -e 's/ //g'
#! /bin/sh
#
# varnish Control the Varnish Cache
#
# chkconfig: - 90 10
# description: Varnish is a high-perfomance HTTP accelerator
# processname: varnishd
# config: /etc/sysconfig/varnish
# pidfile: /var/run/varnish.pid
### BEGIN INIT INFO
# Provides: varnish
# Required-Start: $network $local_fs $remote_fs
# Required-Stop: $network $local_fs $remote_fs
# Default-Start:
# Default-Stop:
# Should-Start: $syslog
# Short-Description: start and stop varnishd
# Description: Varnish is a high-perfomance HTTP accelerator
### END INIT INFO
# Source function library.
. /etc/init.d/functions
retval=0
pidfile=/var/run/varnish.pid
exec="/usr/sbin/varnishd"
reload_exec="/usr/sbin/varnish_reload_vcl"
prog="varnishd"
config="/etc/sysconfig/varnish"
lockfile="/var/lock/subsys/varnish"
# Include varnish defaults
[ -e /etc/sysconfig/varnish ] && . /etc/sysconfig/varnish
start() {
if [ ! -x $exec ]
then
echo $exec not found
exit 5
fi
if [ ! -f $config ]
then
echo $config not found
exit 6
fi
echo -n "Starting Varnish Cache: "
# Open files (usually 1024, which is way too small for varnish)
ulimit -n ${NFILES:-131072}
# Varnish wants to lock shared memory log in memory.
ulimit -l ${MEMLOCK:-82000}
# Maximum number of threads (default in CentOS is 1024, which
# is often too small for varnish)
ulimit -u ${NPROCS:-unlimited}
# If defined, set maximum core size.
if [ -n "${DAEMON_COREFILE_LIMIT}" ]
then
ulimit -c ${DAEMON_COREFILE_LIMIT}
fi
# $DAEMON_OPTS is set in /etc/sysconfig/varnish. At least, one
# has to set up a backend, or /tmp will be used, which is a bad idea.
if [ "$DAEMON_OPTS" = "" ]; then
echo "\$DAEMON_OPTS empty."
echo -n "Please put configuration options in $config"
return 6
else
# Varnish always gives output on STDOUT
daemon --pidfile $pidfile $exec -P $pidfile "$DAEMON_OPTS" > /dev/null 2>&1
retval=$?
if [ $retval -eq 0 ]
then
touch $lockfile
echo_success
echo
else
echo_failure
echo
fi
return $retval
fi
}
stop() {
echo -n "Stopping Varnish Cache: "
killproc -p $pidfile $prog
retval=$?
echo
[ $retval -eq 0 ] && rm -f $lockfile
return $retval
}
restart() {
stop
start
}
reload() {
if [ "$RELOAD_VCL" = "1" ]
then
$reload_exec
else
force_reload
fi
}
force_reload() {
restart
}
rh_status() {
status -p $pidfile $prog
}
rh_status_q() {
rh_status >/dev/null 2>&1
}
configtest() {
if [ -f "$VARNISH_VCL_CONF" ]; then
$exec -f "$VARNISH_VCL_CONF" -C "$DAEMON_OPTS" -n /tmp > /dev/null && echo "Syntax ok"
else
echo "VARNISH_VCL_CONF is unset or does not point to a file"
fi
}
# See how we were called.
case "$1" in
start)
rh_status_q && exit 0
$1
;;
stop)
rh_status_q || exit 0
$1
;;
restart)
$1
;;
reload)
rh_status_q || exit 7
$1
;;
force-reload)
force_reload
;;
status)
rh_status
;;
condrestart|try-restart)
rh_status_q || exit 0
restart
;;
configtest)
configtest
;;
*)
echo "Usage: $0 {start|stop|status|restart|condrestart|try-restart|reload|force-reload}"
exit 2
esac
exit $?
/var/log/varnish/varnish.log /var/log/varnish/varnishncsa.log {
missingok
notifempty
sharedscripts
delaycompress
postrotate
/bin/kill -HUP `cat /var/run/varnishlog.pid 2>/dev/null` 2> /dev/null || true
/bin/kill -HUP `cat /var/run/varnishncsa.pid 2>/dev/null` 2> /dev/null || true
endscript
}
# Varnish environment configuration description. This was derived from
# the old style sysconfig/defaults settings
# Set this to 1 to make systemd reload try to switch vcl without restart.
RELOAD_VCL=1
# 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=192.168.1.5
VARNISH_LISTEN_PORT=6081
# Admin interface listen address and port
VARNISH_ADMIN_LISTEN_ADDRESS=127.0.0.1
VARNISH_ADMIN_LISTEN_PORT=6082
# Shared secret file for admin interface
VARNISH_SECRET_FILE=/etc/varnish/secret
# Backend storage specification, see Storage Types in the varnishd(5)
# man page for details.
VARNISH_STORAGE="file,/var/lib/varnish/varnish_storage.bin,1G"
# Default TTL used when the backend does not specify one
VARNISH_TTL=120
# User and group for the varnishd worker processes
VARNISH_USER=varnish
VARNISH_GROUP=varnish
# Other options, see the man page varnishd(1)
#DAEMON_OPTS="-p thread_pool_min=5 -p thread_pool_max=500 -p thread_pool_timeout=300"
[Unit]
Description=Varnish a high-perfomance HTTP accelerator
After=syslog.target network.target
[Service]
#
# If you want to make changes to this file, please copy it to
# /etc/systemd/system/varnish.service and make your changes there.
# This will override the file kept at /lib/systemd/system/varnish.service
#
# Enviroment variables may be found in /etc/varnish/varnish.params
#
# Maximum number of open files (for ulimit -n)
LimitNOFILE=131072
# Locked shared memory (for ulimit -l)
# Default log size is 82MB + header
LimitMEMLOCK=82000
# Maximum size of the corefile.
LimitCORE=infinity
EnvironmentFile=/etc/varnish/varnish.params
Type=forking
PIDFile=/var/run/varnish.pid
PrivateTmp=true
ExecStart=/usr/sbin/varnishd \
-P /var/run/varnish.pid \
-f $VARNISH_VCL_CONF \
-a ${VARNISH_LISTEN_ADDRESS}:${VARNISH_LISTEN_PORT} \
-T ${VARNISH_ADMIN_LISTEN_ADDRESS}:${VARNISH_ADMIN_LISTEN_PORT} \
-t $VARNISH_TTL \
-u $VARNISH_USER \
-g $VARNISH_GROUP \
-S $VARNISH_SECRET_FILE \
-s $VARNISH_STORAGE \
$DAEMON_OPTS
ExecReload=/usr/sbin/varnish_reload_vcl
[Install]
WantedBy=multi-user.target
This diff is collapsed.
# Configuration file for varnish
#
# /etc/init.d/varnish expects the variable $DAEMON_OPTS to be set from this
# shell script fragment.
#
# Maximum number of open files (for ulimit -n)
NFILES=131072
# Locked shared memory (for ulimit -l)
# Default log size is 82MB + header
MEMLOCK=82000
# Maximum number of threads (for ulimit -u)
NPROCS="unlimited"
# Maximum size of corefile (for ulimit -c). Default in Fedora is 0
# DAEMON_COREFILE_LIMIT="unlimited"
# Set this to 1 to make init script reload try to switch vcl without restart.
# To make this work, you need to set the following variables
# explicit: VARNISH_VCL_CONF, VARNISH_ADMIN_LISTEN_ADDRESS,
# VARNISH_ADMIN_LISTEN_PORT, VARNISH_SECRET_FILE, or in short,
# use Alternative 3, Advanced configuration, below
RELOAD_VCL=1
# 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 \
# -u varnish -g varnish \
# -s file,/var/lib/varnish/varnish_storage.bin,1G"
## 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 \
# -u varnish -g varnish \
# -S /etc/varnish/secret \
# -s file,/var/lib/varnish/varnish_storage.bin,1G"
## 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
#
# # Shared secret file for admin interface
VARNISH_SECRET_FILE=/etc/varnish/secret
#
# # The minimum number of worker threads to start
VARNISH_MIN_THREADS=50
#
# # The Maximum number of worker threads to start
VARNISH_MAX_THREADS=1000
#
# # Idle timeout for worker threads
VARNISH_THREAD_TIMEOUT=120
#
# # 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=256M
#
# # Backend storage specification
VARNISH_STORAGE="malloc,${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} \
-p thread_pool_min=${VARNISH_MIN_THREADS} \
-p thread_pool_max=${VARNISH_MAX_THREADS} \
-p thread_pool_timeout=${VARNISH_THREAD_TIMEOUT} \
-u varnish -g varnish \
-S ${VARNISH_SECRET_FILE} \
-s ${VARNISH_STORAGE}"
#
## Alternative 4, Do It Yourself. See varnishd(1) for more information.
#
# DAEMON_OPTS=""
#!/bin/bash
#
# reload vcl revisited
# A script that loads new vcl based on data from /etc/sysconfig/varnish
# Ingvar Hagelund <ingvar@redpill-linpro.com>
#
# This is free software, distributed under the standard 2 clause BSD license,
# see the LICENSE file in the Varnish documentation directory
#
# The following environment variables have to be set:
# RELOAD_VCL, VARNISH_VCL_CONF, VARNISH_ADMIN_LISTEN_PORT
# The following are optional:
# VARNISH_SECRET_FILE, VARNISH_ADMIN_LISTEN_ADDRESS
#
# Requires GNU bash and GNU date
#
debug=false
missing() {
echo "Missing configuration variable: $1"
exit 2
}
print_debug() {
echo "
Parsed configuration:
RELOAD_VCL=\"$RELOAD_VCL\"
VARNISH_VCL_CONF=\"$VARNISH_VCL_CONF\"
VARNISH_ADMIN_LISTEN_ADDRESS=\"$VARNISH_ADMIN_LISTEN_ADDRESS\"
VARNISH_ADMIN_LISTEN_PORT=\"$VARNISH_ADMIN_LISTEN_PORT\"
VARNISH_SECRET_FILE=\"$VARNISH_SECRET_FILE\"
"
}
# Fallback to the default configuration
if [ -z "$VARNISH_VCL_CONF" ]; then
. /etc/sysconfig/varnish
fi
$debug && print_debug
# Check configuration
if [ ! "$RELOAD_VCL" = "1" ]; then
echo "Error: RELOAD_VCL is not set to 1"
exit 2
elif [ -z "$VARNISH_VCL_CONF" ]; then
echo "Error: VARNISH_VCL_CONF is not set"
exit 2
elif [ ! -s "$VARNISH_VCL_CONF" ]; then
echo "Eror: VCL config $VARNISH_VCL_CONF is unreadable or empty"
exit 2
elif [ -z "$VARNISH_ADMIN_LISTEN_ADDRESS" ]; then
echo "Warning: VARNISH_ADMIN_LISTEN_ADDRESS is not set, using 127.0.0.1"
VARNISH_ADMIN_LISTEN_ADDRESS="127.0.0.1"
elif [ -z "$VARNISH_ADMIN_LISTEN_PORT" ]; then
echo "Error: VARNISH_ADMIN_LISTEN_PORT is not set"
exit 2
elif [ -z "$VARNISH_SECRET_FILE" ]; then
echo "Warning: VARNISH_SECRET_FILE is not set"
secret=""
elif [ ! -s "$VARNISH_SECRET_FILE" ]; then
echo "Error: varnish secret file $VARNISH_SECRET_FILE is unreadable or empty"
exit 2
else
secret="-S $VARNISH_SECRET_FILE"
fi
# Done parsing, set up command
VARNISHADM="varnishadm $secret -T $VARNISH_ADMIN_LISTEN_ADDRESS:$VARNISH_ADMIN_LISTEN_PORT"
# Now do the real work
new_config="reload_$(date +%FT%H:%M:%S)"
# Check if we are able to connect at all
if $VARNISHADM vcl.list > /dev/null; then
$debug && echo vcl.list succeeded
else
echo "Unable to run $VARNISHADM vcl.list"
exit 1
fi
if $VARNISHADM vcl.list | awk ' { print $3 } ' | grep -q $new_config; then
echo Trying to use new config $new_config, but that is already in use
exit 2
fi
current_config=$( $VARNISHADM vcl.list | awk ' /^active/ { print $3 } ' )
echo "Loading vcl from $VARNISH_VCL_CONF"
echo "Current running config name is $current_config"
echo "Using new config name $new_config"
if $VARNISHADM vcl.load $new_config $VARNISH_VCL_CONF; then
$debug && echo "$VARNISHADM vcl.load succeded"
else
echo "$VARNISHADM vcl.load failed"
exit 1
fi
if $VARNISHADM vcl.use $new_config; then
$debug && echo "$VARNISHADM vcl.use succeded"
else
echo "$VARNISHADM vcl.use failed"
exit 1
fi
$VARNISHADM vcl.list
echo Done
exit 0
#! /bin/sh
#
# varnishlog Control the Varnish logging daemon
#
# chkconfig: - 90 10
# description: Varnish Cache logging daemon
# processname: varnishlog
# config:
# pidfile: /var/run/varnishlog.pid
### BEGIN INIT INFO
# Provides: varnishlog
# Required-Start: $network $local_fs $remote_fs
# Required-Stop: $network $local_fs $remote_fs
# Default-Start:
# Default-Stop:
# Short-Description: start and stop varnishlog
# Description: Varnish Cache logging daemon
### END INIT INFO
# Source function library.
. /etc/init.d/functions
retval=0
pidfile="/var/run/varnishlog.pid"
lockfile="/var/lock/subsys/varnishlog"
logfile="/var/log/varnish/varnish.log"
exec="/usr/bin/varnishlog"
prog="varnishlog"
DAEMON_OPTS="-a -w $logfile -D -P $pidfile"
# Include varnishlog defaults
[ -e /etc/sysconfig/varnishlog ] && . /etc/sysconfig/varnishlog
start() {
if [ ! -x $exec ]
then
echo $exec not found
exit 5
fi
echo -n "Starting varnish logging daemon: "
daemon --pidfile $pidfile $exec "$DAEMON_OPTS"
echo
return $retval
}
stop() {
echo -n "Stopping varnish logging daemon: "
killproc -p $pidfile $prog
retval=$?
echo
[ $retval -eq 0 ] && rm -f $lockfile
return $retval
}
restart() {
stop
start
}
reload() {
restart
}
force_reload() {
restart
}
rh_status() {
status -p $pidfile $prog
}
rh_status_q() {
rh_status >/dev/null 2>&1
}
# See how we were called.
case "$1" in
start)
rh_status_q && exit 0
$1
;;
stop)
rh_status_q || exit 0
$1
;;
restart)
$1
;;
reload)
rh_status_q || exit 7
$1
;;
force-reload)
force_reload
;;
status)
rh_status
;;
condrestart|try-restart)
rh_status_q || exit 0
restart
;;
*)
echo "Usage: $0 {start|stop|status|restart|condrestart|try-restart|reload|force-reload}"
exit 2
esac
exit $?
[Unit]
Description=Varnish HTTP accelerator logging daemon
After=varnish.service
[Service]
Type=forking
PIDFile=/run/varnishlog.pid
ExecStart=/usr/bin/varnishlog -a -w /var/log/varnish/varnish.log -D -P /run/varnishlog.pid
[Install]
WantedBy=multi-user.target
#! /bin/sh
#
# varnishncsa Control the Varnish NCSA logging daemon
#
# chkconfig: - 90 10
# description: Varnish Cache logging daemon
# processname: varnishncsa
# config:
# pidfile: /var/run/varnishncsa.pid
### BEGIN INIT INFO
# Provides: varnishncsa
# Required-Start: $network $local_fs $remote_fs
# Required-Stop: $network $local_fs $remote_fs
# Default-Start:
# Default-Stop:
# Short-Description: start and stop varnishncsa
# Description: Varnish Cache NCSA logging daemon
### END INIT INFO
# Source function library.
. /etc/init.d/functions
retval=0
pidfile="/var/run/varnishncsa.pid"
lockfile="/var/lock/subsys/varnishncsa"
logfile="/var/log/varnish/varnishncsa.log"
exec="/usr/bin/varnishncsa"
prog="varnishncsa"
DAEMON_OPTS="-a -w $logfile -D -P $pidfile"
# Include varnishncsa defaults
[ -e /etc/sysconfig/varnishncsa ] && . /etc/sysconfig/varnishncsa
start() {
if [ ! -x $exec ]
then
echo $exec not found
exit 5
fi
echo -n "Starting varnish ncsa logging daemon: "
daemon --pidfile $pidfile $exec "$DAEMON_OPTS"
echo
return $retval
}
stop() {
echo -n "Stopping varnish ncsa logging daemon: "
killproc -p $pidfile $prog
retval=$?
echo
[ $retval -eq 0 ] && rm -f $lockfile
return $retval
}
restart() {
stop
start
}
reload() {
restart
}
force_reload() {
restart
}
rh_status() {
status -p $pidfile $prog
}
rh_status_q() {
rh_status >/dev/null 2>&1
}
# See how we were called.
case "$1" in
start)
rh_status_q && exit 0
$1
;;
stop)
rh_status_q || exit 0
$1
;;
restart)
$1
;;
reload)
rh_status_q || exit 7
$1
;;
force-reload)
force_reload
;;
status)
rh_status
;;
condrestart|try-restart)
rh_status_q || exit 0
restart
;;
*)
echo "Usage: $0 {start|stop|status|restart|condrestart|try-restart|reload|force-reload}"
exit 2
esac
exit $?
[Unit]
Description=Varnish HTTP accelerator NCSA daemon
After=varnish.service
[Service]
Type=forking
PIDFile=/run/varnishncsa.pid
ExecStart=/usr/bin/varnishncsa -a -w /var/log/varnish/varnishncsa.log -D -P /run/varnishncsa.pid
[Install]
WantedBy=multi-user.target
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment