Commit 1de3f868 authored by Tatuya Kamada's avatar Tatuya Kamada

Make instance-varnish.cfg as a dyanmic template

so that varnish recipe can be used without webchecker.
parent 7edc0a24
...@@ -31,6 +31,9 @@ the HTTP Cache cheking result. ...@@ -31,6 +31,9 @@ the HTTP Cache cheking result.
web-checker-smtp-host is the smtp server to be used to send the web checker web-checker-smtp-host is the smtp server to be used to send the web checker
result. result.
[Note]
When web-checker-* parameters are not given, web_checker will be disabled.
TODO TODO
==== ====
......
{% if software_type == slapparameter_dict['slap_software_type'] -%}
{% set web_checker_parameter = slapparameter_dict['web-checker-mail-address'] -%}
[buildout] [buildout]
parts = parts =
publish-varnish-connection-information publish-varnish-connection-information
varnish-instance varnish-instance
web-checker
cron cron
cron-entry-logrotate cron-entry-logrotate
{# When web_checker related parameter is given, web_checker will be enabled.#}
{% if web_checker_parameter is defined %}
web-checker
cron-entry-web-checker cron-entry-web-checker
{% endif %}
eggs-directory = {{ eggs_directory }} eggs-directory = {{ eggs_directory }}
develop-eggs-directory = {{ develop_eggs_directory }} develop-eggs-directory = {{ develop_eggs_directory }}
...@@ -28,16 +33,16 @@ varnishd-wrapper = ${basedirectory:services}/varnishd ...@@ -28,16 +33,16 @@ varnishd-wrapper = ${basedirectory:services}/varnishd
varnishlog-wrapper = ${rootdirectory:bin}/varnishlog varnishlog-wrapper = ${rootdirectory:bin}/varnishlog
# Binary information # Binary information
varnishd-binary = {{ varnish_location }}/sbin/varnishd varnishd-binary = {{ parameter_dict['varnish'] }}/sbin/varnishd
varnishlog-binary = {{ varnish_location }}/bin/varnishlog varnishlog-binary = {{ parameter_dict['varnish'] }}/bin/varnishlog
shell-path = {{ dash_location }}/bin/dash shell-path = {{ parameter_dict['dash'] }}/bin/dash
# Configuration by VCL # Configuration by VCL
vcl-file = ${rootdirectory:etc}/default.vcl vcl-file = ${rootdirectory:etc}/default.vcl
pid-file = ${basedirectory:run}/varnishd.pid pid-file = ${basedirectory:run}/varnishd.pid
varnish-data = ${directory:varnish-data} varnish-data = ${directory:varnish-data}
# this will pass at -n option # this will pass at -n option
varnish-instance-name = ${directory:varnish-instance} varnish-instance-name = ${directory:varnish-instance}
web-checker = {{ bin_directory }}/web_checker_utility web-checker = {{ parameter_dict['buildout-bin-directory'] }}/web_checker_utility
[cron-entry-web-checker] [cron-entry-web-checker]
<= cron <= cron
...@@ -50,15 +55,14 @@ command = ${varnish-instance:web-checker} ${web-checker:web-checker-config} ...@@ -50,15 +55,14 @@ command = ${varnish-instance:web-checker} ${web-checker:web-checker-config}
recipe = slapos.cookbook:webchecker recipe = slapos.cookbook:webchecker
web-checker-config = ${rootdirectory:etc}/web_checker.cfg web-checker-config = ${rootdirectory:etc}/web_checker.cfg
web-checker-working-directory = ${directory:web-checker} web-checker-working-directory = ${directory:web-checker}
# for now frontend-url is varnish, it will replace with the real front-end one.
frontend-url = ${varnish-instance:ip}:${varnish-instance:server-port} frontend-url = ${varnish-instance:ip}:${varnish-instance:server-port}
wget-binary-path = {{ wget_location }}/bin/wget wget-binary-path = {{ parameter_dict['wget'] }}/bin/wget
varnishlog-binary-path = ${varnish-instance:varnishlog-wrapper} varnishlog-binary-path = ${varnish-instance:varnishlog-wrapper}
web-checker-log = ${basedirectory:log}/web-checker.log web-checker-log = ${basedirectory:log}/web-checker.log
[cron] [cron]
recipe = slapos.cookbook:cron recipe = slapos.cookbook:cron
dcrond-binary = {{ dcron_location }}/sbin/crond dcrond-binary = {{ parameter_dict['dcron'] }}/sbin/crond
cron-entries = ${directory:cron-entries} cron-entries = ${directory:cron-entries}
crontabs = ${directory:crontabs} crontabs = ${directory:crontabs}
cronstamps = ${directory:cronstamps} cronstamps = ${directory:cronstamps}
...@@ -80,9 +84,9 @@ command = ${logrotate:wrapper} ...@@ -80,9 +84,9 @@ command = ${logrotate:wrapper}
[logrotate] [logrotate]
recipe = slapos.cookbook:logrotate recipe = slapos.cookbook:logrotate
# Binaries # Binaries
logrotate-binary = {{ logrotate_location }}/usr/sbin/logrotate logrotate-binary = {{ parameter_dict['logrotate'] }}/usr/sbin/logrotate
gzip-binary = {{ gzip_location }}/bin/gzip gzip-binary = {{ parameter_dict['gzip'] }}/bin/gzip
gunzip-binary = {{ gzip_location }}/bin/gunzip gunzip-binary = {{ parameter_dict['gzip'] }}/bin/gunzip
# Directories # Directories
wrapper = ${rootdirectory:bin}/logrotate wrapper = ${rootdirectory:bin}/logrotate
conf = ${rootdirectory:etc}/logrotate.conf conf = ${rootdirectory:etc}/logrotate.conf
...@@ -115,4 +119,4 @@ etc = ${buildout:directory}/etc ...@@ -115,4 +119,4 @@ etc = ${buildout:directory}/etc
var = ${buildout:directory}/var var = ${buildout:directory}/var
srv = ${buildout:directory}/srv srv = ${buildout:directory}/srv
bin = ${buildout:directory}/bin bin = ${buildout:directory}/bin
{% endif %}
...@@ -90,6 +90,24 @@ extra-context = ...@@ -90,6 +90,24 @@ extra-context =
# Must match the key id in [switch-softwaretype] which uses this section. # Must match the key id in [switch-softwaretype] which uses this section.
raw software_type cloudooo raw software_type cloudooo
[dynamic-template-varnish-parameters]
dash = {{ dash_location }}
dcron = {{ dcron_location }}
gzip = {{ gzip_location }}
logrotate = {{ logrotate_location }}
varnish = {{ varnish_location }}
wget = {{ wget_location }}
buildout-bin-directory = {{ buildout_bin_directory }}
[dynamic-template-varnish]
< = jinja2-template-base
template = {{ template_varnish }}
filename = instance-varnish.cfg
extra-context =
section parameter_dict dynamic-template-varnish-parameters
# Must match the key id in [switch-softwaretype] which uses this section.
raw software_type varnish
[switch-softwaretype] [switch-softwaretype]
recipe = slapos.cookbook:softwaretype recipe = slapos.cookbook:softwaretype
default = {{ template_erp5_development }} default = {{ template_erp5_development }}
...@@ -101,7 +119,7 @@ zope = {{ template_zope }} ...@@ -101,7 +119,7 @@ zope = {{ template_zope }}
mariadb = {{ template_mariadb }} mariadb = {{ template_mariadb }}
sphinx = {{ template_sphinx }} sphinx = {{ template_sphinx }}
tidstorage = ${dynamic-template-tidstorage:rendered} tidstorage = ${dynamic-template-tidstorage:rendered}
varnish = {{ template_varnish }} varnish = ${dynamic-template-varnish:rendered}
[slap-connection] [slap-connection]
# part to migrate to new - separated words # part to migrate to new - separated words
......
...@@ -143,7 +143,7 @@ mode = 640 ...@@ -143,7 +143,7 @@ mode = 640
# XXX: "template.cfg" is hardcoded in instanciation recipe # XXX: "template.cfg" is hardcoded in instanciation recipe
filename = template.cfg filename = template.cfg
template = ${:_profile_base_location_}/instance.cfg.in template = ${:_profile_base_location_}/instance.cfg.in
md5sum = 2d523a62404563ca0470c1e838ddcbfc md5sum = 83914eb5e8be6303e06a7781922cd2a7
extra-context = extra-context =
key apache_location apache:location key apache_location apache:location
key buildout_bin_directory buildout:bin-directory key buildout_bin_directory buildout:bin-directory
...@@ -186,11 +186,14 @@ extra-context = ...@@ -186,11 +186,14 @@ extra-context =
key template_cloudooo template-cloudooo:target key template_cloudooo template-cloudooo:target
key template_sphinx template-sphinx:rendered key template_sphinx template-sphinx:rendered
key template_tidstorage template-tidstorage:target key template_tidstorage template-tidstorage:target
key template_varnish template-varnish:rendered key template_varnish template-varnish:target
key template_zope template-zope:rendered key template_zope template-zope:rendered
key tesseract_location tesseract:location key tesseract_location tesseract:location
key w3m_location w3m:location key w3m_location w3m:location
key zlib_location zlib:location key zlib_location zlib:location
key dash_location dash:location
key varnish_location varnish-3.0:location
key wget_location wget:location
[template-memcached] [template-memcached]
< = template-jinja2-base < = template-jinja2-base
...@@ -216,16 +219,11 @@ extra-context = ...@@ -216,16 +219,11 @@ extra-context =
key local_bt5_repository local-bt5-repository:list key local_bt5_repository local-bt5-repository:list
[template-varnish] [template-varnish]
< = template-jinja2-base recipe = slapos.recipe.build:download
filename = instance-varnish.cfg url = ${:_profile_base_location_}/instance-varnish.cfg.in
md5sum = 1e1b1ade6a60d2eb803ac075a753d360 md5sum = ea07f22c97e50105a88380da3b92b5e6
extra-context = mode = 640
key dash_location dash:location
key dcron_location dcron:location
key gzip_location gzip:location
key logrotate_location logrotate:location
key varnish_location varnish-3.0:location
key wget_location wget:location
[networkcache] [networkcache]
# signature certificates of the following uploaders. # signature certificates of the following uploaders.
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment