README.rst 1.9 KB
Newer Older
1
============
2
vmod-weightadjust
3 4 5 6 7
============

SYNOPSIS
========

8
import weightadjust;
9 10 11 12

DESCRIPTION
===========

Nils Goroll's avatar
Nils Goroll committed
13 14
Random director with dynamic weight update based on http requests to
backends.
15

Nils Goroll's avatar
Nils Goroll committed
16
Example:
17

Nils Goroll's avatar
Nils Goroll committed
18
::
19

Nils Goroll's avatar
Nils Goroll committed
20
   vcl_init {
21
        new director = random();
22

23 24 25 26
        director.add_backend(backend,
                             weight=1.1,
                             weight_update="^X-Weight: *(\d+\.\d+)",
                             url="/get-weight.php");
Nils Goroll's avatar
Nils Goroll committed
27 28 29
   # ...
   }

Nils Goroll's avatar
Nils Goroll committed
30
See vmod documentation/man page for details.
31 32 33 34 35 36

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
37
using the ``varnishtest`` tool.
38

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

42
Usage::
43

44 45
 ./autogen.sh
 ./configure
46

47 48
If you have installed Varnish to a non-standard directory, call
``autogen.sh`` and ``configure`` with ``PKG_CONFIG_PATH`` pointing to
49
the appropriate path. For instance, when varnishd configure was called
50 51
with ``--prefix=$PREFIX``, use

52 53 54 55 56 57 58 59
::

 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
different ``--prefix`` when running the ``configure`` script for this
module.
60 61 62

Make targets:

63 64
* make - builds the vmod.
* make install - installs your vmod.
65
* make check - runs the unit tests in ``src/tests/*.vtc``.
66
* make distcheck - run check and prepare a tarball of the vmod.
67

68 69 70 71 72 73
If you build a dist tarball, you don't need any of the autotools or
pkg-config. You can build the module simply by running::

 ./configure
 make

74 75 76
Installation directories
------------------------

77 78 79
By default, the vmod ``configure`` script installs the built vmod in the
directory relevant to the prefix. The vmod installation directory can be
overridden by passing the ``vmoddir`` variable to ``make install``.
80