Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 7 additions & 7 deletions INSTALL.rst
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ Installation

The source tree is based on autotools to configure the building, and
does also have the necessary bits in place to do functional unit tests
using the ``varnishtest`` tool.
using the ``vinyltest`` tool.

For extended resolver functionality, `getdns`_ is required both during
installation and at runtime. Before building, install `getdns`_ from
Expand All @@ -39,24 +39,24 @@ At runtime, only the library itself is required, e.g.::

apt-get install libgetdns1

Building requires the Varnish header files and uses pkg-config to find
Building requires the Vinyl header files and uses pkg-config to find
the necessary paths.

Usage::

./bootstrap

If you have installed Varnish to a non-standard directory, call
If you have installed Vinyl to a non-standard directory, call
``bootstrap`` with ``PKG_CONFIG_PATH`` pointing to
the appropriate path. For instance, when varnishd configure was called
the appropriate path. For instance, when vinyld configure was called
with ``--prefix=$PREFIX``, use

::

export PKG_CONFIG_PATH=${PREFIX}/lib/pkgconfig
export ACLOCAL_PATH=${PREFIX}/share/aclocal

The module will inherit its prefix from Varnish, unless you specify a
The module will inherit its prefix from Vinyl, unless you specify a
different ``--prefix`` when running the ``configure`` script for this
module.

Expand All @@ -68,7 +68,7 @@ Make targets:
* make distcheck - run check and prepare a tarball of the vmod.

If you build a dist tarball, you don't need any of the autotools, only
pkg-config and Varnish. You can build the module simply by running::
pkg-config and Vinyl. You can build the module simply by running::

./configure
make
Expand Down Expand Up @@ -117,4 +117,4 @@ repositories, but can be installed from EPEL7::

If you have problems or questions concerning the RPMs, post an issue
to one of the source repository web sites, or contact
<varnish-support@uplex.de>.
<vinyl-support@uplex.de>.
5 changes: 4 additions & 1 deletion Makefile.am
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
ACLOCAL_AMFLAGS = -I m4 -I ${VARNISHAPI_DATAROOTDIR}/aclocal
ACLOCAL_AMFLAGS = -I m4 -I ${VINYLAPI_DATAROOTDIR}/aclocal

DISTCHECK_CONFIGURE_FLAGS = RST2MAN=:

SUBDIRS = src

dist_doc_DATA = README.rst LICENSE

coverage:
$(MAKE) $(AM_MAKEFLAGS) -C src coverage
32 changes: 16 additions & 16 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ vmod_dynamic

.. role:: ref(emphasis)

This branch is for **Vinyl-Cache** *after* Varnish-Cache release 8.0.
This branch is for **Vinyl Cache** *after* Varnish-Cache release 8.0.

Use branch `8.0`_ with Varnish-Cache 8.0.x

Expand All @@ -15,18 +15,18 @@ versions.

.. _`CHANGES.rst`: CHANGES.rst

Note on Vinyl-Cache / Varnish-Cache
Note on Vinyl Cache / Varnish-Cache
-----------------------------------

.. _`Vinyl-Cache Announcement`: https://vinyl-cache.org/#years-old-and-it-is-time-to-get-serious-er
.. _`Vinyl Cache Announcement`: https://vinyl-cache.org/#years-old-and-it-is-time-to-get-serious-er

For now, we use the new and old name somehow interchangably and neither the
documentation nor the code have been fully updated.

See `Vinyl-Cache Announcement`_ for background.
See `Vinyl Cache Announcement`_ for background.

-------------------------------
Varnish dynamic backends module
Vinyl dynamic backends module
-------------------------------

Intro / Typical Usage Example
Expand All @@ -45,7 +45,7 @@ Domain Socket (UDS) looks like this::
listen tls_onloader
mode tcp
maxconn 1000
bind /shared/varnish/tls_onloader.sock accept-proxy mode 777
bind /shared/vinyl/tls_onloader.sock accept-proxy mode 777
balance roundrobin
stick-table type ip size 100
stick on dst
Expand All @@ -57,20 +57,20 @@ Domain Socket (UDS) looks like this::

