Commit 54259659 authored by Gabriel Monnerat's avatar Gabriel Monnerat

If the cache is enabled, the varnish and stunnel will be added between...

If the cache is enabled, the varnish and stunnel will be added between frontend and backend. With this, the connection will be: frontend > varnish > stunnel > backend.
parent 702aa9be
...@@ -96,18 +96,24 @@ class Recipe(BaseSlapRecipe): ...@@ -96,18 +96,24 @@ class Recipe(BaseSlapRecipe):
slave_port = 80 slave_port = 80
service_name = "varnish_%s" % reference service_name = "varnish_%s" % reference
varnish_ip = self.getLocalIPv4Address() varnish_ip = self.getLocalIPv4Address()
stunnel_port = base_varnish_port + 1
self.installVarnishCache(service_name, self.installVarnishCache(service_name,
ip=varnish_ip, ip=varnish_ip,
port=base_varnish_port, port=base_varnish_port,
control_port=base_varnish_control_port, control_port=base_varnish_control_port,
backend_host=slave_host, backend_host=varnish_ip,
backend_port=slave_port, backend_port=stunnel_port,
size="1G") size="1G")
service_dict[service_name] = dict(public_ip=varnish_ip, service_dict[service_name] = dict(public_ip=varnish_ip,
public_port=base_varnish_port, public_port=stunnel_port,
private_ip=slave_host, private_ip=slave_host,
private_port=slave_port) private_port=slave_port)
rewrite_rule_list.append("%s http://%s:%s" % \
(reference.replace("-", ""), varnish_ip, base_varnish_port))
else:
rewrite_rule_list.append("%s %s" % (reference.replace("-", ""), url))
if service_dict != {}: if service_dict != {}:
self.installStunnel(service_dict, self.installStunnel(service_dict,
certificate, key, certificate, key,
......
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