Commit 55cc21cd authored by Kazuhiko Shiozaki's avatar Kazuhiko Shiozaki

Merge remote-tracking branch 'origin/master' into erp5-cluster

parents fe5791fc b80c72ff
...@@ -32,10 +32,10 @@ md5sum = 6f3417691c7a27090f36e7cf4d94b36e ...@@ -32,10 +32,10 @@ md5sum = 6f3417691c7a27090f36e7cf4d94b36e
recipe = slapos.recipe.cmmi recipe = slapos.recipe.cmmi
depends = depends =
${gdbm:version} ${gdbm:version}
version = 2.4.9 version = 2.4.10
revision = 1 revision = 1
url = http://mir2.ovh.net/ftp.apache.org/dist/httpd/httpd-${:version}.tar.bz2 url = http://mir2.ovh.net/ftp.apache.org/dist/httpd/httpd-${:version}.tar.bz2
md5sum = 2ef4e65353497606b24fa9bb3e5a3c40 md5sum = 44543dff14a4ebc1e9e2d86780507156
configure-command = cp -ar ${apr:location}/apr-${apr:version} srclib/apr/; cp -ar ${apr-util:location}/apr-util-${apr-util:version} srclib/apr-util; ./configure configure-command = cp -ar ${apr:location}/apr-${apr:version} srclib/apr/; cp -ar ${apr-util:location}/apr-util-${apr-util:version} srclib/apr-util; ./configure
configure-options = --prefix=${buildout:parts-directory}/${:_buildout_section_name_} configure-options = --prefix=${buildout:parts-directory}/${:_buildout_section_name_}
--disable-static --disable-static
......
...@@ -2,7 +2,15 @@ ...@@ -2,7 +2,15 @@
parts = parts =
binutils binutils
extends =
../bison/buildout.cfg
../zlib/buildout.cfg
[binutils] [binutils]
recipe = slapos.recipe.cmmi recipe = slapos.recipe.cmmi
url = http://ftp.gnu.org/gnu/binutils/binutils-2.21.1.tar.bz2 url = http://ftp.gnu.org/gnu/binutils/binutils-2.21.1.tar.bz2
md5sum = bde820eac53fa3a8d8696667418557ad md5sum = bde820eac53fa3a8d8696667418557ad
environment =
PATH=${bison:location}/bin:%(PATH)s
CPPFLAGS=-I${zlib:location}/include
LDFLAGS=-L${zlib:location}/lib -Wl,-rpath=${zlib:location}/lib
[buildout] [buildout]
parts = tcl parts = tcl
[tcl-package] [tcl]
recipe = hexagonit.recipe.download recipe = slapos.recipe.cmmi
url = http://prdownloads.sourceforge.net/tcl/tcl8.5.13-src.tar.gz url = http://prdownloads.sourceforge.net/tcl/tcl8.5.13-src.tar.gz
md5sum = fa3a9bf9b2d6ed2431f1baa46f4058b8 md5sum = fa3a9bf9b2d6ed2431f1baa46f4058b8
strip-top-level-dir = true
[tcl]
recipe = plone.recipe.command
location = ${buildout:parts-directory}/${:_buildout_section_name_} location = ${buildout:parts-directory}/${:_buildout_section_name_}
command = cd ${tcl-package:location}/unix && configure-command = ./unix/configure
./configure --prefix=${:location} && configure-options =
make && --prefix=${:location}
make test && --with-encoding=utf-8
make install
\ No newline at end of file
...@@ -7,7 +7,7 @@ extends = ...@@ -7,7 +7,7 @@ extends =
../../component/make/buildout.cfg ../../component/make/buildout.cfg
../../component/openssl/buildout.cfg ../../component/openssl/buildout.cfg
../../component/tcl/buildout.cfg ../../component/tcl/buildout.cfg
../../component/libexpat/buildout.cfg ../../component/libxml2/buildout.cfg
../../component/pcre/buildout.cfg ../../component/pcre/buildout.cfg
../../component/libcap/buildout.cfg ../../component/libcap/buildout.cfg
../../component/flex/buildout.cfg ../../component/flex/buildout.cfg
...@@ -25,16 +25,19 @@ md5sum = 18f7d56650cba260c8cce3bf4abfa56c ...@@ -25,16 +25,19 @@ md5sum = 18f7d56650cba260c8cce3bf4abfa56c
configure-options = configure-options =
--prefix=${buildout:parts-directory}/${:_buildout_section_name_} --prefix=${buildout:parts-directory}/${:_buildout_section_name_}
--with-openssl=${openssl:location} --with-openssl=${openssl:location}
--with-expat=${libexpat:location} --with-xml=libxml2
--with-libxml2=${libxml2:location}
--with-pcre=${pcre:location} --with-pcre=${pcre:location}
--with-lua=${lua:location} --with-lua=${lua:location}
--with-ncurses=${ncurses:location} --with-ncurses=${ncurses:location}
--with-tcl=${tcl:location}/lib/ --with-tcl=${tcl:location}/lib/
--with-lzma=${xz-utils:location}
--with-zlib=${zlib:location} --with-zlib=${zlib:location}
--disable-hwloc
--enable-experimental-plugins --enable-experimental-plugins
environment = environment =
PATH=${make:location}/bin:${libtool:location}/bin:${pkgconfig:location}/bin:%(PATH)s PATH=${make:location}/bin:${libtool:location}/bin:${pkgconfig:location}/bin:%(PATH)s
LDFLAGS = -L${tcl:location}/lib -Wl,-rpath=${tcl:location}/lib -Wl,-rpath=${openssl:location}/lib LDFLAGS =-L${libxml2:location}/lib -Wl,-rpath=${libxml2:location}/lib -L${tcl:location}/lib -Wl,-rpath=${tcl:location}/lib -Wl,-rpath=${openssl:location}/lib -L${zlib:location}/lib -Wl,-rpath=${zlib:location}/lib
make-target = make-target =
check check
install install
...@@ -67,20 +67,20 @@ mode = 0644 ...@@ -67,20 +67,20 @@ mode = 0644
[template-apache-frontend] [template-apache-frontend]
recipe = slapos.recipe.template recipe = slapos.recipe.template
url = ${:_profile_base_location_}/instance-apache-frontend.cfg url = ${:_profile_base_location_}/instance-apache-frontend.cfg
md5sum = 05216295ad8ab5ebf34644ac253f0db6 md5sum = 5388e77d520135b7491f1aeddac5f4e0
output = ${buildout:directory}/template-apache-frontend.cfg output = ${buildout:directory}/template-apache-frontend.cfg
mode = 0644 mode = 0644
[template-apache-replicate] [template-apache-replicate]
recipe = slapos.recipe.build:download recipe = slapos.recipe.build:download
url = ${:_profile_base_location_}/instance-apache-replicate.cfg.in url = ${:_profile_base_location_}/instance-apache-replicate.cfg.in
md5sum = 5de85259870dc4364954018041561882 md5sum = 8ec70e6276daaed240faa5059514929c
mode = 0644 mode = 0644
[template-slave-list] [template-slave-list]
recipe = slapos.recipe.build:download recipe = slapos.recipe.build:download
url = ${:_profile_base_location_}/templates/apache-custom-slave-list.cfg.in url = ${:_profile_base_location_}/templates/apache-custom-slave-list.cfg.in
md5sum = 5c49a66a0fe4b92ab21ef7148ea4e5ff md5sum = c896e60c95ca387a75a163d817155d98
mode = 640 mode = 640
[template-slave-configuration] [template-slave-configuration]
...@@ -135,7 +135,7 @@ mode = 640 ...@@ -135,7 +135,7 @@ mode = 640
[template-default-slave-virtualhost] [template-default-slave-virtualhost]
recipe = slapos.recipe.build:download recipe = slapos.recipe.build:download
url = ${:_profile_base_location_}/templates/default-virtualhost.conf.in url = ${:_profile_base_location_}/templates/default-virtualhost.conf.in
md5sum = ac845c0fa3835832307a0e7323cb339d md5sum = 2241f952bc1072af77e87a6d5bb8b4f9
mode = 640 mode = 640
[template-log-access] [template-log-access]
......
...@@ -168,7 +168,8 @@ extra-context = ...@@ -168,7 +168,8 @@ extra-context =
key local_ipv4 instance-parameter:ipv4-random key local_ipv4 instance-parameter:ipv4-random
key cache_port apache-configuration:cache-port key cache_port apache-configuration:cache-port
raw empty_template ${template-empty:target} raw empty_template ${template-empty:target}
raw template_slave_configuration ${template-slave-configuration:target} raw template_custom_slave_configuration ${template-slave-configuration:target}
raw template_default_slave_configuration ${template-default-slave-virtualhost:target}
raw template_rewrite_cached ${template-rewrite-cached:target} raw template_rewrite_cached ${template-rewrite-cached:target}
raw software_type single-custom-personal raw software_type single-custom-personal
section logrotate_dict logrotate section logrotate_dict logrotate
......
...@@ -61,6 +61,17 @@ sla-{{ parameter }} = {{ slapparameter_dict.pop( sla_key + parameter ) }} ...@@ -61,6 +61,17 @@ sla-{{ parameter }} = {{ slapparameter_dict.pop( sla_key + parameter ) }}
{% endif -%} {% endif -%}
{% endfor -%} {% endfor -%}
{% set authorized_slave_string = slapparameter_dict.pop('-frontend-authorized-slave-string', '') -%}
{% set authorized_slave_list = [] %}
{% set rejected_slave_list = [] %}
{% for slave in slave_instance_list %}
{% if not (slave.has_key('apache_custom_http') and not slave.get('slave_reference') in authorized_slave_string) %}
{% do authorized_slave_list.append(slave) %}
{% else %}
{% do rejected_slave_list.append(slave.get('slave_reference')) %}
{% endif %}
{% endfor -%}
[replicate] [replicate]
<= slap-connection <= slap-connection
recipe = slapos.cookbook:requestoptional recipe = slapos.cookbook:requestoptional
...@@ -76,13 +87,16 @@ config = {{ ' '.join(slapparameter_dict.keys()) + ' ' + slave_list_name }} ...@@ -76,13 +87,16 @@ config = {{ ' '.join(slapparameter_dict.keys()) + ' ' + slave_list_name }}
{% for parameter, value in slapparameter_dict.iteritems() -%} {% for parameter, value in slapparameter_dict.iteritems() -%}
config-{{parameter}} = {{ value }} config-{{parameter}} = {{ value }}
{% endfor -%} {% endfor -%}
config-{{ slave_list_name }} = {{ json_module.dumps(slave_instance_list) }} config-{{ slave_list_name }} = {{ json_module.dumps(authorized_slave_list) }}
connection-monitor_url = connection-monitor_url =
[publish-information] [publish-information]
recipe = slapos.cookbook:publish recipe = slapos.cookbook:publish
domain = {{ slapparameter_dict.get('domain') }} domain = {{ slapparameter_dict.get('domain') }}
slave-amount = {{ slave_instance_list | length }} slave-amount = {{ slave_instance_list | length }}
accepted-slave-amount = {{ authorized_slave_list | length }}
rejected-slave-amount = {{ rejected_slave_list | length }}
rejected-slave-list = {{ json_module.dumps(rejected_slave_list) }}
{% for frontend in frontend_section_list %} {% for frontend in frontend_section_list %}
{{ frontend }}-monitor-url = {{ '${' + frontend + ':connection-monitor_url}' }} {{ frontend }}-monitor-url = {{ '${' + frontend + ':connection-monitor_url}' }}
{% endfor -%} {% endfor -%}
......
{
"type": "object",
"$schema": "http://json-schema.org/draft-04/schema",
"title": "Input Parameters",
"properties": {
"url": {
"title": "Backend URL",
"description": "Url of the backend",
"type": "string"
},
"custom_domain": {
"title": "Custom Domain",
"description": "Custom Domain to use for the website",
"type": "string",
"pattern": "^([a-zA-Z0-9]([a-zA-Z0-9\-]{0,61}[a-zA-Z0-9])?\.)+[a-zA-Z]{2,6}$"
},
"type": {
"title": "Backend Type",
"description": "Type of the backend",
"type": "string",
"default": "",
"enum": ["", "zope"]
},
"path": {
"title": "Backend Path",
"description": "Path to proxy to in the backend",
"type": "string",
"default": ""
},
"ssl_crt": {
"title": "SSL Certificate",
"description": "SSL Certificate",
"type": "string",
"default": ""
},
"ssl_key": {
"title": "SSL Key",
"description": "SSL Key",
"type": "string",
"default": ""
},
"ssl_ca_crt": {
"title": "SSL Certificate Authority's Certificate",
"description": "SSL Key",
"type": "string",
"default": ""
},
"https-only": {
"title": "HTTPS Only",
"description": "If set to true, http request are redirect to https",
"type": "string",
"default": "false",
"enum": ["false", "true"]
},
"enable_cache": {
"title": "Enable Cache",
"description": "If set to true, the cache is used",
"type": "string",
"default": "false",
"enum": ["false", "true"]
},
"apache_custom_http": {
"title": "HTTP configuration",
"description": "Raw http configuration in python template format. Your site will be rejected if you use it without notification and approval of the frontend adminastrator",
"default": "",
"type": "string"
},
"apache_custom_https": {
"title": "HTTPS configuration",
"description": "Raw https configuration in python template format. Your site will be rejected if you use it without notification and approval of the frontend adminastrator",
"default": "",
"type": "string"
}
}
}
...@@ -5,53 +5,52 @@ extends = common.cfg ...@@ -5,53 +5,52 @@ extends = common.cfg
Jinja2 = 2.7.3 Jinja2 = 2.7.3
MarkupSafe = 0.23 MarkupSafe = 0.23
PyRSS2Gen = 1.1 PyRSS2Gen = 1.1
Werkzeug = 0.9.4 Werkzeug = 0.9.6
apache-libcloud = 0.15.0 apache-libcloud = 0.15.1
async = 0.6.1 async = 0.6.1
buildout-versions = 1.7 buildout-versions = 1.7
cffi = 0.8.2 cffi = 0.8.6
cmd2 = 0.6.7 cmd2 = 0.6.7
cns.recipe.symlink = 0.2.3 cns.recipe.symlink = 0.2.3
collective.recipe.template = 1.11 collective.recipe.template = 1.11
cryptography = 0.4 cryptography = 0.5.2
gitdb = 0.5.4 gitdb = 0.5.4
hexagonit.recipe.cmmi = 2.0
inotifyx = 0.2.0-1 inotifyx = 0.2.0-1
itsdangerous = 0.24 itsdangerous = 0.24
lxml = 3.3.5 lxml = 3.3.5
meld3 = 1.0.0 meld3 = 1.0.0
mr.developer = 1.30 mr.developer = 1.30
netaddr = 0.7.11 netaddr = 0.7.12
plone.recipe.command = 1.1 plone.recipe.command = 1.1
pyOpenSSL = 0.14 pyOpenSSL = 0.14
pycrypto = 2.6.1 pycrypto = 2.6.1
pyparsing = 2.0.2 pyparsing = 2.0.2
pytz = 2014.3 pytz = 2014.4
rdiff-backup = 1.0.5 rdiff-backup = 1.0.5
six = 1.7.3 six = 1.7.3
slapos.cookbook = 0.87 slapos.cookbook = 0.87
slapos.recipe.build = 0.12 slapos.recipe.build = 0.12
slapos.recipe.cmmi = 0.2 slapos.recipe.cmmi = 0.2
slapos.recipe.template = 2.5 slapos.recipe.template = 2.5
slapos.toolbox = 0.39.2 slapos.toolbox = 0.39.3
smmap = 0.8.2 smmap = 0.8.2
stevedore = 0.15 stevedore = 0.15
# Required by: # Required by:
# slapos.core==1.0.5 # slapos.core==1.1.2
# slapos.toolbox==0.39.2 # slapos.toolbox==0.39.3
Flask = 0.10.1 Flask = 0.10.1
# Required by: # Required by:
# slapos.toolbox==0.39.2 # slapos.toolbox==0.39.3
GitPython = 0.3.2.RC1 GitPython = 0.3.2.RC1
# Required by: # Required by:
# slapos.toolbox==0.39.2 # slapos.toolbox==0.39.3
atomize = 0.2.0 atomize = 0.2.0
# Required by: # Required by:
# slapos.core==1.0.5 # slapos.core==1.1.2
cliff = 1.6.1 cliff = 1.6.1
# Required by: # Required by:
...@@ -59,7 +58,7 @@ cliff = 1.6.1 ...@@ -59,7 +58,7 @@ cliff = 1.6.1
ecdsa = 0.11 ecdsa = 0.11
# Required by: # Required by:
# slapos.toolbox==0.39.2 # slapos.toolbox==0.39.3
feedparser = 5.1.3 feedparser = 5.1.3
# Required by: # Required by:
...@@ -67,39 +66,40 @@ feedparser = 5.1.3 ...@@ -67,39 +66,40 @@ feedparser = 5.1.3
lock-file = 2.0 lock-file = 2.0
# Required by: # Required by:
# slapos.core==1.0.5 # slapos.core==1.1.2
netifaces = 0.10.4 netifaces = 0.10.4
# Required by: # Required by:
# slapos.toolbox==0.39.2 # slapos.toolbox==0.39.3
paramiko = 1.14.0 paramiko = 1.14.0
# Required by: # Required by:
# slapos.toolbox==0.39.2 # slapos.core==1.1.2
# slapos.toolbox==0.39.3
psutil = 2.1.1 psutil = 2.1.1
# Required by: # Required by:
# cffi==0.8.2 # cffi==0.8.6
pycparser = 2.10 pycparser = 2.10
# Required by: # Required by:
# slapos.core==1.0.5 # slapos.core==1.1.2
requests = 2.3.0 requests = 2.3.0
# Required by: # Required by:
# slapos.toolbox==0.39.2 # slapos.toolbox==0.39.3
slapos.core = 1.0.5 slapos.core = 1.1.2
# Required by: # Required by:
# slapos.core==1.0.5 # slapos.core==1.1.2
supervisor = 3.0 supervisor = 3.0
# Required by: # Required by:
# slapos.toolbox==0.39.2 # slapos.toolbox==0.39.3
xml-marshaller = 0.9.7 xml-marshaller = 0.9.7
# Required by: # Required by:
# slapos.core==1.0.5 # slapos.core==1.1.2
zope.interface = 4.1.1 zope.interface = 4.1.1
[networkcache] [networkcache]
......
...@@ -3,6 +3,7 @@ ...@@ -3,6 +3,7 @@
{% set cached_server_dict = {} -%} {% set cached_server_dict = {} -%}
{% set part_list = [] -%} {% set part_list = [] -%}
{% set cache_access = "http://%s:%s" % (local_ipv4, cache_port) -%} {% set cache_access = "http://%s:%s" % (local_ipv4, cache_port) -%}
{% set TRUE_VALUES = ['y', 'yes', '1', 'true'] -%}
{% set generic_instance_parameter_dict = {'cache_access': cache_access,} -%} {% set generic_instance_parameter_dict = {'cache_access': cache_access,} -%}
{% set slave_log_dict = {} -%} {% set slave_log_dict = {} -%}
{% if extra_slave_instance_list -%} {% if extra_slave_instance_list -%}
...@@ -29,8 +30,11 @@ context = ...@@ -29,8 +30,11 @@ context =
{% set slave_reference = slave_instance.get('slave_reference') -%} {% set slave_reference = slave_instance.get('slave_reference') -%}
{% set slave_section_title = 'dynamic-template-slave-instance-%s' % slave_reference -%} {% set slave_section_title = 'dynamic-template-slave-instance-%s' % slave_reference -%}
{% set slave_parameter_dict = generic_instance_parameter_dict.copy() -%} {% set slave_parameter_dict = generic_instance_parameter_dict.copy() -%}
{% set slave_publish_dict = {} -%}
{% do part_list.append(slave_section_title) -%} {% do part_list.append(slave_section_title) -%}
############################
#### Set Slave Log Directory and access
{% set slave_directory_section = slave_reference + "-directory" -%} {% set slave_directory_section = slave_reference + "-directory" -%}
{% set slave_log_folder = logrotate_dict.get('backup') + '/' + slave_reference + "-logs" -%} {% set slave_log_folder = logrotate_dict.get('backup') + '/' + slave_reference + "-logs" -%}
...@@ -41,6 +45,8 @@ log-folder = {{slave_log_folder}} ...@@ -41,6 +45,8 @@ log-folder = {{slave_log_folder}}
# Set Up log files # Set Up log files
{% do slave_parameter_dict.__setitem__('access_log', '/'.join([apache_log_directory, '%s_access_log' % slave_reference])) -%} {% do slave_parameter_dict.__setitem__('access_log', '/'.join([apache_log_directory, '%s_access_log' % slave_reference])) -%}
{% do slave_parameter_dict.__setitem__('error_log', '/'.join([apache_log_directory, '%s_error_log' % slave_reference])) -%} {% do slave_parameter_dict.__setitem__('error_log', '/'.join([apache_log_directory, '%s_error_log' % slave_reference])) -%}
{% do slave_instance.__setitem__('access_log', slave_parameter_dict.get('access_log')) -%}
{% do slave_instance.__setitem__('error_log', slave_parameter_dict.get('error_log')) -%}
# Set slave logrotate entry # Set slave logrotate entry
{% set slave_logrotate_section = slave_reference + "-logs" -%} {% set slave_logrotate_section = slave_reference + "-logs" -%}
...@@ -85,17 +91,11 @@ command = {{frontend_configuration.get('apache-directory')}}/bin/htpasswd -cb ${ ...@@ -85,17 +91,11 @@ command = {{frontend_configuration.get('apache-directory')}}/bin/htpasswd -cb ${
# Add slave log directory to the slave log access dict # Add slave log directory to the slave log access dict
{% do slave_log_dict.__setitem__(slave_reference, slave_log_folder) %} {% do slave_log_dict.__setitem__(slave_reference, slave_log_folder) %}
# Set up apache configuration file for slave {% set slave_log_access_url = 'https://' + slave_reference + ':${'+ slave_password_section +':passwd}@[' + frontend_configuration.get('apache-ipv6') + ']:' + frontend_configuration.get('apache-https-port') + '/' + slave_reference.lower() + '/' %}
[{{ slave_section_title }}] {% do slave_publish_dict.__setitem__('log-access', slave_log_access_url) %}
< = jinja2-template-base
template = {{ template_slave_configuration }} ############################
filename = {{ '%s.conf' % slave_reference }} #### Set Slave Certificates if needed
extra-context =
key apache_custom_https {{ 'slave-instance-%s-configuration:apache_custom_https' % slave_reference }}
key apache_custom_http {{ 'slave-instance-%s-configuration:apache_custom_http' % slave_reference }}
raw https_port {{ https_port }}
raw http_port {{ http_port }}
{{ '\n' }}
# Set ssl certificates for each slave # Set ssl certificates for each slave
{% for cert_name in ('ssl_key', 'ssl_crt', 'ssl_ca_crt', 'ssl_csr')-%} {% for cert_name in ('ssl_key', 'ssl_crt', 'ssl_ca_crt', 'ssl_csr')-%}
...@@ -104,6 +104,7 @@ extra-context = ...@@ -104,6 +104,7 @@ extra-context =
{% set cert_file = '/'.join([custom_ssl_directory, cert_title.replace('-','.')]) -%} {% set cert_file = '/'.join([custom_ssl_directory, cert_title.replace('-','.')]) -%}
{% do part_list.append(cert_title) -%} {% do part_list.append(cert_title) -%}
{% do slave_parameter_dict.__setitem__(cert_name, cert_file) -%} {% do slave_parameter_dict.__setitem__(cert_name, cert_file) -%}
{% do slave_instance.__setitem__('path_to_' + cert_name, cert_file) -%}
# Store certificates on fs # Store certificates on fs
[{{ cert_title }}] [{{ cert_title }}]
< = jinja2-template-base < = jinja2-template-base
...@@ -117,31 +118,95 @@ value = {{ dumps(slave_instance.get(cert_name)) }} ...@@ -117,31 +118,95 @@ value = {{ dumps(slave_instance.get(cert_name)) }}
{% endif -%} {% endif -%}
{% endfor -%} {% endfor -%}
############################
#### Set Slave Configuration
{% if slave_instance.has_key('apache_custom_http') %}
#### Set Configuration for custom slaves
# Set up apache configuration file for slave
[{{ slave_section_title }}]
< = jinja2-template-base
template = {{ template_custom_slave_configuration }}
filename = {{ '%s.conf' % slave_reference }}
extra-context =
key apache_custom_https {{ 'slave-instance-%s-configuration:apache_custom_https' % slave_reference }}
key apache_custom_http {{ 'slave-instance-%s-configuration:apache_custom_http' % slave_reference }}
raw https_port {{ https_port }}
raw http_port {{ http_port }}
{{ '\n' }}
# Set apache configuration value for slave # Set apache configuration value for slave
[{{ ('slave-instance-%s-configuration' % slave_reference) }}] [{{ ('slave-instance-%s-configuration' % slave_reference) }}]
{% set apache_custom_http = ((slave_instance.get('apache_custom_http', '')) % slave_parameter_dict) -%} {% set apache_custom_http = ((slave_instance.get('apache_custom_http', '')) % slave_parameter_dict) -%}
{% set apache_custom_https = ((slave_instance.get('apache_custom_https', '')) % slave_parameter_dict) -%} {% set apache_custom_https = ((slave_instance.get('apache_custom_https', '')) % slave_parameter_dict) -%}
apache_custom_http = {{ dumps(apache_custom_http) }} apache_custom_http = {{ dumps(apache_custom_http) }}
apache_custom_https = {{ dumps(apache_custom_https) }} apache_custom_https = {{ dumps(apache_custom_https) }}
{{ '\n' }} {{ '\n' }}
# The slave use cache # The slave use cache
{% if 'enable_cache' in slave_instance and 'url' in slave_instance and 'domain' in slave_instance -%} {% if 'enable_cache' in slave_instance and 'url' in slave_instance and 'domain' in slave_instance -%}
{% do cached_server_dict.__setitem__(slave_instance.get('domain'), slave_instance.get('url')) -%} {% do cached_server_dict.__setitem__(slave_instance.get('domain'), slave_instance.get('url')) -%}
{% endif -%}
# Publish information
{% do slave_publish_dict.update(**{'slave-reference':slave_instance.get('slave_reference'), 'public-ipv4':public_ipv4, 'log-access': slave_log_access_url}) %}
{% else %}
#### Set Configuration for default slaves
# Set slave domain if none was defined
{% if slave_instance.get('custom_domain', None) == None -%}
{% do slave_instance.__setitem__('custom_domain', "%s.%s" % (slave_instance.get('slave_reference').replace("-", "").lower(), slapparameter_dict.get('domain'))) -%}
{% endif -%}
# The slave use cache
# Next line is forbidden and people who copy it will be hanged short
{% set enable_cache = ('' ~ slave_instance.get('enable_cache', '')).lower() in TRUE_VALUES -%}
{% if enable_cache -%}
{% do cached_server_dict.__setitem__(slave_instance.get('custom_domain'), slave_instance.get('url')) -%}
{% do slave_instance.__setitem__('url', cache_access) -%}
{% endif -%}
{% do part_list.append(slave_section_title) -%}
[{{ ('slave-instance-%s-configuration' % slave_reference) }}]
{% for key, value in slave_instance.iteritems() -%}
{{ key }} = {{ dumps(value) }}
{% endfor %}
# Set up slave configuration file
[{{ slave_section_title }}]
< = jinja2-template-base
template = {{ template_default_slave_configuration }}
filename = {{ '%s.conf' % slave_reference }}
extensions = jinja2.ext.do
extra-context =
section slave_parameter {{ 'slave-instance-%s-configuration' % slave_reference }}
raw https_port {{ https_port }}
raw http_port {{ http_port }}
{{ '\n' }}
{% do slave_publish_dict.update(**{'slave-reference':slave_instance.get('slave_reference'), 'public-ipv4':public_ipv4, 'domain':slave_instance.get('custom_domain'), 'url':"http://%s" % slave_instance.get('custom_domain'), 'site_url':"http://%s" % slave_instance.get('custom_domain')}) %}
{% endif -%} {% endif -%}
############################
#### Publish Slave Information
# Publish slave information # Publish slave information
{% set slave_log_access_url = 'https://' + slave_reference + ':${'+ slave_password_section +':passwd}@[' + frontend_configuration.get('apache-ipv6') + ']:' + frontend_configuration.get('apache-https-port') + '/' + slave_reference.lower() + '/' %}
{% if not extra_slave_instance_list -%} {% if not extra_slave_instance_list -%}
{% set publish_section_title = 'publish-%s-connection-information' % slave_instance.get('slave_reference') -%} {% set publish_section_title = 'publish-%s-connection-information' % slave_instance.get('slave_reference') -%}
{% do part_list.append(publish_section_title) -%} {% do part_list.append(publish_section_title) -%}
[{{ publish_section_title }}] [{{ publish_section_title }}]
recipe = slapos.cookbook:publish recipe = slapos.cookbook:publish
public-ipv4 = {{ public_ipv4 }} {% for key, value in slave_publish_dict.iteritems() %}
log-access = {{ slave_log_access_url }} {{ key }} = {{ value }}
-slave-reference = {{ slave_instance.get('slave_reference') }} {% endfor %}
{% else -%} {% else -%}
{% do slave_instance_information_list.append({'slave-reference':slave_instance.get('slave_reference'), 'public-ipv4':public_ipv4, 'log-access': slave_log_access_url}) -%} {% do slave_instance_information_list.append(slave_publish_dict) -%}
{% endif -%} {% endif -%}
{% endfor -%} {% endfor -%}
......
{% set TRUE_VALUES = ['y', 'yes', '1', 'true'] -%} {% set TRUE_VALUES = ['y', 'yes', '1', 'true'] -%}
<VirtualHost *:{{ https_port }}> <VirtualHost *:{{ https_port }}>
ServerName {{ slave_parameter.get('domain') }} ServerName {{ slave_parameter.get('custom_domain') }}
ServerAlias {{ slave_parameter.get('domain') }} ServerAlias {{ slave_parameter.get('custom_domain') }}
SSLEngine on SSLEngine on
SSLProxyEngine on SSLProxyEngine on
...@@ -23,10 +23,10 @@ ...@@ -23,10 +23,10 @@
# One Slave two logs # One Slave two logs
ErrorLog "{{ error_log }}" ErrorLog "{{ slave_parameter.get('error_log') }}"
LogLevel info LogLevel info
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
CustomLog "{{ access_log }}" combined CustomLog "{{ slave_parameter.get('access_log') }}" combined
# Rewrite part # Rewrite part
ProxyVia On ProxyVia On
...@@ -38,15 +38,15 @@ ...@@ -38,15 +38,15 @@
# First, we check if we have a zope backend server # First, we check if we have a zope backend server
# If so, let's use Virtual Host Daemon rewrite # If so, let's use Virtual Host Daemon rewrite
# We suppose that Apache listens to 443 (even indirectly thanks to things like iptables) # We suppose that Apache listens to 443 (even indirectly thanks to things like iptables)
RewriteRule ^/(.*)$ {{ slave_parameter.get('url', '') }}/VirtualHostBase/https/{{ slave_parameter.get('domain', '') }}:443/{{ slave_parameter.get('path', '') }}/VirtualHostRoot/$1 [L,P] RewriteRule ^/(.*)$ {{ slave_parameter.get('url', '') }}/VirtualHostBase/https/{{ slave_parameter.get('custom_domain', '') }}:443/{{ slave_parameter.get('path', '') }}/VirtualHostRoot/$1 [L,P]
{% else -%} {% else -%}
RewriteRule ^/(.*)$ {{ slave_parameter.get('url', '') }}/$1 [L,P] RewriteRule ^/(.*)$ {{ slave_parameter.get('url', '') }}/$1 [L,P]
{% endif -%} {% endif -%}
</VirtualHost> </VirtualHost>
<VirtualHost *:{{ http_port }}> <VirtualHost *:{{ http_port }}>
ServerName {{ slave_parameter.get('domain') }} ServerName {{ slave_parameter.get('custom_domain') }}
ServerAlias {{ slave_parameter.get('domain') }} ServerAlias {{ slave_parameter.get('custom_domain') }}
SSLProxyEngine on SSLProxyEngine on
# Rewrite part # Rewrite part
ProxyVia On ProxyVia On
...@@ -55,10 +55,10 @@ ...@@ -55,10 +55,10 @@
RewriteEngine On RewriteEngine On
# One Slave two logs # One Slave two logs
ErrorLog "{{ error_log }}" ErrorLog "{{ slave_parameter.get('error_log') }}"
LogLevel info LogLevel info
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
CustomLog "{{ access_log }}" combined CustomLog "{{ slave_parameter.get('access_log') }}" combined
# Remove "Secure" from cookies, as backend may be https # Remove "Secure" from cookies, as backend may be https
Header edit Set-Cookie "(?i)^(.+);secure$" "$1" Header edit Set-Cookie "(?i)^(.+);secure$" "$1"
...@@ -75,7 +75,7 @@ ...@@ -75,7 +75,7 @@
# First, we check if we have a zope backend server # First, we check if we have a zope backend server
# If so, let's use Virtual Host Daemon rewrite # If so, let's use Virtual Host Daemon rewrite
# We suppose that Apache listens to 80 (even indirectly thanks to things like iptables) # We suppose that Apache listens to 80 (even indirectly thanks to things like iptables)
RewriteRule ^/(.*)$ {{ slave_parameter.get('url', '') }}/VirtualHostBase/http/{{ slave_parameter.get('domain', '') }}:80/{{ slave_parameter.get('path', '') }}/VirtualHostRoot/$1 [L,P] RewriteRule ^/(.*)$ {{ slave_parameter.get('url', '') }}/VirtualHostBase/http/{{ slave_parameter.get('custom_domain', '') }}:80/{{ slave_parameter.get('path', '') }}/VirtualHostRoot/$1 [L,P]
{% else -%} {% else -%}
RewriteRule ^/(.*)$ {{ slave_parameter.get('url', '') }}/$1 [L,P] RewriteRule ^/(.*)$ {{ slave_parameter.get('url', '') }}/$1 [L,P]
{% endif -%} {% endif -%}
......
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