In this snippet, ``/etc/ssl/certs/ca-bundle.crt`` should be replaced with a CA
certificate bundle which you decide to trust. ``maxconn`` should be adjusted as
needed. ``/shared/varnish/`` has to be a path which is also available to
``varnishd`` (beware, for example, of systemd implicitly chrooting services).
needed. ``/shared/vinyl/`` has to be a path which is also available to
``vinyld`` (beware, for example, of systemd implicitly chrooting services).
``mode 777`` is a fail-safe choice, but not optimal from a security perspective.
Ideally, varnishd and haproxy should be added to the ``vcache`` group and have
Ideally, vinyld and haproxy should be added to the ``vcache`` group and have
this mode set to ``770``. The stick table ``size`` and the number of repetitions
of the ``server sXX`` line should roughly match the number of expected peers.
**NB:** all of this is just broad advise for the purpose of this introduction,
do your own research!

On the varnish end, the following VCL snippet configures a dynamic director
On the vinyl end, the following VCL snippet configures a dynamic director
using the TLS onloader::

backend tls_onloader {
.path = "/shared/varnish/tls_onloader.sock";
.path = "/shared/vinyl/tls_onloader.sock";
## consider setting:
# .connect_timeout = Xs;
# .first_byte_timeout = Xs;
Expand All @@ -97,7 +97,7 @@ Description

.. _`getdns`: https://getdnsapi.net/

This module provides a varnish director for dynamic creation of
This module provides a vinyl director for dynamic creation of
backends based on calls to

* the system's network address resolution service which, in turn,
Expand All @@ -107,7 +107,7 @@ backends based on calls to

* or more advanced DNS resolution where `getdns`_ is available.

While standard varnish backends defined in VCL may also be defined in
While standard vinyl backends defined in VCL may also be defined in
terms of host names, changes of the name service information will only
be picked up with a VCL reload.

Expand Down Expand Up @@ -178,9 +178,9 @@ SEE ALSO
* :ref:`vcl(7)`
* :ref:`vsl(7)`
* :ref:`vsl-query(7)`
* :ref:`varnish-cli(7)`
* :ref:`varnish-counters(7)`
* :ref:`varnishstat(1)`
* :ref:`vinyl-cli(7)`
* :ref:`vinyl-counters(7)`
* :ref:`vinylstat(1)`
* :ref:`getaddrinfo(3)`
* :ref:`nscd(8)`
* :ref:`nsswitch.conf(5)`
Expand Down
17 changes: 4 additions & 13 deletions bootstrap
Original file line number Diff line number Diff line change
Expand Up @@ -3,23 +3,14 @@
set -e
set -u

WORK_DIR=$(pwd)
ROOT_DIR=$(dirname "$0")

cd "$ROOT_DIR"
pkg-config --exists --print-errors vinylapi

if ! command -v libtoolize >/dev/null
then
echo "libtoolize: command not found, falling back to glibtoolize" >&2
alias libtoolize=glibtoolize
fi
VINYLAPI_DATAROOTDIR=$(pkg-config --variable=datarootdir vinylapi)
export VINYLAPI_DATAROOTDIR

mkdir -p m4
aclocal
libtoolize --copy --force
autoheader
automake --add-missing --copy --foreign
autoconf
autoreconf -i "$ROOT_DIR"

cd "$WORK_DIR"
"$ROOT_DIR"/configure "$@"
29 changes: 23 additions & 6 deletions configure.ac
Original file line number Diff line number Diff line change
@@ -1,18 +1,35 @@
AC_PREREQ([2.68])
AC_INIT([libvmod-dynamic], [trunk], [varnish-support@uplex.de], [vmod-dynamic])
AC_INIT([libvmod-dynamic], [trunk], [vinyl-support@uplex.de], [vmod-dynamic])
AC_COPYRIGHT([Copyright 2024 UPLEX - Nils Goroll Systemoptimierung])
AC_CONFIG_MACRO_DIR([m4])
AC_CONFIG_AUX_DIR([build-aux])
AC_CONFIG_SRCDIR([src/vmod_dynamic.vcc])
AC_CONFIG_HEADERS([config.h])

AM_INIT_AUTOMAKE([1.11 -Wall -Werror foreign parallel-tests])
AM_INIT_AUTOMAKE([1.12 -Wall -Werror foreign parallel-tests])
AM_SILENT_RULES([yes])

AC_ARG_VAR([RST2MAN], [the program to build manuals from reStructuredText])
AC_CHECK_PROGS(RST2MAN, [rst2man rst2man.py])

VARNISH_PREREQ([7.5.0])
VARNISH_VMODS([dynamic])
AC_ARG_WITH([lcov],
AS_HELP_STRING(
[--with-lcov=PATH],
[Location of lcov to generate coverage data (auto)]),
[LCOV="$withval"],
[AC_CHECK_PROGS(LCOV, [lcov], [])])
AM_CONDITIONAL(HAVE_LCOV, [test -n "$LCOV"])

AC_ARG_WITH([genhtml],
AS_HELP_STRING(
[--with-genhtml=PATH],
[Location of genhtml to generate coverage reports (auto)]),
[GENHTML="$withval"],
[AC_CHECK_PROGS(GENHTML, [genhtml], [])])
AM_CONDITIONAL(HAVE_GENHTML, [test -n "$GENHTML"])

VINYL_PREREQ([9.0.0])
VINYL_VMODS([dynamic])

AM_PROG_AR

Expand Down Expand Up @@ -44,7 +61,7 @@ AS_IF([test "x$with_getdns" != xno],
])

