diff --git a/common/shlibs b/common/shlibs index 6b72f551f9a..377d781e01a 100644 --- a/common/shlibs +++ b/common/shlibs @@ -1134,3 +1134,4 @@ libgtkspell.so.0 gtkspell-2.0.16_1 libpurple.so.0 libpurple-2.10.6_1 libpurple-client.so.0 libpurple-2.10.6_1 libgnt.so.0 libgnt-2.10.6_1 +libvarnishapi.so.1 libvarnishapi-3.0.3_1 diff --git a/srcpkgs/libvarnishapi b/srcpkgs/libvarnishapi new file mode 120000 index 00000000000..1605f8f84bb --- /dev/null +++ b/srcpkgs/libvarnishapi @@ -0,0 +1 @@ +varnish \ No newline at end of file diff --git a/srcpkgs/libvarnishapi-devel b/srcpkgs/libvarnishapi-devel new file mode 120000 index 00000000000..1605f8f84bb --- /dev/null +++ b/srcpkgs/libvarnishapi-devel @@ -0,0 +1 @@ +varnish \ No newline at end of file diff --git a/srcpkgs/varnish/files/varnish-vcl-reload b/srcpkgs/varnish/files/varnish-vcl-reload new file mode 100644 index 00000000000..7e84a258bf3 --- /dev/null +++ b/srcpkgs/varnish/files/varnish-vcl-reload @@ -0,0 +1,20 @@ +#!/bin/sh + +cfg=${1:-/etc/varnish/default.vcl} +if [ ! -e "$cfg" ]; then + printf 'ERROR: VCL file %s does not exist\n' "$cfg" >&2 + exit 1 +fi + +activecfg=$(varnishadm 'vcl.list' | awk '/active/ { print $3 }') +if [ -z "$activecfg" ]; then + printf 'ERROR: No active VCL found!\n' >&2 + exit 1 +fi + +newcfg=$(date +'vcl-%s') +printf 'INFO: using new config %s\n' "$cfg" + +varnishadm "vcl.load $newcfg $cfg" && +varnishadm "vcl.use $newcfg" && +varnishadm "vcl.discard $activecfg" diff --git a/srcpkgs/varnish/files/varnish.service b/srcpkgs/varnish/files/varnish.service new file mode 100644 index 00000000000..d5b0aa66da9 --- /dev/null +++ b/srcpkgs/varnish/files/varnish.service @@ -0,0 +1,10 @@ +[Unit] +Description=Web Application Accelerator +After=network.target + +[Service] +ExecStart=/usr/sbin/varnishd -a 0.0.0.0:80 -f /etc/varnish/default.vcl -T localhost:6082 -s malloc,64M -u nobody -g nobody -F +ExecReload=/usr/bin/varnish-vcl-reload + +[Install] +WantedBy=multi-user.target diff --git a/srcpkgs/varnish/libvarnishapi-devel.template b/srcpkgs/varnish/libvarnishapi-devel.template new file mode 100644 index 00000000000..86775d80a06 --- /dev/null +++ b/srcpkgs/varnish/libvarnishapi-devel.template @@ -0,0 +1,14 @@ +# Template file for 'libvarnishapi-devel'. +# +noarch=yes +depends="libvarnishapi>=${version}" +short_desc="${short_desc} -- API development files" +long_desc="${long_desc} + + This package contains files for development, headers, static libs, etc." + +do_install() { + vmove usr/include usr + vmove usr/lib/pkgconfig usr/lib + vmove usr/share/man/man3 usr/share/man +} diff --git a/srcpkgs/varnish/libvarnishapi.template b/srcpkgs/varnish/libvarnishapi.template new file mode 100644 index 00000000000..4476a268b26 --- /dev/null +++ b/srcpkgs/varnish/libvarnishapi.template @@ -0,0 +1,10 @@ +# Template file for 'libvarnishapi'. +# +short_desc="${short_desc} -- API runtime library" +long_desc="${long_desc} + + This package contains the runtime API library for varnish." + +do_install() { + vmove "usr/lib/*.so*" usr/lib +} diff --git a/srcpkgs/varnish/template b/srcpkgs/varnish/template new file mode 100644 index 00000000000..dedbca0b024 --- /dev/null +++ b/srcpkgs/varnish/template @@ -0,0 +1,31 @@ +# Template file for 'varnish' +pkgname=varnish +version=3.0.3 +revision=1 +build_style=gnu-configure +configure_args="--disable-static" +makedepends="pkg-config pcre-devel readline-devel" +short_desc="A fast caching HTTP reverse proxy" +maintainer="Juan RP " +license="Simplified BSD" +homepage="https://www.varnish-cache.org/" +distfiles="http://repo.varnish-cache.org/source/${pkgname}-${version}.tar.gz" +checksum=2d37d18d952f58b208ac3a0706d4d3e4c0de304b1fcc9df5019571c75f148ab2 +long_desc=" + Varnish Cache is a web application accelerator also known as a caching HTTP + reverse proxy. You install it in front of any server that speaks HTTP and + configure it to cache the contents. Varnish Cache is really, really fast. + It typically speeds up delivery with a factor of 300 - 1000x, depending on + your architecture. A high level overview of what Varnish does can be seen + in the video attached to this web page." + +subpackages="libvarnishapi libvarnishapi-devel" +conf_files="/etc/varnish/default.vcl" +systemd_services="varnish.service on" + +post_install() { + # systemd reload helper + vinstall ${FILESDIR}/varnish-vcl-reload 755 usr/sbin + # systemd service + vinstall ${FILESDIR}/varnish.service 644 usr/lib/systemd/system +}