[PATCH] Variable for vcl_dir in startup scripts
Federico Schwindt
fgsch at lodoss.net
Thu Jun 25 17:52:36 CEST 2015
Hi,
My first inclination is to ensure that the ExecStartPre line uses the same
parameters as ExecStart.
So my questions is how do you set vcl_dir? Do you edit varnish.service or
varnish.params?
Wouldn't adding DAEMON_OPTS to ExecStartPre (and configtest) do it?
On Thu, Jun 25, 2015 at 3:26 PM, Delacroix, Gauthier <
Gauthier.Delacroix at coreye.fr> wrote:
> Here is another patch proposal to make syntax check handle parameters
> required to compile the VCL (vcl_dir, etc.) without creating a startup
> variable for each parameter.
>
> It just adds a COMPILE_OPTS that is merged in DAEMON_OPTS to start Varnish
> but is used alone in the syntax check.
>
> Gauthier
>
> From d1567a956d53a489aa4ace66ce0b1c1ef745570b Mon Sep 17 00:00:00 2001
> From: Gauthier Delacroix <gauthier.delacroix at coreye.fr>
> Date: Thu, 25 Jun 2015 15:06:08 +0200
> Subject: [PATCH] Add COMPILE_OPTS in startup scripts to make syntax check
> check handle compilation parameters
>
> ---
> redhat/varnish.initrc | 6 ++++--
> redhat/varnish.params | 8 ++++++++
> redhat/varnish.service | 3 ++-
> redhat/varnish.sysconfig | 11 ++++++++++-
> 4 files changed, 24 insertions(+), 4 deletions(-)
>
> diff --git a/redhat/varnish.initrc b/redhat/varnish.initrc
> index 117e334..0bde074 100755
> --- a/redhat/varnish.initrc
> +++ b/redhat/varnish.initrc
> @@ -126,9 +126,11 @@ rh_status_q() {
>
> configtest() {
> if [ -f "$VARNISH_VCL_CONF" ]; then
> - $exec -f "$VARNISH_VCL_CONF" -C -n /tmp > /dev/null && echo
> "Syntax ok"
> + $exec -f "$VARNISH_VCL_CONF" -C -n /tmp $COMPILE_OPTS > /dev/null
> \
> + && echo "Syntax ok"
> else
> - echo "VARNISH_VCL_CONF is unset or does not point to a file"
> + echo "VARNISH_VCL_CONF is unset or does not point to a file"
> + echo "Also check that COMPILE_OPTS is set depending on the VCL
> config"
> fi
> }
>
> diff --git a/redhat/varnish.params b/redhat/varnish.params
> index 27a14dd..970d088 100644
> --- a/redhat/varnish.params
> +++ b/redhat/varnish.params
> @@ -31,5 +31,13 @@ VARNISH_TTL=120
> VARNISH_USER=varnish
> VARNISH_GROUP=varnish
>
> +# Startup options required to compile the configuration.
> +# The following run-time parameters must be defined here, if needed:
> +# cc_command, group_cc, vcc_allow_inline_c, vcc_err_unref,
> vcc_unsafe_path,
> +# vcl_dir, vmod_dir
> +# Defining them in DAEMON_OPTS may result in a syntax check failure.
> +# See the man page varnishd(1).
> +#COMPILE_OPTS="-p vcl_dir=/etc/varnish -p vcc_err_unref=on"
> +
> # Other options, see the man page varnishd(1)
> #DAEMON_OPTS="-p thread_pool_min=5 -p thread_pool_max=500 -p
> thread_pool_timeout=300"
> diff --git a/redhat/varnish.service b/redhat/varnish.service
> index a4f3355..a08db58 100644
> --- a/redhat/varnish.service
> +++ b/redhat/varnish.service
> @@ -27,7 +27,7 @@ EnvironmentFile=/etc/varnish/varnish.params
> Type=forking
> PIDFile=/var/run/varnish.pid
> PrivateTmp=true
> -ExecStartPre=/usr/sbin/varnishd -C -f $VARNISH_VCL_CONF
> +ExecStartPre=/usr/sbin/varnishd -C -f $VARNISH_VCL_CONF $COMPILE_OPTS
> ExecStart=/usr/sbin/varnishd \
> -P /var/run/varnish.pid \
> -f $VARNISH_VCL_CONF \
> @@ -38,6 +38,7 @@ ExecStart=/usr/sbin/varnishd \
> -g $VARNISH_GROUP \
> -S $VARNISH_SECRET_FILE \
> -s $VARNISH_STORAGE \
> + $COMPILE_OPTS \
> $DAEMON_OPTS
>
> ExecReload=/usr/sbin/varnish_reload_vcl
> diff --git a/redhat/varnish.sysconfig b/redhat/varnish.sysconfig
> index 6aa2354..0e376ff 100644
> --- a/redhat/varnish.sysconfig
> +++ b/redhat/varnish.sysconfig
> @@ -91,6 +91,14 @@ VARNISH_STORAGE="malloc,${VARNISH_STORAGE_SIZE}"
> # # Default TTL used when the backend does not specify one
> VARNISH_TTL=120
> #
> +# Startup options required to compile the configuration.
> +# The following run-time parameters must be defined here, if needed:
> +# cc_command, group_cc, vcc_allow_inline_c, vcc_err_unref,
> vcc_unsafe_path,
> +# vcl_dir, vmod_dir
> +# Defining them in DAEMON_OPTS may result in a syntax check failure.
> +# See the man page varnishd(1).
> +#COMPILE_OPTS="-p vcl_dir=/etc/varnish -p vcc_err_unref=on"
> +#
> # # DAEMON_OPTS is used by the init script. If you add or remove
> options, make
> # # sure you update this section, too.
> DAEMON_OPTS="-a ${VARNISH_LISTEN_ADDRESS}:${VARNISH_LISTEN_PORT} \
> @@ -102,7 +110,8 @@ DAEMON_OPTS="-a
> ${VARNISH_LISTEN_ADDRESS}:${VARNISH_LISTEN_PORT} \
> -p thread_pool_timeout=${VARNISH_THREAD_TIMEOUT} \
> -u varnish -g varnish \
> -S ${VARNISH_SECRET_FILE} \
> - -s ${VARNISH_STORAGE}"
> + -s ${VARNISH_STORAGE}" \
> + ${COMPILE_OPTS}
> #
>
>
> --
> 1.8.3.msysgit.0
>
>
>
> _______________________________________________
> varnish-dev mailing list
> varnish-dev at varnish-cache.org
> https://www.varnish-cache.org/lists/mailman/listinfo/varnish-dev
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://www.varnish-cache.org/lists/pipermail/varnish-dev/attachments/20150625/e70f5015/attachment.html>
More information about the varnish-dev
mailing list