Commit c67b33ec authored by Romain Courteaud's avatar Romain Courteaud

Allow to create non SSL backend access

parent 46b209b9
......@@ -151,22 +151,34 @@ class Recipe(GenericSlapRecipe):
longrequest_logger_interval=longrequest_logger_interval,
**zope_dict)
haproxy_backend_list.append('${%(part_name)s:ip}:${%(part_name)s:port}' % dict(part_name=part_name))
scheme = backend_configuration.get('scheme', ['https'])
# now generate backend access
current_apache_port += 1
current_haproxy_port += 1
part_list.append('apache-%(backend_name)s ca-apache-%(backend_name)s logrotate-entry-apache-%(backend_name)s haproxy-%(backend_name)s' % dict(backend_name=backend_name))
backend_dict = dict(
backend_name=backend_name,
apache_port=current_apache_port,
apache_public_port=current_apache_port+1,
haproxy_port=current_haproxy_port,
access_control_string=backend_configuration['access-control-string'],
maxconn=backend_configuration['maxconn'],
server_check_path='/%s/getId' % site_id,
haproxy_backend_list=' '.join(haproxy_backend_list)
)
publish_url_list.append('url-%(backend_name)s = https://[${apache-%(backend_name)s:ip}]:${apache-%(backend_name)s:port}' % dict(
backend_name=backend_name))
current_apache_port += 1
output += snippet_backend % backend_dict
if 'http' in scheme:
part_list.append('apache-public-%(backend_name)s logrotate-entry-apache-public-%(backend_name)s' % dict(backend_name=backend_name))
publish_url_list.append('url-public-%(backend_name)s = https://[${apache-public-%(backend_name)s:ip}]:${apache-public-%(backend_name)s:port}' % dict(
backend_name=backend_name))
if 'https' in scheme:
part_list.append('apache-%(backend_name)s ca-apache-%(backend_name)s logrotate-entry-apache-%(backend_name)s haproxy-%(backend_name)s' % dict(backend_name=backend_name))
publish_url_list.append('url-%(backend_name)s = https://[${apache-%(backend_name)s:ip}]:${apache-%(backend_name)s:port}' % dict(
backend_name=backend_name))
output += SECTION_BACKEND_PUBLISHER + '\n'
output += '\n'.join(publish_url_list)
part_list.append('publish-apache-backend-list')
......
[apache-public-%(backend_name)s]
recipe = slapos.cookbook:apache.zope.backend
backend = http://$${haproxy-public-%(backend_name)s:ip}:$${haproxy-%(backend_name)s:port}/
ip = $${slap-network-information:global-ipv6}
port = %(apache_public_port)s
scheme = http
wrapper = $${basedirectory:services}/apache-public-%(backend_name)s
configuration-file = $${directory:apache-conf}/apache-public-%(backend_name)s.conf
access-control-string = %(access_control_string)s
pid-file = $${basedirectory:run}/apache-public-%(backend_name)s.pid
lock-file = $${basedirectory:run}/apache-public-%(backend_name)s.lock
error-log = $${basedirectory:log}/apache-public-%(backend_name)s-error.log
access-log = $${basedirectory:log}/apache-public-%(backend_name)s-access.log
apache-binary = ${apache:location}/bin/httpd
[apache-%(backend_name)s]
recipe = slapos.cookbook:apache.zope.backend
backend = http://$${haproxy-%(backend_name)s:ip}:$${haproxy-%(backend_name)s:port}/
ip = $${slap-network-information:global-ipv6}
port = %(apache_port)s
wrapper = $${rootdirectory:bin}/apache-%(backend_name)s
scheme = https
key-file = $${directory:apache-conf}/apache-%(backend_name)s.key
cert-file = $${directory:apache-conf}/apache-%(backend_name)s.crt
configuration-file = $${directory:apache-conf}/apache-%(backend_name)s.conf
......@@ -22,6 +38,13 @@ cert-file = $${apache-%(backend_name)s:cert-file}
executable = $${apache-%(backend_name)s:wrapper}
wrapper = $${basedirectory:services}/apache-%(backend_name)s
[logrotate-entry-apache-public-%(backend_name)s]
<= logrotate
recipe = slapos.cookbook:logrotate.d
name = apache-public-%(backend_name)s
log = $${apache-public-%(backend_name)s:error-log} $${apache-public-%(backend_name)s:access-log}
post = ${buildout:bin-directory}/killpidfromfile $${apache-public-%(backend_name)s:pid-file} SIGUSR1
[logrotate-entry-apache-%(backend_name)s]
<= logrotate
recipe = slapos.cookbook:logrotate.d
......
......@@ -136,7 +136,7 @@ mode = 0644
[template-snippet-backend]
recipe = slapos.recipe.template
url = ${:_profile_base_location_}/snippet-backend.cfg
md5sum = e2b26547ba1435ec1b8e8cd1de89e2c6
md5sum = 1f6d4341f02bc2432625d3a8cee6f65f
output = ${buildout:directory}/template-snippet-backend.cfg
mode = 0644
......
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