AC_CHECK_HEADERS([cache/cache.h], [],
[AC_MSG_ERROR([Missing \$VARNISHSRC development files.])],
[AC_MSG_ERROR([Missing \$VINYLSRC development files.])],
[[#include <cache/cache.h>]])

AC_CONFIG_FILES([
Expand Down Expand Up @@ -72,7 +89,7 @@ AC_OUTPUT
AS_ECHO("
==== $PACKAGE_STRING ====

varnish: $VARNISH_VERSION
vinyl: $VINYL_VERSION
prefix: $prefix
vmoddir: $vmoddir
vcldir: $vcldir
Expand Down
4 changes: 2 additions & 2 deletions contrib/vtc/r81.vtc
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
varnishtest "bug #81 Assertion error on dynamic_domain"
vtest "bug #81 Assertion error on dynamic_domain"

# this test case is in the contrib/vtc directory because of the additional requirements
#
Expand All @@ -22,7 +22,7 @@ varnishtest "bug #81 Assertion error on dynamic_domain"
#
# 3. Start dnsmasq "dnsmasq -C /etc/dnsmasq.conf"

varnish v1 -vcl {
vinyl v1 -vcl {
import ${vmod_dynamic};

backend dummy { .host = "${bad_backend}"; }
Expand Down
54 changes: 47 additions & 7 deletions src/Makefile.am
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
AM_CFLAGS = $(VARNISHAPI_CFLAGS) $(GETDNS_CFLAGS) -Wall -Werror
AM_CFLAGS = $(VINYLAPI_CFLAGS) $(GETDNS_CFLAGS) -Wall -Werror

# Modules

vmod_LTLIBRARIES = libvmod_dynamic.la

libvmod_dynamic_la_LDFLAGS = $(VARNISHAPI_LIBS) $(GETDNS_LIBS) $(VMOD_LDFLAGS)
libvmod_dynamic_la_LDFLAGS = $(VINYLAPI_LIBS) $(GETDNS_LIBS) $(VMOD_LDFLAGS)

libvmod_dynamic_la_SOURCES = \
vmod_dynamic.h \
Expand Down Expand Up @@ -49,13 +49,13 @@ $(srcdir)/vmod_resolver.stub.c: vcc_dynamic_if.h
@BUILD_VMOD_DYNAMIC@

AM_TESTS_ENVIRONMENT = \
PATH="$(abs_builddir):$(VARNISH_TEST_PATH):$(PATH)" \
LD_LIBRARY_PATH="$(VARNISH_LIBRARY_PATH)"
PATH="$(abs_builddir):$(VINYL_TEST_PATH):$(PATH)" \
LD_LIBRARY_PATH="$(VINYL_LIBRARY_PATH)"
TEST_EXTENSIONS = .vtc
VTC_LOG_COMPILER = varnishtest -vl
VTC_LOG_COMPILER = vinyltest -vl
AM_VTC_LOG_FLAGS = \
-p vcl_path="$(abs_top_srcdir)/vcl:$(VARNISHAPI_VCLDIR)" \
-p vmod_path="$(abs_builddir)/.libs:$(vmoddir):$(VARNISHAPI_VMODDIR)"
-p vcl_path="$(abs_top_srcdir)/vcl:$(VINYLAPI_VCLDIR)" \
-p vmod_path="$(abs_builddir)/.libs:$(vmoddir):$(VINYLAPI_VMODDIR)"

TESTS = \
@VTC_TESTS@
Expand All @@ -80,3 +80,43 @@ pdf-local: vmod_dynamic.pdf

.rst.1:
$(AM_V_GEN) $(RST2MAN) $< $@

# Code coverage

GCOV_PREFIX ?= $(builddir)/coverage

gcov: clean
$(AM_V_at)@mkdir -p $(GCOV_PREFIX) && chmod 777 -R $(GCOV_PREFIX)
$(AM_V_at)$(MAKE) $(AM_MAKEFLAGS) CC=gcc \
CFLAGS="${AM_CFLAGS} --coverage -fno-inline -g -O0" check

# Set QUIET=-q for non-verbose builds, otherwise set to empty.
QUIET_0 = -q
QUIET_ = $(QUIET_@AM_DEFAULT_V@)
QUIET = $(QUIET_@AM_V@)

coverage/lcov.info: gcov
if HAVE_LCOV
-$(AM_V_at)@cp -R $(GCOV_PREFIX)/.libs $(builddir) 2> /dev/null
$(AM_V_GEN) $(LCOV) $(QUIET) \
-c -d $(builddir)/.libs -o $(GCOV_PREFIX)/lcov.info
else
@echo "================================================="
@echo "You need lcov installed to generate coverage data"
@echo "================================================="
@false
endif

coverage: coverage/lcov.info
if HAVE_GENHTML
$(AM_V_GEN) $(GENHTML) $(QUIET) $(GCOV_PREFIX)/lcov.info \
-o $(GCOV_PREFIX)
else
@echo "======================================================="
@echo "You need genhtml installed to generate coverage reports"
@echo "======================================================="
@false
endif

clean-local:
@rm -rf $(GCOV_PREFIX)
10 changes: 5 additions & 5 deletions src/flint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,19 +6,19 @@ if [ "x$1" = "x-ok" -a -f _.fl ] ; then
exit 0
fi

if [ "x${VARNISHSRC}" = "x" ] ; then
echo >&2 VARNISHSRC needs to point to varnish-cache sources
if [ "x${VINYLSRC}" = "x" ] ; then
echo >&2 VINYLSRC needs to point to vinyl-cache sources
exit 9
fi

flexelint \
-D__FLEXELINT__ \
${VARNISHSRC}/flint.lnt \
${VINYLSRC}/flint.lnt \
flint.lnt \
-zero \
-I.. \
-I${VARNISHSRC}/include \
-I${VARNISHSRC}/bin/varnishd \
-I${VINYLSRC}/include \
-I${VINYLSRC}/bin/vinyld \
$(ls *.c | grep -v .stub) \
2>&1 | tee _.fl

Expand Down
2 changes: 1 addition & 1 deletion src/vmod_dynamic.c
Original file line number Diff line number Diff line change
Expand Up @@ -342,7 +342,7 @@ dom_resolve(VRT_CTX, VCL_BACKEND d)
* runs outside the update thread in order to be able to
* call pthread_join().
*
* other options: extra thread, pool_task (needs cache_varnishd.h)
* other options: extra thread, pool_task (needs cache_vinyld.h)
*/
if (VTAILQ_FIRST(&dom->obj->unref_domains))
dynamic_gc_expired(dom->obj);
Expand Down
Loading