aboutsummaryrefslogtreecommitdiffstats
path: root/config/varnish64
diff options
context:
space:
mode:
authorScott Ullrich <sullrich@pfsense.org>2010-04-26 21:50:02 -0400
committerScott Ullrich <sullrich@pfsense.org>2010-04-26 21:50:02 -0400
commitaca4a5863611793fb00be8fa41c55bf1692e1c8f (patch)
treef9b9df8f504eb0f6d59808c5d8b70217e4362bb6 /config/varnish64
parente2c204c64cb502f8f5a5c5ffe957edea1e3bbe26 (diff)
downloadpfsense-packages-aca4a5863611793fb00be8fa41c55bf1692e1c8f.tar.gz
pfsense-packages-aca4a5863611793fb00be8fa41c55bf1692e1c8f.tar.bz2
pfsense-packages-aca4a5863611793fb00be8fa41c55bf1692e1c8f.zip
Adding new custom_vcl tab
Diffstat (limited to 'config/varnish64')
-rw-r--r--config/varnish64/backends.xml9
-rw-r--r--config/varnish64/varnish.inc24
-rw-r--r--config/varnish64/varnish_custom_vcl.xml103
-rw-r--r--config/varnish64/varnish_settings.xml19
4 files changed, 137 insertions, 18 deletions
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 @@
<url>/pkg.php?xml=backends.xml</url>
<active/>
</tab>
+ <tab>
+ <text>Settings</text>
+ <url>/pkg.php?xml=varnish_settings.xml</url>
+ </tab>
+ <tab>
+ <text>Custom VCL</text>
+ <url>/pkg.php?xml=varnish_custom_vcl.xml</url>
+ </tab>
</tabs>
- <configpath>['installedpackages']['varnish']['config']</configpath>
<adddeleteeditpagefields>
<columnitem>
<fielddescr>IPAddress</fielddescr>
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 = <<<EOF;
+ $rc_file = <<<EOF
#!/bin/sh
mkdir -p /var/varnish
rm /var/varnish/storage.bin 2>/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 = <<<EOAU;
+ $urlmappings = <<<EOAU
if (req.http.host == "{$urlmapping['url']}") {
set req.backend = {$urlmapping['backend']};
}
@@ -119,7 +131,7 @@ EOAU;
$first_byte_timeout = $backend['first_byte_timeout'];
else
$first_byte_timeout = "300s";
- $backends .= <<<EOFA;
+ $backends .= <<<EOFA
backend {$backend['backendname']} {
.host = "{$backend['ipaddress']}";
.port = "{$backend['port']}";
@@ -130,10 +142,8 @@ backend {$backend['backendname']} {
EOFA;
}
}
-}
$varnish_config_file = <<<EOF
-
# Varnish configuration file
# Automatically generated by the pfSense package system
diff --git a/config/varnish64/varnish_custom_vcl.xml b/config/varnish64/varnish_custom_vcl.xml
new file mode 100644
index 00000000..678ea83a
--- /dev/null
+++ b/config/varnish64/varnish_custom_vcl.xml
@@ -0,0 +1,103 @@
+<?xml version="1.0" encoding="utf-8" ?>
+<!DOCTYPE packagegui SYSTEM "./schema/packages.dtd">
+<?xml-stylesheet type="text/xsl" href="./xsl/package.xsl"?>
+<packagegui>
+ <copyright>
+ <![CDATA[
+/* ========================================================================== */
+/*
+ varnish_settings.xml
+ part of pfSense (http://www.pfSense.com)
+ Copyright (C) 2010 Scott Ullrich <sullrich@gmail.com>
+ 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.
+ */
+/* ========================================================================== */
+ ]]>
+ </copyright>
+ <description>Describe your package here</description>
+ <requirements>Describe your package requirements here</requirements>
+ <faq>Currently there are no FAQ items provided.</faq>
+ <name>varnishcustomvcl</name>
+ <version>0.0.1</version>
+ <title>Varnish custom VCL</title>
+ <aftersaveredirect>pkg_edit.php?xml=varnish_settings.xml&amp;id=0</aftersaveredirect>
+ <include_file>/usr/local/pkg/varnish.inc</include_file>
+ <tabs>
+ <tab>
+ <text>Backends</text>
+ <url>/pkg.php?xml=backends.xml</url>
+ </tab>
+ <tab>
+ <text>Settings</text>
+ <url>/pkg.php?xml=varnish_settings.xml</url>
+
+ </tab>
+ <tab>
+ <text>Custom VCL</text>
+ <url>/pkg.php?xml=varnish_custom_vcl.xml</url>
+ <active/>
+ </tab>
+ </tabs>
+ <fields>
+ <field>
+ <fielddescr>vcl_fetch_early</fielddescr>
+ <fieldname>vcl_fetch_early</fieldname>
+ <description></description>
+ <type>textarea</type>
+ <cols>50</cols>
+ <rows>10</rows>
+ </field>
+ <field>
+ <fielddescr>vcl_fetch_late</fielddescr>
+ <fieldname>vcl_fetch_late</fieldname>
+ <description></description>
+ <type>textarea</type>
+ <cols>50</cols>
+ <rows>10</rows>
+ </field>
+ <field>
+ <fielddescr>vcl_pipe_early</fielddescr>
+ <fieldname>vcl_fetch_early</fieldname>
+ <description></description>
+ <type>textarea</type>
+ <cols>50</cols>
+ <rows>10</rows>
+ </field>
+ <field>
+ <fielddescr>vcl_pipe_late</fielddescr>
+ <fieldname>vcl_fetch_late</fieldname>
+ <description></description>
+ <type>textarea</type>
+ <cols>50</cols>
+ <rows>10</rows>
+ </field>
+ </fields>
+ <custom_php_validation_command>
+ </custom_php_validation_command>
+ <custom_php_resync_config_command>
+ sync_package_varnish();
+ </custom_php_resync_config_command>
+</packagegui> \ 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 @@
<title>Varnish Settings</title>
<aftersaveredirect>pkg_edit.php?xml=varnish_settings.xml&amp;id=0</aftersaveredirect>
<include_file>/usr/local/pkg/varnish.inc</include_file>
- <menu>
- <name>Varnish</name>
- <section>Services</section>
- <configfile>backends.xml</configfile>
- </menu>
- <service>
- <name>varnish</name>
- <rcfile>varnish.sh</rcfile>
- </service>
<tabs>
<tab>
<text>Backends</text>
<url>/pkg.php?xml=backends.xml</url>
</tab>
+ <tab>
+ <text>Settings</text>
+ <url>/pkg.php?xml=varnish_settings.xml</url>
+ <active/>
+ </tab>
+ <tab>
+ <text>Custom VCL</text>
+ <url>/pkg.php?xml=varnish_custom_vcl.xml</url>
+ </tab>
</tabs>
- <configpath>['installedpackages']['varnish']['config']</configpath>
<fields>
<field>
<fielddescr>Storage type</fielddescr>