Commit 3c5507a7 authored by Romain Courteaud's avatar Romain Courteaud

WIP.

Balancer has to be done, as well as frontend.
parent 7d83b5c0
[buildout]
# Local development
develop =
${:parts-directory}/slapos.cookbook-repository
# ${:parts-directory}/slapos.cookbook-repository
/opt/slapdev
${:parts-directory}/cloudooo-repository
extensions =
......@@ -67,6 +68,9 @@ extends =
../../component/wget/buildout.cfg
../../component/aspell/buildout.cfg
../../component/cloudooo/buildout.cfg
../../component/6tunnel/buildout.cfg
versions = versions
parts =
rdiff-backup
......@@ -142,6 +146,11 @@ parts =
# Create instance template
template
# XXX: Workaround of SlapOS limitation
# Unzippig of eggs is required, as SlapOS do not yet provide nicely working
# development / fast switching environment for whole software
unzip = true
# Local development
[slapos.cookbook-repository]
recipe = plone.recipe.command
......@@ -156,7 +165,7 @@ update-command = cd "${:location}" && "${git:location}/bin/git" fetch --quiet &&
recipe = plone.recipe.command
stop-on-error = true
update-command = ${:command}
command = grep parts ${buildout:develop-eggs-directory}/slapos.cookbook.egg-link
command = grep slapdev ${buildout:develop-eggs-directory}/slapos.cookbook.egg-link
[slapos.cookbook-python2.6]
recipe = zc.recipe.egg
......@@ -187,7 +196,7 @@ context =
[template-mariadb]
< = template-jinja2-base
filename = instance-mariadb.cfg
md5sum = ff64d128a076f9a55faa660b2e86e3b4
md5sum = 788d8232e0ec1c2913972df67de50711
extra-context =
key coreutils_location coreutils:location
key dcron_location dcron:location
......@@ -207,6 +216,8 @@ filename = instance-sphinx.cfg
md5sum = c9d510c55a8f3562fe6346907002d4df
extra-context =
key sphinx_location sphinx:location
key haproxy_location haproxy:location
key dash_location dash:location
[template-zope]
recipe = slapos.recipe.build:download
......@@ -225,22 +236,16 @@ extra-context =
key kumo_location kumo:location
key logrotate_location logrotate:location
[template-tidstorage]
recipe = slapos.recipe.build:download
url = ${:_profile_base_location_}/instance-tidstorage.cfg.in
md5sum = 520e39f2612a045b42c0ad914bfdc5a9
mode = 640
[template-cloudooo]
recipe = slapos.recipe.build:download
url = ${:_profile_base_location_}/instance-cloudoo.cfg.in
md5sum = 5b56a84b779f72c279adb4ed3b12e512
md5sum = c6af2d026daff3dd9055ecd8785a346d
mode = 640
[template-zope-conf]
recipe = slapos.recipe.build:download
url = ${:_profile_base_location_}/zope.conf.in
md5sum = ec4203f1f54b05505d8f35cb5799a75c
md5sum = 4fbcaf745a1959cd18da3c7004960fc3
mode = 640
[template]
......@@ -248,7 +253,7 @@ mode = 640
# XXX: "template.cfg" is hardcoded in instanciation recipe
filename = template.cfg
template = ${:_profile_base_location_}/instance.cfg.in
md5sum = e55c79ce2e52a9895980b3800e8a12fe
md5sum = 292b0b4a44183ab1028cde2427ba7e85
extra-context =
key apache_location apache:location
key aspell_location aspell:location
......@@ -268,6 +273,7 @@ extra-context =
key grep_location grep:location
key gzip_location gzip:location
key haproxy_location haproxy:location
key tunnel6_location 6tunnel:location
key imagemagick_location imagemagick:location
key libICE_location libICE:location
key libSM_location libSM:location
......@@ -284,18 +290,22 @@ extra-context =
key logrotate_location logrotate:location
key mariadb_location mariadb:location
key openssl_location openssl:location
key stunnel_location stunnel:location
key pdftk_location pdftk:location
key poppler_location poppler:location
key sed_location sed:location
key template_balancer template-balancer:target
key template_cloudooo template-cloudooo:target
key template_erp5_development template-erp5-development:target
key template_erp5_production template-erp5-production:rendered
key template_erp5_production template-erp5-production:target
key template_kumofs template-kumofs:rendered
key template_logrotate_base template-logrotate-base:rendered
key template_mariadb template-mariadb:rendered
key template_memcached template-memcached:rendered
key template_production_zope template-production-zope:target
key template_sphinx template-sphinx:rendered
key template_tidstorage template-tidstorage:target
key template_varnish template-varnish:target
key template_zeo template-zeo:target
key template_zope template-zope:target
key template_zope_conf template-zope-conf:target
key tesseract_location tesseract:location
......@@ -307,10 +317,10 @@ extra-context =
[template-memcached]
< = template-jinja2-base
filename = instance-memcached.cfg
md5sum = 594d3195b258906d4a3fde09c01c917c
md5sum = 872da22de0d07e1ca05282d10dbf488b
extra-context =
key dash_location dash:location
key haproxy_location haproxy:location
key tunnel6_location 6tunnel:location
key memcached_location memcached:location
[template-erp5-development]
......@@ -320,11 +330,39 @@ md5sum = 2a4312202a3160f874c4fa3ee9155a1d
mode = 640
[template-erp5-production]
recipe = slapos.recipe.build:download
url = ${:_profile_base_location_}/instance-erp5-production.cfg.in
md5sum = c2f4bc478dd072e0bba85e8898dc7c8f
mode = 640
[template-zeo]
recipe = slapos.recipe.build:download
url = ${:_profile_base_location_}/instance-zeo.cfg.in
md5sum = 57ddeb22de33bc181b0334e2fed72eaa
mode = 640
extra-context =
key dash_location dash:location
[template-production-zope]
recipe = slapos.recipe.build:download
url = ${:_profile_base_location_}/instance-production-zope.cfg.in
md5sum = eab812d8d331fc710c3625d8860a99a7
mode = 640
[template-balancer]
recipe = slapos.recipe.build:download
url = ${:_profile_base_location_}/instance-balancer.cfg.in
md5sum = 6c8fd033568be93057cce5e15ab8f3d9
mode = 640
[template-logrotate-base]
< = template-jinja2-base
filename = instance-erp5-production.cfg
md5sum = 3051f3fea39d7409c417dcac26027b56
filename = instance-logrotate-base.cfg
md5sum = af19ff0c7817df85987c69738fb083f2
extra-context =
key local_bt5_repository local-bt5-repository:list
key dcron_location dcron:location
key gzip_location gzip:location
key logrotate_location logrotate:location
[template-varnish]
recipe = slapos.recipe.build:download
......@@ -609,7 +647,7 @@ Products.GenericSetup = 1.7.1
Products.MimetypesRegistry = 2.0.3
Products.PluggableAuthService = 1.7.7
Products.PluginRegistry = 1.3b1
Products.TIDStorage = 5.4.7.dev-r45842
Products.TIDStorage = 5.4.8
Products.Zelenium = 1.0.3
StructuredText = 2.11.1
WSGIUtils = 0.7
......
{% if software_type == slap_software_type -%}
{% set part_list = [] -%}
{% macro section(name) %}{% do part_list.append(name) %}{{ name }}{% endmacro -%}
{#
XXX: This template only supports exactly one IPv4 and one IPv6 per
partition. No more (undefined result), no less (IndexError).
......@@ -8,18 +10,35 @@ partition. No more (undefined result), no less (IndexError).
# directly to haproxy. (maybe just passing literal configuration file chunk)
{% set ipv4 = (ipv4_set | list)[0] -%}
{% set ipv6 = (ipv6_set | list)[0] -%}
[buildout]
extends = {{ parameter_dict['instance-logrotate-cfg'] }}
parts +=
publish
logrotate-apache
eggs-directory = {{ eggs_directory }}
develop-eggs-directory = {{ develop_eggs_directory }}
offline = true
[publish]
recipe = slapos.cookbook:publish
url = ${apache:scheme}://[${apache:ip}]:${apache:port}
[zope-tunnel-base]
recipe = slapos.cookbook:ipv4toipv6
runner-path = ${directory:services}/${:base-name}
tunnel6-path = {{ parameter_dict['tunnel6'] }}/bin/6tunnel
shell-path = {{ parameter_dict['dash'] }}/bin/dash
ipv4 = {{ ipv4 }}
{% set zope_address_list = [] -%}
{% set current_port = 9000 -%}
{% set next_current_port = {'next_port': current_port} -%}
{% for zope_name in json_module.loads(slapparameter_dict['zope-name-list']) -%}
{% for zope_address in json_module.loads(slapparameter_dict['zope-' ~ zope_name ~ '-address-list']) -%}
[{{ section('zope-tunnel-' ~ current_port) }}]
< = zope-tunnel-base
base-name = {{ 'zeo-tunnel-' ~ current_port }}
ipv4-port = {{ current_port }}
ipv6-port = {{ zope_address.split(']:')[1] }}
ipv6 = {{ zope_address.split(']:')[0][1:] }}
{% do zope_address_list.append(ipv4 ~ ":" ~ current_port) -%}
{% set current_port = current_port + 1 -%}
{% do next_current_port.__setitem__('next_port', current_port) -%}
{% endfor -%}
{% set current_port = next_current_port['next_port'] -%}
{% endfor -%}
{% set current_port = next_current_port['next_port'] -%}
[haproxy]
recipe = slapos.cookbook:haproxy
......@@ -32,7 +51,7 @@ maxconn = {{ slapparameter_dict['haproxy-maxconn'] }}
server-check-path = {{ slapparameter_dict['haproxy-server-check-path'] }}
wrapper-path = ${directory:services}/haproxy
binary-path = {{ parameter_dict['haproxy'] }}/sbin/haproxy
backend-list = {{ slapparameter_dict['zope-address-list'] }}
backend-list = {{ json_module.dumps(zope_address_list) }}
[apache]
recipe = slapos.cookbook:apache.zope.backend
......@@ -67,13 +86,21 @@ ca-private = ${directory:private}
ca-certs = ${directory:certs}
ca-newcerts = ${directory:newcerts}
ca-crl = ${directory:crl}
{% set ca = slapparameter_dict['ca'] -%}
{% set ca = json_module.loads(slapparameter_dict['ca']) -%}
country-code = {{ ca['country-code'] }}
email = {{ ca['email'] }}
state = {{ ca['state'] }}
city = {{ ca['city'] }}
company = {{ ca['company'] }}
[ca-apache]
< = certificate-authority
recipe = slapos.cookbook:certificate_authority.request
key-file = ${apache:key-file}
cert-file = ${apache:cert-file}
executable = ${apache:wrapper}
wrapper = ${directory:services}/apache
[logrotate-apache]
recipe = slapos.cookbook:logrotate.d
logrotate-entries = ${logrotate:logrotate-entries}
......@@ -97,4 +124,23 @@ private = ${:ca-dir}/private
certs = ${:ca-dir}/certs
newcerts = ${:ca-dir}/newcerts
crl = ${:ca-dir}/crl
[publish]
recipe = slapos.cookbook:publish
url = ${apache:scheme}://[${apache:ip}]:${apache:port}
[buildout]
extends = {{ parameter_dict['instance-logrotate-cfg'] }}
parts =
haproxy
{{ part_list | join('\n ') }}
publish
ca-apache
# cron-entry-logrotate
# logrotate
# logrotate-apache
eggs-directory = {{ eggs_directory }}
develop-eggs-directory = {{ develop_eggs_directory }}
offline = true
{% endif %}
This diff is collapsed.
......@@ -42,7 +42,7 @@ zlib = {{ zlib_location }}
libreoffice-bin = {{ libreoffice_bin_location }}
fonts = {{ fonts_location }}
buildout-bin-directory = {{ buildout_bin_directory }}
haproxy = {{ haproxy_location }}
tunnel6 = {{ tunnel6_location }}
dash = {{ dash_location }}
[dynamic-template-cloudooo]
......@@ -167,10 +167,14 @@ apache = {{ apache_location }}
openssl = {{ openssl_location }}
haproxy = {{ haproxy_location }}
instance-logrotate-cfg = {{ template_logrotate_base }}
bin-directory = {{ bin_directory }}
tunnel6 = {{ tunnel6_location }}
dash = {{ dash_location }}
[dynamic-template-balancer]
< = jinja2-template-base
template = {{ template_balancer }}
extensions = jinja2.ext.do
filename = instance-balancer.cfg
extra-context =
key ipv4_set slap-parameters:ipv4
......@@ -179,10 +183,15 @@ extra-context =
# Must match the key id in [switch-softwaretype] which uses this section.
# XXX: a better name should be searched
raw software_type balancer
import json_module json
key bin_directory dynamic-template-zope-parameters:bin-directory
[dynamic-template-zeo-parameters]
buildout-bin-directory = {{ buildout_bin_directory }}
instance-logrotate-cfg = {{ template_logrotate_base }}
tunnel6 = {{ tunnel6_location }}
dash = {{ dash_location }}
zope-conf-template = {{ template_zope_conf }}
[dynamic-template-zeo]
< = jinja2-template-base
......@@ -190,7 +199,9 @@ template = {{ template_zeo }}
filename = instance-zeo.cfg
extensions = jinja2.ext.do
extra-context =
key ipv4_set slap-parameters:ipv4
key ipv6_set slap-parameters:ipv6
import json_module json
section parameter_dict dynamic-template-zeo-parameters
# key instance_stunnel
# Must match the key id in [switch-softwaretype] which uses this section.
......@@ -198,7 +209,6 @@ extra-context =
[dynamic-template-production-zope-parameters]
zope-conf-template = {{ template_zope_conf }}
products = {{ product_list }}
instance-logrotate-cfg = {{ template_logrotate_base }}
git = {{ git_location }}
graphviz = {{ graphviz_location }}
......@@ -213,6 +223,11 @@ tesseract = {{ tesseract_location }}
w3m = {{ w3m_location }}
poppler = {{ poppler_location }}
dmtx-utils = {{ dmtx_utils_location }}
openssl = {{ openssl_location }}
stunnel = {{ stunnel_location }}
tunnel6 = {{ tunnel6_location }}
haproxy = {{ haproxy_location }}
dash = {{ dash_location }}
[dynamic-template-production-zope]
< = jinja2-template-base
......@@ -221,10 +236,12 @@ filename = instance-production-zope.cfg
extensions = jinja2.ext.do
extra-context =
key ipv6_set slap-parameters:ipv6
section parameter_dict dynamic-template-production-zope
key ipv4_set slap-parameters:ipv4
section parameter_dict dynamic-template-production-zope-parameters
# key instance_stunnel
# Must match the key id in [switch-softwaretype] which uses this section.
raw software_type production-zope
import json_module json
[switch-softwaretype]
recipe = slapos.cookbook:softwaretype
......
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