fixup! slapos-testing: remove jio and officejs tests.
[slapos.git] / software / varnish / instance-varnish.cfg.in
1 {% set tcpv4_port = slapparameter_dict.get('tcpv4_port', 6001) -%}
2 {% set ip = (ipv4_set | list)[0] %}
3 [buildout]
4 parts =
5   publish-varnish-connection-information
6   varnish-instance
7   cron
8   cron-entry-logrotate
9   {# When web_checker related parameter is given, web_checker will be enabled.-#}
10 {% set web_checker_dict = slapparameter_dict.get('web-checker', {}) -%}
11 {% if web_checker_dict -%}
12   web-checker
13   cron-entry-web-checker
14   logrotate-entry-web-checker
15
16 [cron-entry-web-checker]
17 <= cron
18 recipe = slapos.cookbook:cron.d
19 name = web-checker
20 frequency = 0 0 * * *
21 command = ${varnish-instance:web-checker} ${web-checker:web-checker-config}
22
23 [web-checker]
24 recipe = slapos.cookbook:webchecker
25 web-checker-config = ${rootdirectory:etc}/web_checker.cfg
26 web-checker-working-directory = ${directory:web-checker}
27 frontend-url = {{ web_checker_dict.get('frontend-url', 'http://%(ip)s:%(port)s/') % {
28   'ip': ip,
29   'port': tcpv4_port,
30 } }}
31 mail-address = {{ web_checker_dict['mail-address'] }}
32 smtp-host = {{ web_checker_dict['smtp-host'] }}
33 wget-binary-path = {{ parameter_dict['wget'] }}/bin/wget
34 varnishlog-binary-path = ${varnish-instance:varnishlog-wrapper}
35 web-checker-log = ${basedirectory:log}/web-checker.log
36
37 [logrotate-entry-web-checker]
38 <= logrotate
39 recipe = slapos.cookbook:logrotate.d
40 name = web-checker
41 log = ${web-checker:web-checker-log}
42 frequency = daily
43 rotate-num = 30
44 sharedscripts = true
45 notifempty = true
46 create = true
47 {%- endif %}
48
49 eggs-directory = {{ eggs_directory }}
50 develop-eggs-directory = {{ develop_eggs_directory }}
51 offline = true
52
53 [publish-varnish-connection-information]
54 recipe = slapos.cookbook:publish.serialised
55 url = http://${varnish-instance:ip}:${varnish-instance:server-port}/
56
57 [varnish-instance]
58 recipe = slapos.cookbook:generic.varnish
59 backend-url = {{ slapparameter_dict['backend-url'] }}
60
61 # Network options
62 ip = {{ ip }}
63 server-port =  {{ tcpv4_port }}
64 manager-port = {{ tcpv4_port + 1 }}
65 stunnel-port = {{ tcpv4_port + 2}}
66
67 # Paths: Running wrappers
68 varnishd-wrapper = ${basedirectory:services}/varnishd
69 varnishlog-wrapper = ${rootdirectory:bin}/varnishlog
70 stunnel-wrapper = ${basedirectory:services}/stunnel
71
72 # Binary information
73 varnishd-binary = {{ parameter_dict['varnish'] }}/sbin/varnishd
74 varnishlog-binary = {{ parameter_dict['varnish'] }}/bin/varnishlog
75 shell-path = {{ parameter_dict['dash'] }}/bin/dash
76 stunnel-binary = {{ parameter_dict['stunnel'] }}/bin/stunnel
77 gcc-location = {{ parameter_dict['gcc'] }}/bin
78 # Configuration by VCL
79 vcl-file = ${rootdirectory:etc}/default.vcl
80 pid-file = ${basedirectory:run}/varnishd.pid
81 stunnel-conf-file = ${rootdirectory:etc}/stunnel.conf
82 stunnel-pid-file = ${basedirectory:run}/stunnel.pid
83 varnish-data = ${directory:varnish-data}
84 # this will pass at -n option
85 varnish-instance-name = ${directory:varnish-instance}
86 web-checker = {{ parameter_dict['buildout-bin-directory'] }}/web_checker_utility
87
88 [cron]
89 recipe = slapos.cookbook:cron
90 dcrond-binary = {{ parameter_dict['dcron'] }}/sbin/crond
91 cron-entries = ${directory:cron-entries}
92 crontabs = ${directory:crontabs}
93 cronstamps = ${directory:cronstamps}
94 binary = ${basedirectory:services}/crond
95 catcher = ${cron-simplelogger:wrapper}
96
97 [cron-simplelogger]
98 recipe = slapos.cookbook:simplelogger
99 wrapper = ${rootdirectory:bin}/cron_simplelogger
100 log = ${basedirectory:log}/cron.log
101
102 [cron-entry-logrotate]
103 <= cron
104 recipe = slapos.cookbook:cron.d
105 name = logrotate
106 frequency = 0 0 * * *
107 command = ${logrotate:wrapper}
108
109 [logrotate]
110 recipe = slapos.cookbook:logrotate
111 # Binaries
112 logrotate-binary = {{ parameter_dict['logrotate'] }}/usr/sbin/logrotate
113 gzip-binary = {{ parameter_dict['gzip'] }}/bin/gzip
114 gunzip-binary = {{ parameter_dict['gzip'] }}/bin/gunzip
115 # Directories
116 wrapper = ${rootdirectory:bin}/logrotate
117 conf = ${rootdirectory:etc}/logrotate.conf
118 logrotate-entries = ${directory:logrotate-entries}
119 backup = ${directory:logrotate-backup}
120 state-file = ${rootdirectory:srv}/logrotate.status
121
122 [basedirectory]
123 recipe = slapos.cookbook:mkdirectory
124 services = ${rootdirectory:etc}/run
125 run = ${rootdirectory:var}/run
126 backup = ${rootdirectory:srv}/backup
127 log = ${rootdirectory:var}/log
128 backup = ${rootdirectory:srv}/backup
129
130 [directory]
131 recipe = slapos.cookbook:mkdirectory
132 varnish-data = ${rootdirectory:srv}/varnish
133 varnish-instance = ${directory:varnish-data}/instance
134 cron-entries = ${rootdirectory:etc}/cron.d
135 crontabs = ${rootdirectory:etc}/crontabs
136 cronstamps = ${rootdirectory:etc}/cronstamps
137 logrotate-backup = ${basedirectory:backup}/logrotate
138 logrotate-entries = ${rootdirectory:etc}/logrotate.d
139 web-checker = ${rootdirectory:srv}/web-checker
140
141 [rootdirectory]
142 recipe = slapos.cookbook:mkdirectory
143 etc = ${buildout:directory}/etc
144 var = ${buildout:directory}/var
145 srv = ${buildout:directory}/srv
146 bin = ${buildout:directory}/bin