Commit c9a3ff91 authored by Rafael Monnerat's avatar Rafael Monnerat

slapos-master: Follow up recent changes on erp5 stack

  Apply commits:
   stack.erp5: Drop unneeded executable permissions. (fe7ea950)
   stack.logrotate: Fix support for stopped processes.
   stack.erp5: Use an iterator to produce port numbers.
   software/erp5: if wendelin-core-zblk-fmt is not given, then use wendelin.core's default.
   software/erp5 & stack/erp5: Add a new parameter wendelin-core-zblk-fmt.
parent 7ad82859
{# This file configures apache to redirect requests from ports to specific urls.
# It provides SSL support for server and optionaly for client.
#
# All parameters are given through the `parameter_dict` variable, see the
# list entries :
#
# parameter_dict = {
# # The path given to "PidFile"
# "pid-file": "<file_path>",
#
# # The number given to "TimeOut"
# "timeout": 300,
#
# # The path given to "SSLCertificateFile"
# "cert": "<file_path>",
#
# # The path given to "SSLCertificateKeyFile"
# "key": "<file_path>",
#
# # The value given to "SSLCipherSuite" (can be empty)
# "cipher": "",
#
# # The path given to "SSLSessionCache shmcb:<folder_path>(512000)"
# "ssl-session-cache": "<folder_path>",
#
# # The path given to "SSLCACertificateFile" (can be empty)
# # If this value is not empty, it enables client certificate check.
# # (Enabling "SSLVerifyClient require")
# "ca-cert": "<file_path>",
#
# # The path given to "SSLCARevocationFile" (used if ca-cert is not
# # empty)
# "crl": "<file_path>",
#
# # The path given to "ErrorLog"
# "error-log": "<file_path>",
#
# # The path given to "AccessLog"
# "access-log": "<file_path>",
#
# # The list of ip which apache will listen to.
# "ip-list": [
# "0.0.0.0",
# "[::1]",
# ],
#
# # The list of backends which apache should redirect to.
# "backend-list": [
# # (port, unused, internal_scheme)
# (8000, _, "http://10.0.0.10:8001"),
# (8002, _, "http://10.0.0.10:8003"),
# ],
# }
#
# This sample of `parameter_dict` will make apache listening to :
# - 0.0.0.0:8000 redirecting internaly to http://10.0.0.10:8001
# - [::1]:8000 redirecting internaly to http://10.0.0.10:8001
# - 0.0.0.0:8002 redirecting internaly to http://10.0.0.10:8003
# - [::1]:8002 redirecting internaly to http://10.0.0.10:8003
-#}
LoadModule unixd_module modules/mod_unixd.so LoadModule unixd_module modules/mod_unixd.so
LoadModule access_compat_module modules/mod_access_compat.so LoadModule access_compat_module modules/mod_access_compat.so
LoadModule authz_core_module modules/mod_authz_core.so LoadModule authz_core_module modules/mod_authz_core.so
...@@ -18,7 +78,7 @@ LoadModule headers_module modules/mod_headers.so ...@@ -18,7 +78,7 @@ LoadModule headers_module modules/mod_headers.so
LoadModule deflate_module modules/mod_deflate.so LoadModule deflate_module modules/mod_deflate.so
LoadModule filter_module modules/mod_filter.so LoadModule filter_module modules/mod_filter.so
AddOutputFilterByType DEFLATE text/cache-manifest text/html text/plain text/css application/hal+json application/json application/x-javascript text/xml application/xml application/rss+xml text/javascript image/svg+xml AddOutputFilterByType DEFLATE text/cache-manifest text/html text/plain text/css application/hal+json application/json application/x-javascript text/xml application/xml application/rss+xml text/javascript image/svg+xml application/x-font-ttf application/font-woff application/font-woff2 application/x-font-opentype
PidFile "{{ parameter_dict['pid-file'] }}" PidFile "{{ parameter_dict['pid-file'] }}"
ServerAdmin admin@ ServerAdmin admin@
...@@ -68,7 +128,7 @@ CustomLog "{{ parameter_dict['access-log'] }}" combined ...@@ -68,7 +128,7 @@ CustomLog "{{ parameter_dict['access-log'] }}" combined
</Directory> </Directory>
RewriteEngine On RewriteEngine On
{% for family_name, (port, _, backend, enable_authentication) in parameter_dict['backend-list'].items() -%} {% for port, _, backend, enable_authentication in parameter_dict['backend-list'] -%}
{% for ip in parameter_dict['ip-list'] -%} {% for ip in parameter_dict['ip-list'] -%}
Listen {{ ip }}:{{ port }} Listen {{ ip }}:{{ port }}
{% endfor -%} {% endfor -%}
...@@ -82,8 +142,8 @@ Listen {{ ip }}:{{ port }} ...@@ -82,8 +142,8 @@ Listen {{ ip }}:{{ port }}
LogFormat "%h %l %{REMOTE_USER}i %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\" %D" combined LogFormat "%h %l %{REMOTE_USER}i %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\" %D" combined
# We would like to separate the the authentificated logs. # We would like to separate the the authentificated logs.
ErrorLog "{{ parameter_dict['log-dir'] }}/apache-{{ family_name }}-error.log" ErrorLog "{{ parameter_dict['log-dir'] }}/apache-service-error.log"
CustomLog "{{ parameter_dict['log-dir'] }}/apache-{{ family_name }}-access.log" combined CustomLog "{{ parameter_dict['log-dir'] }}/apache-service-access.log" combined
{% endif -%} {% endif -%}
SSLEngine on SSLEngine on
RewriteRule ^/(.*) {{ backend }}/$1 [L,P] RewriteRule ^/(.*) {{ backend }}/$1 [L,P]
......
# THIS IS NOT A BUILDOUT FILE, despite purposedly using a compatible syntax.
# The only allowed lines here are (regexes):
# - "^#" comments, copied verbatim
# - "^[" section beginings, copied verbatim
# - lines containing an "=" sign which must fit in the following categorie.
# - "^\s*filename\s*=\s*path\s*$" where "path" is relative to this file
# But avoid directories, they are not portable.
# Copied verbatim.
# - "^\s*hashtype\s*=.*" where "hashtype" is one of the values supported
# by the re-generation script.
# Re-generated.
# - other lines are copied verbatim
# Substitution (${...:...}), extension ([buildout] extends = ...) and
# section inheritance (< = ...) are NOT supported (but you should really
# not need these here).
[template-erp5]
filename = instance-erp5.cfg.in
md5sum = 1489091851f27c41243eeaa4967cc91c
[template-balancer]
filename = instance-balancer.cfg.in
md5sum = a410f10fe9766c9321ffd7b18ace5a4f
[template-apache-backend-conf]
filename = apache-backend.conf.in
md5sum = ea77222f440bb72fee4939fe1b72976e
[template-create-erp5-site-real]
filename = instance-create-erp5-site-real.cfg.in
md5sum = 86a2b244341218cd0c4b6d398c61ee20
...@@ -17,8 +17,12 @@ per partition. No more (undefined result), no less (IndexError). ...@@ -17,8 +17,12 @@ per partition. No more (undefined result), no less (IndexError).
{% do apache_ip_list.append('[' ~ ipv6 ~ ']') -%} {% do apache_ip_list.append('[' ~ ipv6 ~ ']') -%}
{% endif -%} {% endif -%}
[simplefile] [jinja2-template-base]
recipe = slapos.recipe.template:jinja2 recipe = slapos.recipe.template:jinja2
mode = 644
[simplefile]
< = jinja2-template-base
template = inline:{{ '{{ content }}' }} template = inline:{{ '{{ content }}' }}
{% macro simplefile(section_name, file_path, content, mode='') -%} {% macro simplefile(section_name, file_path, content, mode='') -%}
...@@ -44,7 +48,7 @@ ipv4 = {{ ipv4 }} ...@@ -44,7 +48,7 @@ ipv4 = {{ ipv4 }}
{% endif -%} {% endif -%}
{% set haproxy_dict = {} -%} {% set haproxy_dict = {} -%}
{% set apache_dict = {} -%} {% set apache_dict = {} -%}
{% set next_port = slapparameter_dict['tcpv4-port'] -%} {% set next_port = itertools.count(slapparameter_dict['tcpv4-port']).next -%}
{% for family_name, parameter_id_list in sorted( {% for family_name, parameter_id_list in sorted(
slapparameter_dict['zope-family-dict'].iteritems()) -%} slapparameter_dict['zope-family-dict'].iteritems()) -%}
{% set zope_family_address_list = [] -%} {% set zope_family_address_list = [] -%}
...@@ -56,14 +60,14 @@ ipv4 = {{ ipv4 }} ...@@ -56,14 +60,14 @@ ipv4 = {{ ipv4 }}
{% do has_webdav.append(None) %} {% do has_webdav.append(None) %}
{% endif -%} {% endif -%}
{% if use_ipv6 -%} {% if use_ipv6 -%}
[{{ section('zope-tunnel-' ~ next_port) }}] {% set current_port = next_port() -%}
[{{ section('zope-tunnel-' ~ current_port) }}]
< = zope-tunnel-base < = zope-tunnel-base
base-name = {{ 'zeo-tunnel-' ~ next_port }} base-name = {{ 'zeo-tunnel-' ~ current_port }}
ipv4-port = {{ next_port }} ipv4-port = {{ current_port }}
ipv6-port = {{ zope_address.split(']:')[1] }} ipv6-port = {{ zope_address.split(']:')[1] }}
ipv6 = {{ zope_address.split(']:')[0][1:] }} ipv6 = {{ zope_address.split(']:')[0][1:] }}
{% set zope_effective_address = ipv4 ~ ":" ~ next_port -%} {% set zope_effective_address = ipv4 ~ ":" ~ current_port -%}
{% set next_port = next_port + 1 -%}
{% else -%} {% else -%}
{% set zope_effective_address = zope_address -%} {% set zope_effective_address = zope_address -%}
{% endif -%} {% endif -%}
...@@ -77,8 +81,7 @@ ipv6 = {{ zope_address.split(']:')[0][1:] }} ...@@ -77,8 +81,7 @@ ipv6 = {{ zope_address.split(']:')[0][1:] }}
# do a no-op getitem. # do a no-op getitem.
-#} -#}
{% do zope_family_address_list[0][0] -%} {% do zope_family_address_list[0][0] -%}
{% set haproxy_port = next_port -%} {% set haproxy_port = next_port() -%}
{% set next_port = next_port + 1 -%}
{% do haproxy_dict.__setitem__(family_name, (haproxy_port, zope_family_address_list)) -%} {% do haproxy_dict.__setitem__(family_name, (haproxy_port, zope_family_address_list)) -%}
{% if has_webdav -%} {% if has_webdav -%}
{% set internal_scheme = 'http' -%}{# mod_rewrite does not recognise webdav scheme -#} {% set internal_scheme = 'http' -%}{# mod_rewrite does not recognise webdav scheme -#}
...@@ -89,8 +92,7 @@ ipv6 = {{ zope_address.split(']:')[0][1:] }} ...@@ -89,8 +92,7 @@ ipv6 = {{ zope_address.split(']:')[0][1:] }}
{% endif -%} {% endif -%}
{% set backend_path = slapparameter_dict['backend-path-dict'][family_name] -%} {% set backend_path = slapparameter_dict['backend-path-dict'][family_name] -%}
{% set ssl_authentication = slapparameter_dict['ssl-authentication-dict'][family_name] -%} {% set ssl_authentication = slapparameter_dict['ssl-authentication-dict'][family_name] -%}
{% do apache_dict.__setitem__(family_name, (next_port, external_scheme, internal_scheme ~ '://' ~ ipv4 ~ ':' ~ haproxy_port ~ backend_path, ssl_authentication)) -%} {% do apache_dict.__setitem__(family_name, (next_port(), external_scheme, internal_scheme ~ '://' ~ ipv4 ~ ':' ~ haproxy_port ~ backend_path, ssl_authentication)) -%}
{% set next_port = next_port + 1 -%}
{% endfor -%} {% endfor -%}
[haproxy-cfg-parameter-dict] [haproxy-cfg-parameter-dict]
...@@ -100,7 +102,7 @@ backend-dict = {{ dumps(haproxy_dict) }} ...@@ -100,7 +102,7 @@ backend-dict = {{ dumps(haproxy_dict) }}
ip = {{ ipv4 }} ip = {{ ipv4 }}
[haproxy-cfg] [haproxy-cfg]
recipe = slapos.recipe.template:jinja2 < = jinja2-template-base
template = {{ parameter_dict['template-haproxy-cfg'] }} template = {{ parameter_dict['template-haproxy-cfg'] }}
rendered = ${directory:etc}/haproxy.cfg rendered = ${directory:etc}/haproxy.cfg
context = section parameter_dict haproxy-cfg-parameter-dict context = section parameter_dict haproxy-cfg-parameter-dict
...@@ -120,7 +122,7 @@ ca-cert = ${directory:apache-conf}/ca.crt ...@@ -120,7 +122,7 @@ ca-cert = ${directory:apache-conf}/ca.crt
crl = ${directory:apache-conf}/crl.pem crl = ${directory:apache-conf}/crl.pem
[apache-conf-parameter-dict] [apache-conf-parameter-dict]
backend-list = {{ dumps(apache_dict) }} backend-list = {{ dumps(apache_dict.values()) }}
ip-list = {{ dumps(apache_ip_list) }} ip-list = {{ dumps(apache_ip_list) }}
pid-file = ${directory:run}/apache.pid pid-file = ${directory:run}/apache.pid
error-log = ${directory:log}/apache-error.log error-log = ${directory:log}/apache-error.log
...@@ -145,7 +147,7 @@ shared-crl = {{ shared_ca_path }}/crl ...@@ -145,7 +147,7 @@ shared-crl = {{ shared_ca_path }}/crl
[apache-conf] [apache-conf]
recipe = slapos.recipe.template:jinja2 < = jinja2-template-base
template = {{ parameter_dict['template-apache-conf'] }} template = {{ parameter_dict['template-apache-conf'] }}
rendered = ${directory:apache-conf}/apache.conf rendered = ${directory:apache-conf}/apache.conf
context = section parameter_dict apache-conf-parameter-dict context = section parameter_dict apache-conf-parameter-dict
...@@ -201,22 +203,18 @@ crl = ...@@ -201,22 +203,18 @@ crl =
{% do part_list.append('logrotate-' ~ base_name) -%} {% do part_list.append('logrotate-' ~ base_name) -%}
{% do apache_service_log_list.__setitem__(family_name, base_name) -%} {% do apache_service_log_list.__setitem__(family_name, base_name) -%}
[logrotate-{{ base_name }}] [logrotate-{{ base_name }}]
recipe = slapos.cookbook:logrotate.d < = logrotate-entry-base
logrotate-entries = ${logrotate:logrotate-entries}
backup = ${logrotate:backup}
name = {{ base_name }} name = {{ base_name }}
log = ${apache-conf-parameter-dict:log-dir}/{{ base_name }}-error.log ${apache-conf-parameter-dict:log-dir}/{{ base_name }}-access.log log = ${apache-conf-parameter-dict:log-dir}/{{ base_name }}-error.log ${apache-conf-parameter-dict:log-dir}/{{ base_name }}-access.log
post = {{ parameter_dict['bin-directory'] }}/slapos-kill --pidfile ${apache-conf-parameter-dict:pid-file} -s USR1 post = test ! -s ${apache-conf-parameter-dict:pid-file} || {{ parameter_dict['bin-directory'] }}/slapos-kill --pidfile ${apache-conf-parameter-dict:pid-file} -s USR1
{% endif -%} {% endif -%}
{% endfor -%} {% endfor -%}
[logrotate-apache] [logrotate-apache]
recipe = slapos.cookbook:logrotate.d < = logrotate-entry-base
logrotate-entries = ${logrotate:logrotate-entries}
backup = ${logrotate:backup}
name = apache name = apache
log = ${apache-conf-parameter-dict:error-log} ${apache-conf-parameter-dict:access-log} log = ${apache-conf-parameter-dict:error-log} ${apache-conf-parameter-dict:access-log}
post = {{ parameter_dict['bin-directory'] }}/slapos-kill --pidfile ${apache-conf-parameter-dict:pid-file} -s USR1 post = test ! -s ${apache-conf-parameter-dict:pid-file} || {{ parameter_dict['bin-directory'] }}/slapos-kill --pidfile ${apache-conf-parameter-dict:pid-file} -s USR1
[directory] [directory]
recipe = slapos.cookbook:mkdirectory recipe = slapos.cookbook:mkdirectory
...@@ -237,7 +235,7 @@ crl = ${:ca-dir}/crl ...@@ -237,7 +235,7 @@ crl = ${:ca-dir}/crl
[monitor-instance-parameter] [monitor-instance-parameter]
monitor-httpd-ipv6 = {{ (ipv6_set | list)[0] }} monitor-httpd-ipv6 = {{ (ipv6_set | list)[0] }}
monitor-httpd-port = {{ next_port }} monitor-httpd-port = {{ next_port() }}
monitor-title = Balancer monitor monitor-title = Balancer monitor
[buildout] [buildout]
......
...@@ -117,6 +117,10 @@ name = neo-${gen-neo-cluster-base:passwd} ...@@ -117,6 +117,10 @@ name = neo-${gen-neo-cluster-base:passwd}
[gen-smtpd-sasl-password] [gen-smtpd-sasl-password]
< = gen-password < = gen-password
{% set zope_partition_dict = slapparameter_dict.get('zope-partition-dict', {'1': {}}) -%}
{% set zope_address_list_id_dict = {} -%}
{% if zope_partition_dict -%}
[request-zope-base] [request-zope-base]
<= request-common <= request-common
return = return =
...@@ -142,6 +146,7 @@ config-mysql-url-list = ${request-mariadb:connection-database-list} ...@@ -142,6 +146,7 @@ config-mysql-url-list = ${request-mariadb:connection-database-list}
config-site-id = {{ dumps(site_id) }} config-site-id = {{ dumps(site_id) }}
config-smtp-url = ${request-smtp:connection-url} config-smtp-url = ${request-smtp:connection-url}
config-timezone = {{ dumps(slapparameter_dict.get('timezone', 'UTC')) }} config-timezone = {{ dumps(slapparameter_dict.get('timezone', 'UTC')) }}
config-wendelin-core-zblk-fmt = {{ dumps(slapparameter_dict.get('wendelin-core-zblk-fmt', '')) }}
config-ca-path = ${directory:ca-dir} config-ca-path = ${directory:ca-dir}
config-zodb-dict = {{ dumps(zodb_dict) }} config-zodb-dict = {{ dumps(zodb_dict) }}
{% for server_type, server_dict in storage_dict.iteritems() -%} {% for server_type, server_dict in storage_dict.iteritems() -%}
...@@ -161,7 +166,8 @@ software-type = zope ...@@ -161,7 +166,8 @@ software-type = zope
{% set jupyter_zope_family_default = [] -%} {% set jupyter_zope_family_default = [] -%}
{% set zope_backend_path_dict = {} -%} {% set zope_backend_path_dict = {} -%}
{% set ssl_authentication_dict = {} -%} {% set ssl_authentication_dict = {} -%}
{% for custom_name, zope_parameter_dict in slapparameter_dict.get('zope-partition-dict', {'1': {}}).items() -%}
{% for custom_name, zope_parameter_dict in zope_partition_dict.items() -%}
{% set partition_name = 'zope-' ~ custom_name -%} {% set partition_name = 'zope-' ~ custom_name -%}
{% set section_name = 'request-' ~ partition_name -%} {% set section_name = 'request-' ~ partition_name -%}
{% set backend_path = zope_parameter_dict.get('backend-path', '/') % {'site-id': site_id} %} {% set backend_path = zope_parameter_dict.get('backend-path', '/') % {'site-id': site_id} %}
...@@ -314,6 +320,8 @@ config-{{ name }} = {{ value }} ...@@ -314,6 +320,8 @@ config-{{ name }} = {{ value }}
return = site_url return = site_url
{% endif -%} {% endif -%}
{% endif -%}{# if zope_partition_dict -#}
[publish] [publish]
recipe = slapos.cookbook:publish.serialised recipe = slapos.cookbook:publish.serialised
-extends = publish-early -extends = publish-early
...@@ -321,11 +329,13 @@ recipe = slapos.cookbook:publish.serialised ...@@ -321,11 +329,13 @@ recipe = slapos.cookbook:publish.serialised
neo-masters = ${neo-0-final:connection-masters} neo-masters = ${neo-0-final:connection-masters}
neo-admins = ${neo-0-final:connection-admins} neo-admins = ${neo-0-final:connection-admins}
{% endif -%} {% endif -%}
{% if zope_address_list_id_dict -%}
{# {#
Pick any published hosts-dict, they are expected to be identical - and there is Pick any published hosts-dict, they are expected to be identical - and there is
no way to check here. no way to check here.
-#} -#}
hosts-dict = {{ '${' ~ zope_address_list_id_dict.keys()[0] ~ ':connection-hosts-dict}' }} hosts-dict = {{ '${' ~ zope_address_list_id_dict.keys()[0] ~ ':connection-hosts-dict}' }}
{% endif -%}
{% for name, value in publish_dict.items() -%} {% for name, value in publish_dict.items() -%}
{{ name }} = {{ value }} {{ name }} = {{ value }}
{% endfor -%} {% endfor -%}
......
[buildout] [buildout]
extends = extends =
../../software/erp5/software.cfg ../../software/erp5/software.cfg
buildout.hash.cfg
parts += parts +=
vifib-fix-products-paths vifib-fix-products-paths
...@@ -52,22 +53,18 @@ mode = 644 ...@@ -52,22 +53,18 @@ mode = 644
[template-erp5] [template-erp5]
< = download-base-part < = download-base-part
filename = instance-erp5.cfg.in filename = instance-erp5.cfg.in
md5sum = 073b96888388a39721a8cef3e90c5c5b
[template-balancer] [template-balancer]
< = download-base-part < = download-base-part
filename = instance-balancer.cfg.in filename = instance-balancer.cfg.in
md5sum = 02c258e51ff4619efe258bbf24b9ceed
[template-apache-conf] [template-apache-backend-conf]
< = download-base-part url = ${:_profile_base_location_}/${:filename}
filename = apache.conf.in filename = apache-backend.conf.in
md5sum = 6a9426138d46ba5de75a86199be4f8d1
[template-create-erp5-site-real] [template-create-erp5-site-real]
< = download-base-part < = download-base-part
filename = instance-create-erp5-site-real.cfg.in filename = instance-create-erp5-site-real.cfg.in
md5sum = 86a2b244341218cd0c4b6d398c61ee20
[versions] [versions]
python-memcached = 1.47 python-memcached = 1.47
......
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