From be3f6bb35e7043ced9488d724c942d530f324abc Mon Sep 17 00:00:00 2001 From: Scott Ullrich Date: Mon, 26 Apr 2010 21:26:54 -0400 Subject: Adding inital revision of varnish64 package --- config/varnish64/backends.xml | 123 ++++++++++++++++++++ config/varnish64/varnish.inc | 204 ++++++++++++++++++++++++++++++++++ config/varnish64/varnish_settings.xml | 93 ++++++++++++++++ 3 files changed, 420 insertions(+) create mode 100644 config/varnish64/backends.xml create mode 100644 config/varnish64/varnish.inc create mode 100644 config/varnish64/varnish_settings.xml (limited to 'config/varnish64') diff --git a/config/varnish64/backends.xml b/config/varnish64/backends.xml new file mode 100644 index 00000000..bcec031b --- /dev/null +++ b/config/varnish64/backends.xml @@ -0,0 +1,123 @@ + + + + + + + + Describe your package here + Describe your package requirements here + Currently there are no FAQ items provided. + varnishbackends + 0.0.1 + Varnish: Whitelist + + Varnish + +
Services
+ backends.xml +
+ + + Varnish Backends + /pkg.php?xml=backends.xml + + + + ['installedpackages']['varnish']['config'] + + + IPAddress + ipaddress + + + Name + backendname + + + + + IPAddress + ipaddress + Enter the IP Address of the backend web server. + input + + + Backend name + backendname + Enter the name of this backend web server. + input + + + Port + port + Enter the TCP/IP port of the webserver. + input + + + First byte timeout + first_byte_timeout + time to wait for the first byte from the backend and .between_bytes_timeout for time to wait between each received byte. + input + + + Connect timeout + connect_timeout + The time to wait for a backend connection. + input + + + none + none + rowhelper + + + URL + urlmapping + Enter the URL that will be mapped to this backend. + input + + + + + + + + sync_package_varnish(); + + + sync_package_varnish(); + +
\ No newline at end of file diff --git a/config/varnish64/varnish.inc b/config/varnish64/varnish.inc new file mode 100644 index 00000000..5df22487 --- /dev/null +++ b/config/varnish64/varnish.inc @@ -0,0 +1,204 @@ + + 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. + */ +/* ========================================================================== */ + +function sync_package_varnish() { + if($config['installedpackages']['varnishsettings']['config'] != "") { + foreach($config['installedpackages']['varnishsettings']['config'] as $vs) { + if($vs['storagetype'] == "malloc") + $storage_type = "-s malloc,{$vs['storagesize']}MB"; + else + $storage_type = "-s file,/var/varnish/storage.bin,{$vs['storagesize']}MB"; + if($vs['listeningport']) + $listeningport = "-a :{$vs['listeningport']}"; + else + $listeningport = "-a :80"; + } + $fd = fopen("/usr/local/etc/rc.d/varnish.sh", "w"); + $rc_file = <</dev/null +killall varnishd 2>/dev/null +sleep 1 +/usr/local/sbin/varnishd \ + {$listeningport} \ + -f /var/etc/default.vcl \ + {$storage_type} \ + -w 200,4000,50 + +EOF; + fwrite($fd, $rc_file); + fclose($fd); + exec("chmod a+rx /usr/local/etc/rc.d/varnish.sh") + } + + if(!$errorvcl) + $errorvcl = << + + + +"} obj.status " " obj.response {" + + + +

We are very sorry but an error occured during this request.

+
+

Please press refresh in your browser to try again.

+

Varnish Error "} obj.status " " obj.response {"

+

"} obj.response {"

+

Guru Meditation:

+

XID: "} req.xid {"

+ + + +"}; +deliver; + +EOF; + + $backends = ""; + if($config['installedpackages']['varnishbackends']['config'] != "") { + foreach($config['installedpackages']['varnishbackends']['config'] as $backend) { + $urlmappings = ""; + $isfirst = true; + if($config['installedpackages']['varnishurlmappings']['config'] != "") { + foreach($config['installedpackages']['varnishurlmappings']['config'] as $urlmapping) { + if(!$isfirst) + $urlmappings .= "else "; + $urlmappings = << \ No newline at end of file diff --git a/config/varnish64/varnish_settings.xml b/config/varnish64/varnish_settings.xml new file mode 100644 index 00000000..60d08c1d --- /dev/null +++ b/config/varnish64/varnish_settings.xml @@ -0,0 +1,93 @@ + + + + + + + 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. + varnishsettings + 0.0.1 + 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 + + + ['installedpackages']['varnish']['config'] + + + Storage type + storagetype + The SMTP version banner that is reported upon initial connection. + select + + + + + + + Cache storage size in megabytes + storagesize + Enter the size of the varnish cache in megabytes. HINT: 1024 == 1 Gigabyte + input + + + Listening port + listeningport + Enter the port you would like varnish to listen on. Defaults to 80. + input + + + + + + sync_package_varnish(); + +
\ No newline at end of file -- cgit v1.2.3