SHA256
1
0
forked from pool/varnish

Accepting request 107492 from server:http

- Update to new upstream release 3.0.2
* Add support for ESI and gzip
* Handle objects larger than 2G
* HTTP Range support is now enabled by default
* "307 Temporary redirect" is now considered cacheable
* see ChangeLog (packaged) or
  http://varnish-cache.org/trac/browser/doc/changes.rst
  for details
- Note that the -s file,/var/cache/varnish,524288 argument (check
  /etc/sysconfig/varnish) needs at least "1M" instead of 524288
  or the daemon will not start anymore.
- Add systemd unit files

OBS-URL: https://build.opensuse.org/request/show/107492
OBS-URL: https://build.opensuse.org/package/show/openSUSE:Factory/varnish?expand=0&rev=6
This commit is contained in:
Stephan Kulow 2012-03-12 19:17:17 +00:00 committed by Git OBS Bridge
commit b9e8021716
9 changed files with 344 additions and 118 deletions

View File

@ -1,3 +0,0 @@
version https://git-lfs.github.com/spec/v1
oid sha256:09a97dabbc081a28f3b4530491fcbc6f2510ee9964794e24cbc9f1f6935340ef
size 886945

3
varnish-3.0.2.tar.xz Normal file
View File

@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:81243b849308defc2996ed72a1f4acc1351b3ae4ce8fc57d608d0e9429581f9e
size 1101616

View File

@ -1,7 +1,58 @@
-------------------------------------------------------------------
Wed Feb 8 23:26:10 UTC 2012 - jengelh@medozas.de
- Update to new upstream release 3.0.2
* Add support for ESI and gzip
* Handle objects larger than 2G
* HTTP Range support is now enabled by default
* "307 Temporary redirect" is now considered cacheable
* see ChangeLog (packaged) or
http://varnish-cache.org/trac/browser/doc/changes.rst
for details
- Note that the -s file,/var/cache/varnish,524288 argument (check
/etc/sysconfig/varnish) needs at least "1M" instead of 524288
or the daemon will not start anymore.
- Add systemd unit files
-------------------------------------------------------------------
Thu Dec 8 13:51:14 UTC 2011 - coolo@suse.com
- fix license to be in spdx.org format
-------------------------------------------------------------------
Tue May 10 14:01:13 UTC 2011 - crrodriguez@opensuse.org
- Varnish Requires a C compiler, the vcl scripts are compiled
and loaded as DSO.
-------------------------------------------------------------------
Sat Apr 16 17:26:10 UTC 2011 - crrodriguez@opensuse.org
- remove configure option --enable-debugging-symbols
it overrides buildsystem optimization levels.
-------------------------------------------------------------------
Sat Apr 16 17:12:11 UTC 2011 - crrodriguez@opensuse.org
- Update to version 2.1.5
* Two bugs relating to Content-Length and possible duplication
of Content-Length headers have been resolved.
* Fixed an issue with re-using connections after Chunked-Encoding.
* Use the time of cache-insertion for "If-Modified-Since" requests
if a "Last-Modified" header isn't provided by the backend.
* Merge multi-line Vary and Cache-Control headers from clients,
which Google Chromium seem to split up.
-------------------------------------------------------------------
Fri Apr 15 22:36:02 UTC 2011 - mrueckert@suse.de
- use pkgconfig instead of pkg-config on SLES 9
-------------------------------------------------------------------
Sun Apr 3 23:38:24 UTC 2011 - jengelh@medozas.de
- Fix security-problematic ownership of /etc/varnish files
(bnc#678811)
- Run spec-beautifier over it
- Replace default shipped vcl.conf by something working
- Run as varnish user

View File

@ -79,13 +79,10 @@ case "$1" in
echo -n "Starting varnish "
## Start daemon with startproc(8). If this fails
## the return value is set appropriately by startproc.
/sbin/startproc "$VARNISHD_BIN" -P "$VARNISHD_PID" ${VARNISHD_PARAMS:--f /etc/varnish/vcl.conf -T:6082 -s file,/var/cache/varnish,524288 -u varnish}
/sbin/startproc "$VARNISHD_BIN" -P "$VARNISHD_PID" ${VARNISHD_PARAMS:--f /etc/varnish/vcl.conf -T:6082 -s file,/var/cache/varnish,1M -u varnish}
# Remember status and be verbose
rc_status -v
echo -n "Starting varnishlog "
/sbin/startproc "$VARNISHLOG_BIN" -P "$VARNISHLOG_PID" ${VARNISHLOG_PARAMS:--a -w /var/log/varnish/varnish.log}
rc_status -v
;;
stop)
echo -n "Shutting down varnish "
@ -96,8 +93,6 @@ case "$1" in
# Remember status and be verbose
rc_status -v
echo -n "Shutting down varnishlog "
/sbin/killproc -p "$VARNISHLOG_PID" "$VARNISHLOG_BIN"
;;
try-restart|condrestart)
## Do a restart only if the service was active before.
@ -149,8 +144,6 @@ case "$1" in
/sbin/killproc -p "$VARNISHD_PID" -HUP "$VARNISHD_BIN"
#touch /var/run/varnish.pid
rc_status -v
echo -n "Reload service varnishlog "
/sbin/killproc -p "$VARNISHLOG_PID" -HUP "$VARNISHLOG_BIN"
## Otherwise if it does not support reload:
#rc_failed 3
@ -174,9 +167,6 @@ case "$1" in
# NOTE: rc_status knows that we called this init script with
# "status" option and adapts its messages accordingly.
rc_status -v
echo -n "Checking for service varnishlog "
/sbin/checkproc -p "$VARNISHLOG_PID" "$VARNISHLOG_BIN"
rc_status -v
;;
probe)
## Optional: Probe for the necessity of a reload, print out the

