From aca4a5863611793fb00be8fa41c55bf1692e1c8f Mon Sep 17 00:00:00 2001 From: Scott Ullrich Date: Mon, 26 Apr 2010 21:50:02 -0400 Subject: Adding new custom_vcl tab --- config/varnish64/backends.xml | 9 ++- config/varnish64/varnish.inc | 24 +++++--- config/varnish64/varnish_custom_vcl.xml | 103 ++++++++++++++++++++++++++++++++ config/varnish64/varnish_settings.xml | 19 +++--- 4 files changed, 137 insertions(+), 18 deletions(-) create mode 100644 config/varnish64/varnish_custom_vcl.xml diff --git a/config/varnish64/backends.xml b/config/varnish64/backends.xml index bcec031b..24259c89 100644 --- a/config/varnish64/backends.xml +++ b/config/varnish64/backends.xml @@ -55,8 +55,15 @@ /pkg.php?xml=backends.xml + + Settings + /pkg.php?xml=varnish_settings.xml + + + Custom VCL + /pkg.php?xml=varnish_custom_vcl.xml + - ['installedpackages']['varnish']['config'] IPAddress diff --git a/config/varnish64/varnish.inc b/config/varnish64/varnish.inc index 5df22487..d69d6abd 100644 --- a/config/varnish64/varnish.inc +++ b/config/varnish64/varnish.inc @@ -31,7 +31,19 @@ */ /* ========================================================================== */ -function sync_package_varnish() { +function sync_package_varnish() { + if($config['installedpackages']['varnishcustomvcl']['config'] != "") { + foreach($config['installedpackages']['varnishcustomvcl']['config'] as $vcl) { + if($vcl['vcl_fetch_early']) + $vcl_fetch_early = $vcl['vcl_fetch_early']; + if($vcl['vcl_fetch_late']) + $vcl_fetch_late = $vcl['vcl_fetch_late']; + if($vcl['vcl_pipe_early']) + $vcl_pipe_early = $vcl['vcl_pipe_early']; + if($vcl['vcl_pipe_late']) + $vcl_pipe_late = $vcl['vcl_pipe_late']; + } + } if($config['installedpackages']['varnishsettings']['config'] != "") { foreach($config['installedpackages']['varnishsettings']['config'] as $vs) { if($vs['storagetype'] == "malloc") @@ -44,7 +56,7 @@ function sync_package_varnish() { $listeningport = "-a :80"; } $fd = fopen("/usr/local/etc/rc.d/varnish.sh", "w"); - $rc_file = <</dev/null @@ -59,7 +71,7 @@ sleep 1 EOF; fwrite($fd, $rc_file); fclose($fd); - exec("chmod a+rx /usr/local/etc/rc.d/varnish.sh") + exec("chmod a+rx /usr/local/etc/rc.d/varnish.sh"); } if(!$errorvcl) @@ -99,7 +111,7 @@ EOF; foreach($config['installedpackages']['varnishurlmappings']['config'] as $urlmapping) { if(!$isfirst) $urlmappings .= "else "; - $urlmappings = << + + + + + + All rights reserved. + */ +/* ========================================================================== */ +/* + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are met: + + 1. Redistributions of source code must retain the above copyright notice, + this list of conditions and the following disclaimer. + + 2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + + THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, + INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY + AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, + OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + POSSIBILITY OF SUCH DAMAGE. + */ +/* ========================================================================== */ + ]]> + + Describe your package here + Describe your package requirements here + Currently there are no FAQ items provided. + varnishcustomvcl + 0.0.1 + Varnish custom VCL + pkg_edit.php?xml=varnish_settings.xml&id=0 + /usr/local/pkg/varnish.inc + + + Backends + /pkg.php?xml=backends.xml + + + Settings + /pkg.php?xml=varnish_settings.xml + + + + Custom VCL + /pkg.php?xml=varnish_custom_vcl.xml + + + + + + vcl_fetch_early + vcl_fetch_early + + textarea + 50 + 10 + + + vcl_fetch_late + vcl_fetch_late + + textarea + 50 + 10 + + + vcl_pipe_early + vcl_fetch_early + + textarea + 50 + 10 + + + vcl_pipe_late + vcl_fetch_late + + textarea + 50 + 10 + + + + + + sync_package_varnish(); + + \ No newline at end of file diff --git a/config/varnish64/varnish_settings.xml b/config/varnish64/varnish_settings.xml index 60d08c1d..8fa9b1ce 100644 --- a/config/varnish64/varnish_settings.xml +++ b/config/varnish64/varnish_settings.xml @@ -45,22 +45,21 @@ Varnish Settings pkg_edit.php?xml=varnish_settings.xml&id=0 /usr/local/pkg/varnish.inc - - Varnish -
Services
- backends.xml -
- - varnish - varnish.sh - Backends /pkg.php?xml=backends.xml + + Settings + /pkg.php?xml=varnish_settings.xml + + + + Custom VCL + /pkg.php?xml=varnish_custom_vcl.xml + - ['installedpackages']['varnish']['config'] Storage type -- cgit v1.2.3