diff --git a/software/erp5/instance-erp5-input-schema.json b/software/erp5/instance-erp5-input-schema.json index dc78a2a10c2c40dd0a6bdff80cd9cb15e59b4a86..116ac7b8dba4124d8c72753d0a9c9cded9e5548f 100644 --- a/software/erp5/instance-erp5-input-schema.json +++ b/software/erp5/instance-erp5-input-schema.json @@ -141,12 +141,13 @@ "zodb-software-type": { "description": "Zope Object DataBase implementation", "default": "zeo", - "enum": ["zeo"], + "enum": ["zeo", "neo"], "type": "string" }, "zodb": { "description": "Zope Object DataBase service", "oneOf": [ + {"$ref": "./instance-neo-input-schema.json#properties"}, {"$ref": "./instance-zeo-input-schema.json#properties"} ] } diff --git a/software/erp5/instance-neo-input-schema.json b/software/erp5/instance-neo-input-schema.json new file mode 100644 index 0000000000000000000000000000000000000000..39c0fabfdc6353789b09b57943986d73853dec7d --- /dev/null +++ b/software/erp5/instance-neo-input-schema.json @@ -0,0 +1,47 @@ +{ + "$schema": "http://json-schema.org/draft-04/schema#", + "extends": "./schema-definitions.json#", + "required": ["zodb-dict"], + "properties": { + "zodb-dict": { + "description": "Maps an export identifier to its settings", + "patternProperties": { + ".*": { + "properties": { + "mount-point": { + "description": "Traversal path export should be mounted at (opaque to this software type)", + "default": "/", + "type": "string" + }, + "cache-size": { + "description": "Client-side cache size in object count (opaque to this software type)", + "default": -1, + "type": "integer" + }, + "storage-dict": { + "default": {}, + "required": ["name", "master_nodes"], + "properties": { + "name": { + "description": "NEO cluster's name", + "type": "string" + }, + "master_nodes": { + "description": "Client-side settings for this mountpoint", + "minItems": 1, + "items": { + "type": "string" + }, + "type": "array" + } + }, + "type": "object" + } + }, + "type": "object" + } + }, + "type": "object" + } + } +} diff --git a/software/erp5/instance-neo-output-schema.json b/software/erp5/instance-neo-output-schema.json new file mode 100644 index 0000000000000000000000000000000000000000..82345cf9fc33e80d024db0fd62734a642201dbf3 --- /dev/null +++ b/software/erp5/instance-neo-output-schema.json @@ -0,0 +1,22 @@ +{ + "$schema": "http://json-schema.org/draft-04/schema#", + "description": "Values returned by ZEO instanciation", + "properties": { + "zodb-storage-type": { + "description": "zope.cfg-friendly storage type", + "enum": ["NEOStorage"], + "type": "string" + }, + "zodb-dict": { + "description": "Maps an export identifier to values received as parameters", + "patternProperties": { + ".*": { + "description": "Contains the mount-point, cache-size and client-dict received as parameters for current export identifier (client-dict's 'storage' and 'server' entries are overwritten with actual values)", + "type": "array" + } + }, + "type": "object" + }, + }, + "type": "object" +} diff --git a/stack/erp5/buildout.cfg b/stack/erp5/buildout.cfg index df47b456a1eab44cfcec948334fadb2afba6f12c..d08076140989b26762ae79168b3ce5af7e449898 100644 --- a/stack/erp5/buildout.cfg +++ b/stack/erp5/buildout.cfg @@ -210,7 +210,7 @@ md5sum = 564006953b7d7a12d40a14b6648b32f0 # XXX: "template.cfg" is hardcoded in instanciation recipe filename = template.cfg template = ${:_profile_base_location_}/instance.cfg.in -md5sum = d4b6e9bdaea4c11827dcb7a30c2d20c9 +md5sum = 3465c19d25e14865c6e844c9a26ee984 extra-context = key apache_location apache:location key aspell_location aspell:location @@ -266,6 +266,7 @@ extra-context = key template_mariadb template-mariadb:target key template_mariadb_initial_setup template-mariadb-initial-setup:target key template_my_cnf template-my-cnf:target + key template_neo template-neo:target key template_varnish template-varnish:target key template_zeo template-zeo:target key template_zope template-zope:target @@ -286,6 +287,11 @@ md5sum = 77ec4f095a22b5bd7dfea9dff63bade5 filename = instance-erp5-cluster.cfg.in md5sum = c745d794b28cae64feba527f894d7340 +[template-neo] +< = download-base +filename = instance-neo.cfg.in +md5sum = 1499c42d196f6627efb904f7e4d48b1b + [template-zeo] < = download-base filename = instance-zeo.cfg.in diff --git a/stack/erp5/instance-neo.cfg.in b/stack/erp5/instance-neo.cfg.in new file mode 100644 index 0000000000000000000000000000000000000000..3f5fdf393bc6f21ac23d7dc7e98439d7cd0e3661 --- /dev/null +++ b/stack/erp5/instance-neo.cfg.in @@ -0,0 +1,21 @@ +{% if software_type == slap_software_type -%} +{% set zodb_dict = {} -%} +{% for export_id, mountpoint_dict in slapparameter_dict['zodb-dict'].items() -%} +{% do zodb_dict.__setitem__(export_id, [ + mountpoint_dict.get('mount-point', '/'), + mountpoint_dict.get('cache-size', -1), + mountpoint_dict.get('storage-dict', {}), + ]) -%} +{% endfor -%} +[publish] +recipe = slapos.cookbook:publish.serialised +zodb-storage-type = NEOStorage +zodb-dict = {{ dumps(zodb_dict) }} + +[buildout] +parts += + publish +eggs-directory = {{ eggs_directory }} +develop-eggs-directory = {{ develop_eggs_directory }} +offline = true +{% endif %} diff --git a/stack/erp5/instance.cfg.in b/stack/erp5/instance.cfg.in index 1f058a7e530769b6b487e5024053c2aac8abafb6..e981c2175f85bc8bffec7bbea91a07e40d31db92 100644 --- a/stack/erp5/instance.cfg.in +++ b/stack/erp5/instance.cfg.in @@ -183,6 +183,15 @@ extra-context = # Must match the key id in [switch-softwaretype] which uses this section. raw software_type balancer +[dynamic-template-neo] +< = jinja2-template-base +template = {{ template_zeo }} +filename = instance-neo.cfg +extensions = jinja2.ext.do +extra-context = +# Must match the key id in [switch-softwaretype] which uses this section. + raw software_type zodb-neo + [dynamic-template-zeo-parameters] buildout-bin-directory = {{ buildout_bin_directory }} instance-logrotate-cfg = {{ template_logrotate_base }} @@ -282,6 +291,7 @@ zope = ${dynamic-template-zope:rendered} mariadb = ${dynamic-template-mariadb:rendered} varnish = ${dynamic-template-varnish:rendered} balancer = ${dynamic-template-balancer:rendered} +zodb-neo = ${dynamic-template-neo:rendered} zodb-zeo = ${dynamic-template-zeo:rendered} cluster-zope = ${dynamic-template-cluster-zope:rendered}