Commit 77b3b357 authored by Vincent Pelletier's avatar Vincent Pelletier

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).
parent a2f94dc9
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 }} ...@@ -17,14 +17,45 @@ eggs-directory = {{ eggs_directory }}
develop-eggs-directory = {{ develop_eggs_directory }} develop-eggs-directory = {{ develop_eggs_directory }}
offline = true offline = true
[slap-parameter] {% if 'frontend-software-url' in slapparameter_dict -%}
# By default, if no white list is specified, backend allows access to everyone [request-slave-frontend]
access-control-string = all 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] [publish-apache-zope-backend-connection-string]
recipe = slapos.cookbook:publish recipe = slapos.cookbook:publish
url = https://${zope-instance:user}:${zope-instance:password}@[${apache-zope-backend-instance:ip}]:${apache-zope-backend-instance:port} 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} url-deadlock = ${:url}/${zope-instance:deadlock-path}?${zope-instance:deadlock-password}
{% endif %}
[apache-zope-backend-instance] [apache-zope-backend-instance]
recipe = slapos.cookbook:apache.zope.backend recipe = slapos.cookbook:apache.zope.backend
...@@ -35,7 +66,8 @@ wrapper = ${rootdirectory:bin}/apache ...@@ -35,7 +66,8 @@ wrapper = ${rootdirectory:bin}/apache
key-file = ${directory:apache-conf}/apache.key key-file = ${directory:apache-conf}/apache.key
cert-file = ${directory:apache-conf}/apache.crt cert-file = ${directory:apache-conf}/apache.crt
configuration-file = ${directory:apache-conf}/apache.conf 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 pid-file = ${basedirectory:run}/apache.pid
lock-file = ${basedirectory:run}/apache.lock lock-file = ${basedirectory:run}/apache.lock
ssl-session-cache = ${basedirectory:log}/apache-ssl-session-cache ssl-session-cache = ${basedirectory:log}/apache-ssl-session-cache
...@@ -58,7 +90,7 @@ recipe = slapos.cookbook:generic.zope ...@@ -58,7 +90,7 @@ recipe = slapos.cookbook:generic.zope
# XXX: products won't be needed as soon as all ERP5 (and products-deps) # XXX: products won't be needed as soon as all ERP5 (and products-deps)
# products will be eggified so then it will be possible to use them thanks to # products will be eggified so then it will be possible to use them thanks to
# availability in software's eggs # availability in software's eggs
products = {{ products_list }} products = {{ product_list }}
# Options # Options
user = zope user = zope
......
...@@ -113,14 +113,85 @@ extra-context = ...@@ -113,14 +113,85 @@ extra-context =
# Must match the key id in [switch-softwaretype] which uses this section. # Must match the key id in [switch-softwaretype] which uses this section.
raw software_type varnish 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 }}
product-list = {{ product_list }}
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 product_list dynamic-template-zope-parameters:product-list
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] [switch-softwaretype]
recipe = slapos.cookbook:softwaretype recipe = slapos.cookbook:softwaretype
default = {{ template_erp5_development }} default = ${template-erp5-development:rendered}
production = {{ template_erp5_production }} production = {{ template_erp5_production }}
kumofs = {{ template_kumofs }} kumofs = {{ template_kumofs }}
memcached = {{ template_memcached }} memcached = {{ template_memcached }}
cloudooo = ${dynamic-template-cloudooo:rendered} cloudooo = ${dynamic-template-cloudooo:rendered}
zope = {{ template_zope }} zope = ${dynamic-template-zope:rendered}
mariadb = {{ template_mariadb }} mariadb = {{ template_mariadb }}
sphinx = {{ template_sphinx }} sphinx = {{ template_sphinx }}
tidstorage = ${dynamic-template-tidstorage:rendered} tidstorage = ${dynamic-template-tidstorage:rendered}
......
...@@ -91,31 +91,10 @@ extra-context = ...@@ -91,31 +91,10 @@ extra-context =
key sphinx_location sphinx:location key sphinx_location sphinx:location
[template-zope] [template-zope]
< = template-jinja2-base recipe = slapos.recipe.build:download
filename = instance-zope.cfg url = ${:_profile_base_location_}/instance-zope.cfg.in
md5sum = e00efeefd2d1c09374b169c9d218e137 md5sum = 89b72fe691cc82e169c31a3642bef017
extra-context = mode = 640
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 products_list products:list
key sed_location sed:location
key tesseract_location tesseract:location
key w3m_location w3m:location
[template-kumofs] [template-kumofs]
< = template-jinja2-base < = template-jinja2-base
...@@ -155,7 +134,7 @@ mode = 640 ...@@ -155,7 +134,7 @@ mode = 640
# XXX: "template.cfg" is hardcoded in instanciation recipe # XXX: "template.cfg" is hardcoded in instanciation recipe
filename = template.cfg filename = template.cfg
template = ${:_profile_base_location_}/instance.cfg.in template = ${:_profile_base_location_}/instance.cfg.in
md5sum = d9b0d9105a4a55e6fca32e5b550d12f2 md5sum = d6dd33f27f67c80e2bc42ed6172adcbd
extra-context = extra-context =
key apache_location apache:location key apache_location apache:location
key aspell_location aspell:location key aspell_location aspell:location
...@@ -163,6 +142,7 @@ extra-context = ...@@ -163,6 +142,7 @@ extra-context =
key coreutils_location coreutils:location key coreutils_location coreutils:location
key dcron_location dcron:location key dcron_location dcron:location
key dmtx_utils_location dmtx-utils:location key dmtx_utils_location dmtx-utils:location
key erp5_location erp5:location
key file_location file:location key file_location file:location
key fontconfig_location fontconfig:location key fontconfig_location fontconfig:location
key fonts_location fonts:location key fonts_location fonts:location
...@@ -191,7 +171,7 @@ extra-context = ...@@ -191,7 +171,7 @@ extra-context =
key poppler_location poppler:location key poppler_location poppler:location
key product_list products:list key product_list products:list
key sed_location sed: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_erp5_production template-erp5-production:rendered
key template_kumofs template-kumofs:rendered key template_kumofs template-kumofs:rendered
key template_mariadb template-mariadb:rendered key template_mariadb template-mariadb:rendered
...@@ -200,7 +180,7 @@ extra-context = ...@@ -200,7 +180,7 @@ extra-context =
key template_sphinx template-sphinx:rendered key template_sphinx template-sphinx:rendered
key template_tidstorage template-tidstorage:target key template_tidstorage template-tidstorage:target
key template_varnish template-varnish: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 template_zope_conf template-zope-conf:target
key tesseract_location tesseract:location key tesseract_location tesseract:location
key w3m_location w3m:location key w3m_location w3m:location
...@@ -218,12 +198,10 @@ extra-context = ...@@ -218,12 +198,10 @@ extra-context =
key memcached_location memcached:location key memcached_location memcached:location
[template-erp5-development] [template-erp5-development]
< = template-jinja2-base recipe = slapos.recipe.build:download
filename = instance-erp5-development.cfg url = ${:_profile_base_location_}/instance-erp5-development.cfg.in
md5sum = df405a60901b5c112093d276c5bb1998 md5sum = df405a60901b5c112093d276c5bb1998
extra-context = mode = 640
key openssl_location openssl:location
key template_zope template-zope:rendered
[template-erp5-production] [template-erp5-production]
< = template-jinja2-base < = 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