Commit 41119516 authored by Vincent Pelletier's avatar Vincent Pelletier

erp5: Implement automated ERP5Site creation.

parent a9611645
Available ``software-type`` values
==================================
- ``default``
Recommended for production use.
- ``create-erp5-site``
Automated creation of ERP5Site instance, for easy deployment.
Usage in production discouraged due to the increased risk of data loss.
Notes
=====
This software release is not intended to be accessed directly, but through a
front-end instance which is expected to contains the RewriteRules_ (or
equivalent) needed to relocate Zope's urls via its VirtualHostMonster_. See the
``frontend`` erp5 instance parameter.
Included cloudooo partition is not recommended for intensive usage, and will
eventually be dropped. See the ``cloudooo`` software type to setup a cloudooo
cluster, more suitable for intensive usage.
.. _RewriteRules: http://httpd.apache.org/docs/current/en/mod/mod_rewrite.html#rewriterule
.. _VirtualHostMonster: http://docs.zope.org/zope2/zope2book/VirtualHosting.html
...@@ -18,7 +18,32 @@ ...@@ -18,7 +18,32 @@
"description": "Password for /manage_debug_threads", "description": "Password for /manage_debug_threads",
"default": "random", "default": "random",
"type": "string" "type": "string"
},
"frontend": {
"description": "Front-end slave instance request parameters",
"properties": {
"software-url": {
"description": "Front-end's software type. If this parameter is the empty string, no front-end instance is requested.",
"default": "",
"type": "string"
},
"domain": {
"description": "The domain name to request front-end to respond as.",
"default": "",
"type": "string"
},
"software-type": {
"description": "Request a front-end slave instance of this software type.",
"default": "RootSoftwareInstance",
"type": ""
},
"instance-guid": {
"description": "GUID of computer instance must be requested on. Mandatory if software-url is a non-empty string.",
"type": "string"
} }
},
"type": "object"
},
"zope-partition-dict": { "zope-partition-dict": {
"description": "Zope layout definition", "description": "Zope layout definition",
"patternProperties": { "patternProperties": {
......
...@@ -210,12 +210,22 @@ md5sum = 774b0e5d167b75a0ad8ead45fa2eadf6 ...@@ -210,12 +210,22 @@ md5sum = 774b0e5d167b75a0ad8ead45fa2eadf6
filename = mariadb_initial_setup.sql.in filename = mariadb_initial_setup.sql.in
md5sum = 564006953b7d7a12d40a14b6648b32f0 md5sum = 564006953b7d7a12d40a14b6648b32f0
[template-create-erp5-site]
< = download-base
filename = instance-create-erp5-site.cfg.in
md6sum = 4504b8e58cf6eb0f17ef30c29c04432d
[template-create-erp5-site-real]
< = download-base
filename = instance-create-erp5-site-real.cfg.in
md5sum = c7dde5117e3e99c9669b9a10c82778f3
[template] [template]
< = template-jinja2-base < = template-jinja2-base
# 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 = c717ed0f17a85da36f268cf55e545da7 md5sum = 3a3845caa33fffd762b346ed5949f196
extra-context = extra-context =
key mariadb_link_binary template-mariadb:link-binary key mariadb_link_binary template-mariadb:link-binary
key zope_link_binary template-zope:link-binary key zope_link_binary template-zope:link-binary
...@@ -255,6 +265,8 @@ extra-context = ...@@ -255,6 +265,8 @@ extra-context =
key stunnel_location stunnel:location key stunnel_location stunnel:location
key template_balancer template-balancer:target key template_balancer template-balancer:target
key template_cloudooo template-cloudooo:target key template_cloudooo template-cloudooo:target
key template_create_erp5_site template-create-erp5-site:target
key template_create_erp5_site_real template-create-erp5-site-real:target
key template_erp5 template-erp5:target key template_erp5 template-erp5:target
key template_haproxy_cfg template-haproxy-cfg:target key template_haproxy_cfg template-haproxy-cfg:target
key template_kumofs template-kumofs:target key template_kumofs template-kumofs:target
......
[directory]
recipe = slapos.cookbook:mkdirectory
etc = ${buildout:directory}/etc
services = ${:etc}/run
promise = ${:etc}/promise
[erp5-bootstrap]
recipe = slapos.cookbook:erp5.bootstrap
runner-path = ${directory:services}/erp5-bootstrap
{# XXX: Expect the first database to be the one to use for catalog. -#}
mysql-url = {{ publish['mariadb-database-list'][0] }}
{# Pick the first family found, they should be all equivalent anyway. -#}
{% set family_list = [] -%}
{% for key, value in publish.items() -%}
{% if key.startswith('family-') -%}
{% do family_list.append(value.split('://', 1)) -%}
{% endif -%}
{% endfor -%}
zope-url = {{ family_list[0][0] + '://zope:insecure@' + family_list[0][1] + '/' + publish['site-id'] }}
[promise-erp5-site]
recipe = slapos.cookbook:check_url_available
url = ${erp5-bootstrap:zope-url}
path = ${directory:promise}/erp5-site
dash_path = {{ parameter_dict['dash-location'] }}/bin/dash
curl_path = {{ parameter_dict['curl-location'] }}/bin/curl
[buildout]
parts = promise-erp5-site
eggs-directory = {{ eggs_directory }}
develop-eggs-directory = {{ develop_eggs_directory }}
{% if software_type == slap_software_type -%}
{# To create the script (wrapper) which creates the ERP5Site object, pieces
# of what is published by extended file are required. Because they are not
# available at the time the file you are reading is rendered, and because
# those values are composed (lists, dicts...) of which items are needed,
# they cannot be accessed. Instead, make buildout provide these values to
# a second template, rendered at a convenient time.
-#}
[instance-create-erp5-site-real-parameters]
dash-location = {{ parameter_dict['dash-location'] }}
curl-location = {{ parameter_dict['curl-location'] }}
[instance-create-erp5-site-real]
recipe = slapos.recipe.template:jinja2
template = {{ parameter_dict['template-create-erp5-site-real'] }}
rendered = ${buildout:directory}/instance-create-erp5-site-real.cfg
extensions = jinja2.ext.do
context =
section publish publish
section parameter_dict instance-create-erp5-site-real-parameters
key eggs_directory buildout:eggs-directory
key develop_eggs_directory buildout:develop-eggs-directory
[instance-create-erp5-site-real-run]
recipe = slapos.recipe.build
script =
import subprocess, sys
subprocess.check_call([
sys.argv[0],
"buildout:directory=${buildout:directory}",
"buildout:installed=.installed-${:_buildout_section_name_}.cfg",
"-Uoc", self.options['run'],
])
run = ${instance-create-erp5-site-real:rendered}
slapos_promise =
[buildout]
extends = {{ parameter_dict['instance-erp5'] }}
parts +=
instance-create-erp5-site-real-run
{% endif %}
...@@ -78,6 +78,10 @@ software-type = cluster ...@@ -78,6 +78,10 @@ software-type = cluster
< = dynamic-template-erp5 < = dynamic-template-erp5
software-type = RootSoftwareInstance software-type = RootSoftwareInstance
[dynamic-template-erp5-create-erp5-site]
< = dynamic-template-erp5
software-type = create-erp5-site
[dynamic-template-balancer-parameters] [dynamic-template-balancer-parameters]
apache = {{ apache_location }} apache = {{ apache_location }}
openssl = {{ openssl_location }} openssl = {{ openssl_location }}
...@@ -188,6 +192,21 @@ extra-context = ...@@ -188,6 +192,21 @@ 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 mariadb raw software_type mariadb
[dynamic-template-create-erp5-site-parameters]
instance-erp5 = ${dynamic-template-erp5-create-erp5-site:rendered}
template-create-erp5-site-real = {{ template_create_erp5_site_real }}
dash-location = {{ dash_location }}
curl-location = {{ curl_location }}
[dynamic-template-create-erp5-site]
< = jinja2-template-base
template = {{ template_create_erp5_site }}
filename = instance-create-erp5-site.cfg
extra-context =
section parameter_dict dynamic-template-create-erp5-site-parameters
# Must match the key id in [switch-softwaretype] which uses this section.
raw software_type create-erp5-site
[switch-softwaretype] [switch-softwaretype]
recipe = slapos.recipe.build recipe = slapos.recipe.build
script = script =
...@@ -214,7 +233,10 @@ slapos_promise = ...@@ -214,7 +233,10 @@ slapos_promise =
slapos_update_promise = ${:slapos_promise} slapos_update_promise = ${:slapos_promise}
override = {{ dumps(override_switch_softwaretype |default) }} override = {{ dumps(override_switch_softwaretype |default) }}
# Public software types
default = ${dynamic-template-erp5:rendered} default = ${dynamic-template-erp5:rendered}
create-erp5-site = ${dynamic-template-create-erp5-site:rendered}
# Internal software types
kumofs = ${dynamic-template-kumofs:rendered} kumofs = ${dynamic-template-kumofs:rendered}
cloudooo = ${dynamic-template-cloudooo:rendered} cloudooo = ${dynamic-template-cloudooo:rendered}
mariadb = ${dynamic-template-mariadb:rendered} mariadb = ${dynamic-template-mariadb:rendered}
......
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