From: ingvar Date: Thu, 19 Oct 2006 12:43:29 +0000 (+0000) Subject: Added build scripts for Red Hat rpm package X-Git-Url: https://err.no/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=27d4c0aa2dcd444b44f6e615f5b276f8d6eddf47;p=varnish Added build scripts for Red Hat rpm package git-svn-id: svn+ssh://projects.linpro.no/svn/varnish/trunk@1202 d4fa192b-c00b-0410-8231-f00ffab90ce4 --- diff --git a/varnish-cache/redhat/README.redhat b/varnish-cache/redhat/README.redhat new file mode 100644 index 00000000..9bb61844 --- /dev/null +++ b/varnish-cache/redhat/README.redhat @@ -0,0 +1,46 @@ +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. + + +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. + + +Builing a RPM package from SVN +=============================== +You may build the package from a svn checkout. Follow the instructions +at http://varnish.projects.linpro.no/wiki/Repository to get the +source. Then enter the trunk directory and edit +varnish-cache/redhat/varnish.spec. At least bump the version and/or +release numbers. Then use something like this to build the rpm package: + +#!/bin/bash +VERSION=$( awk ' /^Version:/ { print $2 } ' varnish-cache/redhat/varnish.spec ) +ln -s varnish-cache varnish-$VERSION +tar $( + find varnish-$VERSION/ -type d -name .svn | \ + while read i; do + echo -n "--exclude $i " + done +) -cvzf varnish-$VERSION.tar.gz varnish-$VERSION/* +rm varnish-$VERSION +rpmbuild -tb varnish-$VERSION.tar.gz + + diff --git a/varnish-cache/redhat/TODO b/varnish-cache/redhat/TODO new file mode 100644 index 00000000..e055efdb --- /dev/null +++ b/varnish-cache/redhat/TODO @@ -0,0 +1,5 @@ +Todolist for the rpm package + +* Perhaps add a default logger, adding Common Logfile Format logs +* Add the package to Fedora Extras + diff --git a/varnish-cache/redhat/varnish.initrc b/varnish-cache/redhat/varnish.initrc new file mode 100755 index 00000000..a99dac1a --- /dev/null +++ b/varnish-cache/redhat/varnish.initrc @@ -0,0 +1,74 @@ +#! /bin/sh +# +# varnish Control the varnish HTTP accelerator +# +# chkconfig: - 90 10 +# description: HTTP accelerator +# processname: varnishd +# config: /etc/varnish.conf +# pidfile: /var/run/varnish/varnishd.pid + +# Source function library. +. /etc/init.d/functions + +RETVAL=0 +PROCNAME=varnishd + +. /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}" + + +mkdir -p /var/run/varnish 2>/dev/null + +# See how we were called. +case "$1" in + start) + echo -n "Starting varnish HTTP accelerator: " + daemon $DAEMON "$DAEMON_OPTS" + sleep 1 + pkill -0 $PROCNAME + RETVAL=$? + if [ $RETVAL -eq 0 ] + then + echo_success + touch /var/lock/subsys/varnishd + else + echo_failure + fi + echo + ;; + stop) + echo -n "Stopping varnish HTTP accelerator: " + killproc $DAEMON + RETVAL=$? + if [ $RETVAL -eq 0 ] + then + echo_success + rm -f /var/lock/subsys/varnishd + else + echo_failure + fi + echo + ;; + status) + status $PROCNAME + RETVAL=$? + ;; + restart|reload) + $0 stop + $0 start + RETVAL=$? + ;; + *) + echo "Usage: $0 {start|stop|status|restart}" + exit 1 +esac + +exit $RETVAL diff --git a/varnish-cache/redhat/varnish.spec b/varnish-cache/redhat/varnish.spec new file mode 100644 index 00000000..90ba529c --- /dev/null +++ b/varnish-cache/redhat/varnish.spec @@ -0,0 +1,126 @@ +Summary: Varnish is a high-performance HTTP accelerator. +Name: varnish +Version: 1.0.2 +Release: 6 +License: BSD-like +Group: System Environment/Daemons +URL: http://www.varnish-cache.org/ +Packager: Ingvar Hagelund +Source0: %{name}-%{version}.tar.gz +BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root +BuildRequires: gcc gcc-c++ ncurses-devel libtool autoconf automake +Requires: gcc ncurses kernel >= 2.6.0 + +%description +This is the Varnish high-performance HTTP accelerator. +Documentation and additional information about Varnish is available on +the following web sites: + http://www.varnish-cache.org/ Official web site + http://varnish.projects.linpro.no/ Developer site and wiki + +Technical questions about Varnish and this release should be addressed +to . + +Questions about commercial support and services related to Varnish +should be addressed to . + +Copyright (c) 2006 Verdens Gang AS +Copyright (c) 2006 Linpro AS +All rights reserved. +Author: Poul-Henning Kamp + +%prep +%setup -q + +%build +rm -rf $RPM_BUILD_ROOT + +./autogen.sh +%configure --sbindir=/usr/sbin +%{__make} + +sed -e ' s/8080/80/g ' etc/vcl.conf > redhat/vcl.conf + +%install +%{makeinstall} +mkdir -p %{buildroot}%{_sbindir} +mkdir -p %{buildroot}%{_docdir}/%{name}-%{version} +mkdir -p %{buildroot}/etc/varnish +mkdir -p %{buildroot}/etc/init.d +mkdir -p %{buildroot}/etc/sysconfig +mkdir -p %{buildroot}/var/lib/varnish + +%{__install} -m 0644 INSTALL %{buildroot}%{_docdir}/%{name}-%{version}/INSTALL +%{__install} -m 0644 LICENSE %{buildroot}%{_docdir}/%{name}-%{version}/LICENSE +%{__install} -m 0644 README %{buildroot}%{_docdir}/%{name}-%{version}/README +%{__install} -m 0644 ChangeLog %{buildroot}%{_docdir}/%{name}-%{version}/ChangeLog +%{__install} -m 0644 redhat/README.redhat %{buildroot}%{_docdir}/%{name}-%{version}/README.redhat +%{__install} -m 0644 redhat/vcl.conf %{buildroot}%{_docdir}/%{name}-%{version}/vcl.example.conf +%{__install} -m 0644 redhat/vcl.conf %{buildroot}/etc/varnish/vcl.conf +%{__install} -m 0644 redhat/varnish.sysconfig %{buildroot}/etc/sysconfig/varnish +%{__install} -m 0755 redhat/varnish.initrc %{buildroot}/etc/init.d/varnish + +%clean +rm -rf $RPM_BUILD_ROOT + +%files +%defattr(-,root,root,-) +%{_sbindir}/varnishd +%{_bindir}/varnishhist +%{_bindir}/varnishlog +%{_bindir}/varnishncsa +%{_bindir}/varnishstat +%{_bindir}/varnishtop +%{_libdir}/libvarnish.a +%{_libdir}/libvarnish.la +%{_libdir}/libvarnish.so.0.0.0 +%{_libdir}/libvarnish.so.0 +%{_libdir}/libvarnishapi.a +%{_libdir}/libvarnishapi.la +%{_libdir}/libvarnishapi.so.0.0.0 +%{_libdir}/libvarnishapi.so.0 +%{_libdir}/libvcl.a +%{_libdir}/libvcl.la +%{_libdir}/libvcl.so.0.0.0 +%{_libdir}/libvcl.so.0 +%{_var}/lib/varnish +%{_mandir}/man1/varnishd.1.gz +%{_mandir}/man1/varnishhist.1.gz +%{_mandir}/man1/varnishlog.1.gz +%{_mandir}/man1/varnishncsa.1.gz +%{_mandir}/man1/varnishstat.1.gz +%{_mandir}/man1/varnishtop.1.gz +%{_mandir}/man7/vcl.7.gz + +%doc %{_docdir}/%{name}-%{version}/INSTALL +%doc %{_docdir}/%{name}-%{version}/LICENSE +%doc %{_docdir}/%{name}-%{version}/README +%doc %{_docdir}/%{name}-%{version}/README.redhat +%doc %{_docdir}/%{name}-%{version}/ChangeLog +%doc %{_docdir}/%{name}-%{version}/vcl.example.conf +%config(noreplace) /etc/varnish/vcl.conf +%config /etc/init.d/varnish +%config /etc/sysconfig/varnish + +%post +/sbin/chkconfig --add varnish +/sbin/chkconfig --list varnish + +%changelog +* Thu Oct 19 2006 Ingvar Hagelund - 1.02-1 +- Added redhat subdir to svn +- Removed default vcl config file. Used the new upstream variant instead. +- Based build on svn. Running autogen.sh as start of build. Also added + libtool, autoconf and automake to BuildRequires. +- Removed rule to move varnishd to sbin. This is now fixed in upstream +- Changed the sysconfig script to include a lot more nice features. + Most of these were ripped from the Debian package. Updated initscript + to reflect this. +* Tue Oct 10 2006 Ingvar Hagelund - 1.01-3 +- Moved Red Hat specific files to its own subdirectory +* Tue Sep 26 2006 Ingvar Hagelund - 1.0.1-2 +- Added gcc requirement. +- Changed to an even simpler example vcl in to /etc/varnish (thanks, perbu) +- Added a sysconfig entry +* Fri Sep 22 2006 Ingvar Hagelund - 1.0.1-1 +- Initial build. diff --git a/varnish-cache/redhat/varnish.sysconfig b/varnish-cache/redhat/varnish.sysconfig new file mode 100644 index 00000000..a6cc7005 --- /dev/null +++ b/varnish-cache/redhat/varnish.sysconfig @@ -0,0 +1,51 @@ +# +# Default variables for varnish +# + +# 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 or INF for unlimited +VARNISH_MAX_WORKER_THREADS=INF + + +# Timeout value in seconds for threads to return +VARNISH_WORKER_THREAD_TIMEOUT=10 + + +# Hash algorithm to be used +VARNISH_HASHOPTION=classic + + +# Maximum size of the backend storagefile in bytes +VARNISH_BACKEND_STORAGE_SIZE=10240000 +VARNISH_BACKEND_STORAGE_FILE=/var/lib/varnish/varnish_storage.bin + + +# Backend storage specification +VARNISH_BACKEND_STORAGE="file,${VARNISH_BACKEND_STORAGE_FILE},${VARNISH_BACKEND_STORAGE_SIZE}" + + +# Set default ttl in secounds +VARNISH_TTL=120 +