From f37df893bbfe13076f32bd578fa4a27053ce789f Mon Sep 17 00:00:00 2001 From: Kazuhiko Shiozaki <kazuhiko@nexedi.com> Date: Tue, 23 Jul 2013 22:43:40 +0900 Subject: [PATCH] make tcpv4-port configurable and add json schemas. --- .../instance-varnish-input-schema.json | 30 +++++++++++++++++++ .../instance-varnish-output-schema.json | 11 +++++++ software/varnish/instance-varnish.cfg.in | 9 +++--- 3 files changed, 46 insertions(+), 4 deletions(-) create mode 100644 software/varnish/instance-varnish-input-schema.json create mode 100644 software/varnish/instance-varnish-output-schema.json diff --git a/software/varnish/instance-varnish-input-schema.json b/software/varnish/instance-varnish-input-schema.json new file mode 100644 index 000000000..e3ec4e6c6 --- /dev/null +++ b/software/varnish/instance-varnish-input-schema.json @@ -0,0 +1,30 @@ +{ + "$schema": "http://json-schema.org/draft-04/schema#", + "extends": "./schema-definitions.json#", + "properties": { + "tcpv4-port": { + "allOf": [{ + "$ref": "#/definitions/tcpv4port" + }, { + "description": "Start allocating ports at this value, going upward", + "default": 6001 + }] + }, + "backend-url": { + "description": "The backend url that varnish will cache", + "type": "string" + }, + "web-checker-frontend-url": { + "description": "The entry-point-url that web checker will check the HTTP headers of all links in the web site", + "type": "string" + }, + "web-checker-mail-address": { + "description": "Email address to which web checker result is sent", + "type": "string" + }, + "web-checker-smtp-host": { + "description": "The smtp server to be used to send the web checker result", + "type": "string" + } + } +} diff --git a/software/varnish/instance-varnish-output-schema.json b/software/varnish/instance-varnish-output-schema.json new file mode 100644 index 000000000..8b752ec5a --- /dev/null +++ b/software/varnish/instance-varnish-output-schema.json @@ -0,0 +1,11 @@ +{ + "$schema": "http://json-schema.org/draft-04/schema#", + "description": "Values returned by Varnish instanciation", + "properties": { + "url": { + "description": "Varnish HTTP service access information", + "type": "string" + } + }, + "type": "object" +} diff --git a/software/varnish/instance-varnish.cfg.in b/software/varnish/instance-varnish.cfg.in index a67958b55..e06866e74 100644 --- a/software/varnish/instance-varnish.cfg.in +++ b/software/varnish/instance-varnish.cfg.in @@ -1,4 +1,5 @@ {% set web_checker_parameter = slapparameter_dict['web-checker-mail-address'] -%} +{% set tcpv4_port = slapparameter_dict.get('tcpv4_port', 6001) | int -%} [buildout] parts = publish-varnish-connection-information @@ -17,7 +18,7 @@ develop-eggs-directory = {{ develop_eggs_directory }} offline = true [publish-varnish-connection-information] -recipe = slapos.cookbook:publishurl +recipe = slapos.cookbook:publish.serialised url = http://${varnish-instance:ip}:${varnish-instance:server-port}/ [varnish-instance] @@ -25,9 +26,9 @@ recipe = slapos.cookbook:generic.varnish # Network options ip = ${slap-network-information:local-ipv4} -server-port = 6001 -manager-port = 6002 -stunnel-port = 6003 +server-port = {{ tcpv4_port }} +manager-port = {{ tcpv4_port + 1 }} +stunnel-port = {{ tcpv4_port + 2}} # Paths: Running wrappers varnishd-wrapper = ${basedirectory:services}/varnishd -- 2.30.9