11
varnish.service Normal file
View File

@ -0,0 +1,11 @@
[Unit]
Description=Varnish HTTP accelerator/reverse proxy
After=network.target
[Service]
EnvironmentFile=/etc/sysconfig/varnish
PIDFile=/var/run/varnishd.pid
ExecStart=/usr/sbin/varnishd $VARNISHD_PARAMS -P /var/run/varnishd.pid -F
[Install]
WantedBy=multi-user.target

View File

@ -1,7 +1,7 @@
#
# spec file for package varnish
# spec file for package varnish (Version 2.0.5)
#
# Copyright (c) 2011 SUSE LINUX Products GmbH, Nuernberg, Germany.
# Copyright (c) 2009 SUSE LINUX Products GmbH, Nuernberg, Germany.
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
@ -15,35 +15,40 @@
# Please submit bugfixes or comments via http://bugs.opensuse.org/
#
# norootforbuild
Name: varnish
Version: 2.1.3
Release: 5
#
License: BSD
%define library_name libvarnishapi1
Version: 3.0.2
Release: 0
Summary: Varnish is a high-performance HTTP accelerator
License: BSD-2-Clause
Group: Productivity/Networking/Web/Proxy
#
BuildRoot: %{_tmppath}/%{name}-%{version}-build
BuildRequires: libxslt ncurses-devel pcre-devel pkg-config
URL: http://varnish-cache.org/
#DL-URL: http://downloads.sf.net/varnish/%name-%version.tar.bz2
Source0: %name-%version.tar.xz
Source2: varnish.init
Source3: varnish.sysconfig
Source4: vcl.conf
Source5: varnish.logrotate
Source6: varnishlog.init
Source7: varnish.service
Source8: varnishlog.service
BuildRoot: %_tmppath/%name-%version-build
BuildRequires: libxslt, ncurses-devel, pcre-devel
BuildRequires: pkgconfig, xz
Prereq(post): %_sbindir/useradd %_sbindir/groupadd
%if 0%{?suse_version}
%if 0%{?suse_version} >= 1010
Recommends: logrotate
%endif
%if 0%{?suse_version} >= 1210
BuildRequires: systemd
%{?systemd_requires}
%endif
%define pkg_home %_localstatedir/lib/%name
%define pkg_logdir %_localstatedir/log/%name
%define pkg_cachedir %_localstatedir/cache/%name
#
Url: http://www.varnish-cache.org/
Source0: http://downloads.sourceforge.net/varnish/varnish-%version.tar.gz
# http://downloads.sourceforge.net/varnish/varnish-%version.tar.bz2
Source2: varnish.init
Source3: varnish.sysconfig
Source4: vcl.conf
Source5: varnish.logrotate
#
Summary: Varnish is a high-performance HTTP accelerator
Requires: c_compiler
%description
Varnish is an HTTP accelerator. An HTTP accelerator (often called Reverse
@ -55,18 +60,8 @@ given the cached document, or a "fresh" document requested from a backend
server. The purpose of this is to minimize the requests going to the backend
server(s) by serving the same document to potentially many users.
Authors:
--------
Poul-Henning Kamp <phk@phk.freebsd.dk>
%define library_name libvarnish1
%package -n %library_name
Group: Productivity/Networking/Web/Proxy
#
Summary: Shared libraries for Varnish
%description -n %library_name
@ -79,21 +74,11 @@ given the cached document, or a "fresh" document requested from a backend
server. The purpose of this is to minimize the requests going to the backend
server(s) by serving the same document to potentially many users.
This package holds the shared libraries for varnish.
Authors:
--------
Poul-Henning Kamp <phk@phk.freebsd.dk>
%package devel
Group: Development/Libraries/C and C++
Requires: %name = %version
#
Summary: Development files for Varnish
%description devel
@ -106,15 +91,8 @@ given the cached document, or a "fresh" document requested from a backend
server. The purpose of this is to minimize the requests going to the backend
server(s) by serving the same document to potentially many users.
This package holds the development files for varnish.
Authors:
--------
Poul-Henning Kamp <phk@phk.freebsd.dk>
%prep
%setup -q
@ -122,36 +100,39 @@ Authors:
%if 0%{?suse_version} > 1000
export CFLAGS="%optflags -fstack-protector"
%endif
%configure --disable-static --localstatedir=%_localstatedir/cache/ \
--enable-debugging-symbols \
%configure --disable-static \
--localstatedir=%_localstatedir/cache/ \
--enable-developer-warnings
make %{?_smp_mflags}
%install
b="%buildroot";
%makeinstall
find %buildroot -ls
# There is no use for them to normal users
mv %buildroot/%_bindir/* %buildroot/%_sbindir/
#
# remove unneeded files
# libvarnish.la has -lrt as dependency lib
#rm -fv %buildroot%_libdir/*.la
mv "$b/%_bindir"/* "$b/%_sbindir/";
#
##missing directories
install -d -m 0755 %buildroot{%pkg_logdir,%pkg_home}
install -D -m 0644 %{S:5} %buildroot%_sysconfdir/logrotate.d/varnish
install -dm 0755 "$b"/{%pkg_logdir,%pkg_home};
install -Dpm 0644 "%{S:5}" "$b/%_sysconfdir/logrotate.d/varnish";
#
##init scripts
install -D -m 0644 %{S:3} %buildroot/var/adm/fillup-templates/sysconfig.%name
install -D -m 0755 %{S:2} %buildroot%_sysconfdir/init.d/%name
ln -s -f %_sysconfdir/init.d/%name %buildroot%_sbindir/rc%name
install -Dpm 0644 "%{S:3}" "$b/var/adm/fillup-templates/sysconfig.%name";
install -Dpm 0755 "%{S:2}" "$b/%_initddir/varnish";
install -Dpm 0755 "%{S:6}" "$b/%_initddir/varnishlog";
%if 0%{?_unitdir:1}
install -Dpm 0644 "%{S:7}" "$b/%_unitdir/varnish.service";
install -Dpm 0644 "%{S:8}" "$b/%_unitdir/varnishlog.service";
%endif
mkdir -p "$b/%_sbindir";
ln -s "%_initddir/varnish" "$b/%_sbindir/rcvarnish";
ln -s "%_initddir/varnishlog" "$b/%_sbindir/rcvarnishlog";
#
##config files
install -D -m 0644 %{S:4} %buildroot%_sysconfdir/%name/vcl.conf
install -D -m 0644 %{S:4} %buildroot%_sysconfdir/%name/vcl.conf.example
install -Dpm 0644 %{S:4} "$b/%_sysconfdir/%name/vcl.conf";
install -Dpm 0644 %{S:4} "$b/%_sysconfdir/%name/vcl.conf.example";
find "%buildroot" -type f -name "*.la" -delete
mkdir -p "%buildroot/%_localstatedir/log/varnish"
find "$b" -type f -name "*.la" -delete
mkdir -p "$b/%pkg_logdir"
%pre
%_bindir/getent group varnish >/dev/null || \
@ -159,59 +140,76 @@ mkdir -p "%buildroot/%_localstatedir/log/varnish"
%_bindir/getent passwd varnish >/dev/null || \
%_sbindir/useradd -g varnish -s /bin/false -r -c "user for Varnish" \
-d %pkg_home varnish || :
%if 0%{?suse_version}
%post
%fillup_and_insserv %name
%preun
%stop_on_removal %name
%postun
%restart_on_update %name
%insserv_cleanup
%else
# how to do the same for RH/mandriva?
%if 0%{?_unitdir:1}
%service_add_pre varnish.service
%service_add_pre varnishlog.service
%endif
%post -n %library_name -p /sbin/ldconfig
%post
%fillup_and_insserv varnish
%fillup_and_insserv varnishlog
%if 0%{?_unitdir:1}
%service_add_post varnish.service
%service_add_post varnishlog.service
%endif
%preun
%stop_on_removal varnish
%stop_on_removal varnishlog
%if 0%{?_unitdir:1}
%service_del_preun varnish.service
%service_del_preun varnishlog.service
%endif
%postun
# Does not sysv+systemd very much conflict? But rpmlint wants to have it...
%restart_on_update varnish
%restart_on_update varnishlog
%if 0%{?_unitdir:1}
%service_del_postun varnish.service
%service_del_postun varnishlog.service
%endif
%insserv_cleanup
%post -n %library_name -p /sbin/ldconfig
%postun -n %library_name -p /sbin/ldconfig
%files
%defattr(-,root,root,-)
%defattr(-,root,root)
%_initddir/varnish
%_initddir/varnishlog
%if 0%{?_unitdir:1}
%_unitdir
%endif
%config(noreplace) %_sysconfdir/logrotate.d/varnish
%dir %attr(0750,root,varnish) %_sysconfdir/%name/
%config(noreplace) %attr(0640,root,varnish) %_sysconfdir/%name/vcl.conf
%config %attr(0640,root,varnish) %_sysconfdir/%name/vcl.conf.example
%config(noreplace) %attr(0640,root,varnish) %_sysconfdir/%name/default.vcl
%_libdir/varnish
%_sbindir/varnish*
%_sbindir/rcvarnish*
%_mandir/man*/*
%doc ChangeLog LICENSE README
%dir %attr(0750,varnish,varnish) %pkg_home
%dir %attr(0750,varnish,varnish) %pkg_cachedir
%dir %attr(0750,varnish,varnish) %pkg_logdir
%if 0%{?suse_version}
%_sbindir/rc%name
/var/adm/fillup-templates/sysconfig.%name
%_localstatedir/adm/fillup-templates/sysconfig.%name
%else
%config(noreplace) %_sysconfdir/sysconfig/%name
%endif
%config(noreplace) %_sysconfdir/init.d/%name
#
%dir %attr(750,root,varnish) %_sysconfdir/%name/
%config(noreplace) %attr(640,root,varnish) %_sysconfdir/%name/vcl.conf
%config %attr(640,root,varnish) %_sysconfdir/%name/vcl.conf.example
%config(noreplace) %attr(640,root,varnish) %_sysconfdir/%name/default.vcl
#
%_sbindir/*
%doc %_mandir/*/*
%doc ChangeLog LICENSE README
%if ! 0%{?suse_version}
%doc redhat/README.redhat
%endif
%dir %attr(750,varnish,varnish) %pkg_home
%dir %attr(750,varnish,varnish) %pkg_cachedir
%config(noreplace) %_sysconfdir/logrotate.d/varnish
%dir %attr(750,varnish,varnish) %_localstatedir/log/varnish
%files -n %library_name
%defattr(-,root,root,-)
%_libdir/*.so.*
%_libdir/libvarnishapi.so.1*
%files devel
%defattr(-,root,root,-)
%_includedir/varnish/
%_includedir/varnish
%_libdir/pkgconfig/*
%_libdir/*.so
%_libdir/libvarnishapi.so
%changelog

View File

@ -10,7 +10,7 @@
#
# You might want to keep "/var/cache/varnish" when using the file backend.
#
VARNISHD_PARAMS="-f /etc/varnish/vcl.conf -T:6082 -s file,/var/cache/varnish,524288 -u varnish"
VARNISHD_PARAMS="-f /etc/varnish/vcl.conf -T:6082 -s file,/var/cache/varnish,1M -u varnish"
## Path: Network/WWW/Varnishd
## Description: Start parameters for varnishlog

164
varnishlog.init Normal file
View File

@ -0,0 +1,164 @@
#!/bin/sh
#
### BEGIN INIT INFO
# Provides: varnishlog
# Required-Start: $syslog $remote_fs
# Should-Start: $time ypbind sendmail
# Required-Stop: $syslog $remote_fs
# Should-Stop: $time ypbind sendmail
# Default-Start: 3 5
# Default-Stop: 0 1 2 6
# Short-Description: varnish logger
# Description: varnish logger
### END INIT INFO
# Check for missing binaries (stale symlinks should not happen)
# Note: Special treatment of stop for LSB conformance
VARNISH_BIN=/usr/sbin/varnishd
test -x $VARNISH_BIN || { echo "$VARNISH_BIN not installed";
if [ "$1" = "stop" ]; then exit 0;
else exit 5; fi; }
# Check for existence of needed config file and read it
VARNISH_CONFIG=/etc/sysconfig/varnish
test -r $VARNISH_CONFIG || { echo "$VARNISH_CONFIG not existing";
if [ "$1" = "stop" ]; then exit 0;
else exit 6; fi; }
VARNISHD_BIN="$VARNISH_BIN"
VARNISHD_PID=/var/run/varnishd.pid
VARNISHLOG_BIN=/usr/sbin/varnishncsa
VARNISHLOG_PID=/var/run/varnishlog.pid
# Read config
. $VARNISH_CONFIG
# Source LSB init functions
# providing start_daemon, killproc, pidofproc,
# log_success_msg, log_failure_msg and log_warning_msg.
# This is currently not used by UnitedLinux based distributions and
# not needed for init scripts for UnitedLinux only. If it is used,
# the functions from rc.status should not be sourced or used.
#. /lib/lsb/init-functions
# Shell functions sourced from /etc/rc.status:
# rc_check check and set local and overall rc status
# rc_status check and set local and overall rc status
# rc_status -v be verbose in local rc status and clear it afterwards
# rc_status -v -r ditto and clear both the local and overall rc status
# rc_status -s display "skipped" and exit with status 3
# rc_status -u display "unused" and exit with status 3
# rc_failed set local and overall rc status to failed
# rc_failed <num> set local and overall rc status to <num>
# rc_reset clear both the local and overall rc status
# rc_exit exit appropriate to overall rc status
# rc_active checks whether a service is activated by symlinks
. /etc/rc.status
# Reset status of this service
rc_reset
# Return values acc. to LSB for all commands but status:
# 0 - success
# 1 - generic or unspecified error
# 2 - invalid or excess argument(s)
# 3 - unimplemented feature (e.g. "reload")
# 4 - user had insufficient privileges
# 5 - program is not installed
# 6 - program is not configured
# 7 - program is not running
# 8--199 - reserved (8--99 LSB, 100--149 distrib, 150--199 appl)
#
# Note that starting an already running service, stopping
# or restarting a not-running service as well as the restart
# with force-reload (in case signaling is not supported) are
# considered a success.
case "$1" in
start)
echo -n "Starting varnishlog "
/sbin/startproc "$VARNISHLOG_BIN" -P "$VARNISHLOG_PID" ${VARNISHLOG_PARAMS:--a -w /var/log/varnish/varnish.log}
rc_status -v
;;
stop)
echo -n "Shutting down varnishlog "
/sbin/killproc -p "$VARNISHLOG_PID" "$VARNISHLOG_BIN"
rc_status -v
;;
try-restart|condrestart)
## Do a restart only if the service was active before.
## Note: try-restart is now part of LSB (as of 1.9).
## RH has a similar command named condrestart.
if test "$1" = "condrestart"; then
echo "${attn} Use try-restart ${done}(LSB)${attn} rather than condrestart ${warn}(RH)${norm}"
fi
$0 status
if test $? = 0; then
$0 restart
else
rc_reset # Not running is not a failure.
fi
# Remember status and be quiet
rc_status
;;
restart)
## Stop the service and regardless of whether it was
## running or not, start it again.
$0 stop
$0 start
# Remember status and be quiet
rc_status
;;
force-reload)
## Signal the daemon to reload its config. Most daemons
## do this on signal 1 (SIGHUP).
## If it does not support it, restart the service if it
## is running.
"$0" reload
rc_status
## Otherwise:
#$0 try-restart
#rc_status
;;
reload)
## Like force-reload, but if daemon does not support
## signaling, do nothing (!)
echo -n "Reload service varnishlog "
/sbin/killproc -p "$VARNISHLOG_PID" -HUP "$VARNISHLOG_BIN"
rc_status -v
;;
status)
## Check status with checkproc(8), if process is running
## checkproc will return with exit status 0.
# Return value is slightly different for the status command:
# 0 - service up and running
# 1 - service dead, but /var/run/ pid file exists
# 2 - service dead, but /var/lock/ lock file exists
# 3 - service not running (unused)
# 4 - service status unknown :-(
# 5--199 reserved (5--99 LSB, 100--149 distro, 150--199 appl.)
echo -n "Checking for service varnishlog "
/sbin/checkproc -p "$VARNISHLOG_PID" "$VARNISHLOG_BIN"
rc_status -v
;;
probe)
## Optional: Probe for the necessity of a reload, print out the
## argument to this init script which is required for a reload.
## Note: probe is not (yet) part of LSB (as of 1.9)
test /etc/sysconfig/varnish -nt "$VARNISHD_PID" && \
test -f /etc/varnish/default.vcl.net -nt "$VARNISHD_PID" && \
echo reload
;;
*)
echo "Usage: $0 {start|stop|status|try-restart|restart|force-reload|reload|probe}"
exit 1
;;
esac
rc_exit

12
varnishlog.service Normal file
View File

@ -0,0 +1,12 @@
[Unit]
Description=Varnish log generator
Requires=varnish.service
#After= is not required
[Service]
EnvironmentFile=/etc/sysconfig/varnish
PIDFile=/var/run/varnishlog.pid
ExecStart=/usr/sbin/varnishncsa $VARNISHLOG_PARAMS -P /var/run/varnishlog.pid
[Install]
WantedBy=multi-user.target