Commit 793b2c83 authored by Vincent Pelletier's avatar Vincent Pelletier Committed by Rafael Monnerat

Add initial support for automated frontend allocation for ERP5 SR.

Parameters are not final yet, and must evolve to get something resilient to
frontend "movements" (ex: frontend machine dying and frontend being
re-allocated on another, or frontend being replaced by an instance from
another software release - as it will happen for upgrades).

Modifed from original version by Rafael in order to fix conflicts
on md5 of the files and changes on same file done in multiple branches.
parent 913826a3
TODO: improve
Instance Parameters
===================
Zope Parameters
---------------
Needed by software-type development (default) and zope.
frontend-software-url
~~~~~~~~~~~~~~~~~~~~~
Software URL of an existing frontend.
XXX: meaning should change (or it will go away) in order to be resilient to
software updates - as they are visible at software-url level.
If it is not provided, no frontend will be requested.
frontend-instance-guid
~~~~~~~~~~~~~~~~~~~~~~
GUID of frontend instance.
Not perfect yet: if that instance is replaced, slaves have to be reconfigured.
Mandatory only if frontend-software-url is also provided.
XXX: should be complemented (or replaced) by more flexible and precise
criteria.
frontend-software-type (optional)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Frontend software type as defined by the software relase at
frontend-software-url.
frontend-domain (optional)
~~~~~~~~~~~~~~~~~~~~~~~~~~
Domain name frontend must recognise as belonging to this instance.
......@@ -17,14 +17,45 @@ eggs-directory = {{ eggs_directory }}
develop-eggs-directory = {{ develop_eggs_directory }}
offline = true
[slap-parameter]
# By default, if no white list is specified, backend allows access to everyone
access-control-string = all
{% if 'frontend-software-url' in slapparameter_dict -%}
[request-slave-frontend]
recipe = slapos.cookbook:request
software-url = {{ slapparameter_dict['frontend-software-url'] }}
software-type = {{ slapparameter_dict.get('frontend-software-type', 'RootSoftwareInstance') }}
sla = instance_guid
sla-instance_guid = {{ slapparameter_dict['frontend-instance-guid'] }}
server-url = ${slap-connection:server-url}
key-file = ${slap-connection:key-file}
cert-file = ${slap-connection:cert-file}
computer-id = ${slap-connection:computer-id}
partition-id = ${slap-connection:partition-id}
name = SlaveFrontend
slave = true
{% set config_dict = {
'url': '${apache-zope-backend-instance:scheme}://[${apache-zope-backend-instance:ip}]:${apache-zope-backend-instance:port}',
'type': 'zope',
} -%}
{% if 'frontend-domain' in slapparameter_dict -%}
{% do config_dict.__setitem__('custom_domain', slapparameter_dict['frontend-domain']) -%}
{% endif -%}
config = {{ config_dict.keys() | join(' ') }}
{% for name, value in config_dict.items() -%}
config-{{ name }} = {{ value }}
{% endfor -%}
return = site_url
[publish-apache-zope-backend-connection-string]
recipe = slapos.cookbook:publish
url = ${request-slave-frontend:connection-site_url}
login = ${zope-instance:user}
password = ${zope-instance:password}
url-deadlock = ${:url}/${zope-instance:deadlock-path}?${zope-instance:deadlock-password}
{% else %}
[publish-apache-zope-backend-connection-string]
recipe = slapos.cookbook:publish
url = https://${zope-instance:user}:${zope-instance:password}@[${apache-zope-backend-instance:ip}]:${apache-zope-backend-instance:port}
url-deadlock = ${:url}/${zope-instance:deadlock-path}?${zope-instance:deadlock-password}
{% endif %}
[apache-zope-backend-instance]
recipe = slapos.cookbook:apache.zope.backend
......@@ -35,7 +66,8 @@ wrapper = ${rootdirectory:bin}/apache
key-file = ${directory:apache-conf}/apache.key
cert-file = ${directory:apache-conf}/apache.crt
configuration-file = ${directory:apache-conf}/apache.conf
access-control-string = ${slap-parameter:access-control-string}
{# By default, if no white list is specified, backend allows access to everyone -#}
access-control-string = {{ slapparameter_dict.get('access-control-string', 'all') }}
pid-file = ${basedirectory:run}/apache.pid
lock-file = ${basedirectory:run}/apache.lock
ssl-session-cache = ${basedirectory:log}/apache-ssl-session-cache
......
......@@ -112,14 +112,83 @@ extra-context =
# Must match the key id in [switch-softwaretype] which uses this section.
raw software_type varnish
[dynamic-template-zope-parameters]
apache = {{ apache_location }}
aspell = {{ aspell_location }}
bin-directory = {{ bin_directory }}
coreutils = {{ coreutils_location }}
dcron = {{ dcron_location }}
dmtx-utils = {{ dmtx_utils_location }}
erp5 = {{ erp5_location }}
git = {{ git_location }}
graphviz = {{ graphviz_location }}
grep = {{ grep_location }}
gzip = {{ gzip_location }}
imagemagick = {{ imagemagick_location }}
librsvg = {{ librsvg_location }}
logrotate = {{ logrotate_location }}
mariadb = {{ mariadb_location }}
openssl = {{ openssl_location }}
pdftk = {{ pdftk_location }}
poppler = {{ poppler_location }}
sed = {{ sed_location }}
tesseract = {{ tesseract_location }}
w3m = {{ w3m_location }}
[dynamic-template-zope]
< = jinja2-template-base
template = {{ template_zope }}
filename = instance-zope.cfg
extensions = jinja2.ext.do
# XXX: duplicates above section, so less is modified in template in this
# commit. Should be replaced by a single "section" line.
extra-context =
key apache_location dynamic-template-zope-parameters:apache
key aspell_location dynamic-template-zope-parameters:aspell
key bin_directory dynamic-template-zope-parameters:bin-directory
key coreutils_location dynamic-template-zope-parameters:coreutils
key dcron_location dynamic-template-zope-parameters:dcron
key dmtx_utils_location dynamic-template-zope-parameters:dmtx-utils
key erp5_location dynamic-template-zope-parameters:erp5
key git_location dynamic-template-zope-parameters:git
key graphviz_location dynamic-template-zope-parameters:graphviz
key grep_location dynamic-template-zope-parameters:grep
key gzip_location dynamic-template-zope-parameters:gzip
key imagemagick_location dynamic-template-zope-parameters:imagemagick
key librsvg_location dynamic-template-zope-parameters:librsvg
key logrotate_location dynamic-template-zope-parameters:logrotate
key mariadb_location dynamic-template-zope-parameters:mariadb
key openssl_location dynamic-template-zope-parameters:openssl
key pdftk_location dynamic-template-zope-parameters:pdftk
key poppler_location dynamic-template-zope-parameters:poppler
key sed_location dynamic-template-zope-parameters:sed
key tesseract_location dynamic-template-zope-parameters:tesseract
key w3m_location dynamic-template-zope-parameters:w3m
[template-erp5-development-parameters]
bin-directory = {{ bin_directory }}
openssl = {{ openssl_location }}
[template-erp5-development]
< = jinja2-template-base
template = {{ template_erp5_development }}
filename = instance-erp5-development.cfg
# XXX: duplicates above section, so less is modified in template in this
# commit. Should be replaced by a "section" line (preserving template_zope
# definition).
extra-context =
key bin_directory template-erp5-development-parameters:bin-directory
key openssl_location template-erp5-development-parameters:openssl
key template_zope dynamic-template-zope:rendered
[switch-softwaretype]
recipe = slapos.cookbook:softwaretype
default = {{ template_erp5_development }}
default = ${template-erp5-development:rendered}
production = {{ template_erp5_production }}
kumofs = {{ template_kumofs }}
memcached = {{ template_memcached }}
cloudooo = ${dynamic-template-cloudooo:rendered}
zope = {{ template_zope }}
zope = ${dynamic-template-zope:rendered}
mariadb = {{ template_mariadb }}
sphinx = {{ template_sphinx }}
tidstorage = ${dynamic-template-tidstorage:rendered}
......
......@@ -28,7 +28,7 @@ unzip = true
[slapos.cookbook-repository]
recipe = plone.recipe.command
stop-on-error = true
branch = erp5
branch = erp5-component
revision =
location = ${buildout:parts-directory}/${:_buildout_section_name_}
command = "${git:location}/bin/git" clone --branch "${:branch}" --quiet http://git.erp5.org/repos/slapos.git "${:location}" && if [ -n "${:revision}" ]; then cd "${:location}" && "${git:location}/bin/git" reset --quiet --hard "${:revision}" ; fi
......@@ -91,30 +91,10 @@ extra-context =
key sphinx_location sphinx:location
[template-zope]
< = template-jinja2-base
filename = instance-zope.cfg
md5sum = 1aa28ed156c7cd0dd442717dfc14ad01
extra-context =
key apache_location apache:location
key aspell_location aspell:location
key coreutils_location coreutils:location
key dcron_location dcron:location
key dmtx_utils_location dmtx-utils:location
key erp5_location erp5:location
key git_location git:location
key graphviz_location graphviz:location
key grep_location grep:location
key gzip_location gzip:location
key imagemagick_location imagemagick:location
key librsvg_location librsvg:location
key logrotate_location logrotate:location
key mariadb_location mariadb:location
key openssl_location openssl:location
key pdftk_location pdftk:location
key poppler_location poppler:location
key sed_location sed:location
key tesseract_location tesseract:location
key w3m_location w3m:location
recipe = slapos.recipe.build:download
url = ${:_profile_base_location_}/instance-zope.cfg.in
md5sum = ea09a89ca79290c33de0b59a19a5490f
mode = 640
[template-kumofs]
< = template-jinja2-base
......@@ -131,7 +111,7 @@ extra-context =
[template-tidstorage]
recipe = slapos.recipe.build:download
url = ${:_profile_base_location_}/instance-tidstorage.cfg.in
md5sum = 5c52385b4f12fd9719975655bc2eddec
md5sum = 5c52385b4f12fd9719975655bc2eddec
mode = 640
[template-cloudooo]
......@@ -154,7 +134,7 @@ mode = 640
# XXX: "template.cfg" is hardcoded in instanciation recipe
filename = template.cfg
template = ${:_profile_base_location_}/instance.cfg.in
md5sum = e78fe31537b479055a6a5932fd55d6dc
md5sum = ee7d9040f3f90948fe15f78196f66149
extra-context =
key apache_location apache:location
key aspell_location aspell:location
......@@ -162,6 +142,7 @@ extra-context =
key coreutils_location coreutils:location
key dcron_location dcron:location
key dmtx_utils_location dmtx-utils:location
key erp5_location erp5:location
key file_location file:location
key fontconfig_location fontconfig:location
key fonts_location fonts:location
......@@ -189,7 +170,7 @@ extra-context =
key pdftk_location pdftk:location
key poppler_location poppler:location
key sed_location sed:location
key template_erp5_development template-erp5-development:rendered
key template_erp5_development template-erp5-development:target
key template_erp5_production template-erp5-production:rendered
key template_kumofs template-kumofs:rendered
key template_mariadb template-mariadb:rendered
......@@ -198,7 +179,7 @@ extra-context =
key template_sphinx template-sphinx:rendered
key template_tidstorage template-tidstorage:target
key template_varnish template-varnish:target
key template_zope template-zope:rendered
key template_zope template-zope:target
key template_zope_conf template-zope-conf:target
key tesseract_location tesseract:location
key w3m_location w3m:location
......@@ -216,12 +197,10 @@ extra-context =
key memcached_location memcached:location
[template-erp5-development]
< = template-jinja2-base
filename = instance-erp5-development.cfg
recipe = slapos.recipe.build:download
url = ${:_profile_base_location_}/instance-erp5-development.cfg.in
md5sum = df405a60901b5c112093d276c5bb1998
extra-context =
key openssl_location openssl:location
key template_zope template-zope:rendered
mode = 640
[template-erp5-production]
< = template-jinja2-base
......
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