From 15ee58711933e8a6a791528873559932ed232bae Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=81ukasz=20Nowak?= <luke@nexedi.com> Date: Thu, 10 Mar 2011 12:11:39 +0000 Subject: [PATCH] - drop zope_amount parameter and change to use specialised amount of nodes - drop more parameters from global dictionary git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@44107 20353a03-c40f-0410-a6d1-a30d3c3de9de --- slapos/recipe/erp5/README.txt | 6 +-- .../erp5/src/slapos/recipe/erp5/__init__.py | 40 ++++++++++++++----- .../slapos/recipe/erp5/template/zope.conf.in | 2 +- 3 files changed, 34 insertions(+), 14 deletions(-) diff --git a/slapos/recipe/erp5/README.txt b/slapos/recipe/erp5/README.txt index 1b42fce850..f6da8602c8 100644 --- a/slapos/recipe/erp5/README.txt +++ b/slapos/recipe/erp5/README.txt @@ -4,13 +4,13 @@ The slapos.recipe.erp5 aims to instanciate an ERP5 environnment SLAP parameters --------------- -zope_amount -~~~~~~~~~~~ +activity_node_amount, login_node_amount, keyauth_node_amount +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ :Optional: Yes :Type: integer :Default: None -:Description: If present switches to Zope/ZEO configuration and configures this amount of Zopes connected to ZEO. If not present only one Zope with own ZODB is created. +:Description: If any of those is present Zope/Zeo cluster is being created with specialised nodes. Oherwise one simple Zope instance with own ZODB is created. ca_* ~~~~ diff --git a/slapos/recipe/erp5/src/slapos/recipe/erp5/__init__.py b/slapos/recipe/erp5/src/slapos/recipe/erp5/__init__.py index b3597de65e..ac7d6eeedf 100644 --- a/slapos/recipe/erp5/src/slapos/recipe/erp5/__init__.py +++ b/slapos/recipe/erp5/src/slapos/recipe/erp5/__init__.py @@ -108,14 +108,32 @@ class Recipe(BaseSlapRecipe): CONFIG['zodb_root_path'] = os.path.join(zodb_dir, CONFIG['zodb_root_filename']) url_list = [] - if 'zope_amount' in self.parameter_dict: + if 'activity_node_amount' in self.parameter_dict or \ + 'login_node_amount' in self.parameter_dict or \ + 'keyauth_node_amount' in self.parameter_dict: self.installZeo() - for i in xrange(1, int(self.parameter_dict.get('zope_amount')) + 1): - url_list.append(self.installZope(ip=self.getLocalIPv4Address(), - port=12000 + i, name='zope_%s' % i, simple_zope=False)) + common_kw = dict( + zeo_address='%s:%s' % (CONFIG['zeo_ip'], CONFIG['zeo_port']), + zeo_storagename=CONFIG['zeo_storagename'], + ip=self.getLocalIPv4Address()) + port = 12001 + distribution_list = [self.installZope(port=port, name='zope_distribution', **common_kw)] + activity_list = [] + for i in xrange(1, int(self.parameter_dict.get('activity_node_amount', 0)) + 1): + port += 1 + activity_list.append(self.installZope(port=port, name='zope_activity_%s' % i, **common_kw)) + login_list = [] + for i in xrange(1, int(self.parameter_dict.get('login_node_amount', 0)) + 1): + port += 1 + login_list.append(self.installZope(port=port, name='zope_login_%s' % i, **common_kw)) + keyauth_list = [] + for i in xrange(1, int(self.parameter_dict.get('keyauth_node_amount', 0)) + 1): + port += 1 + keyauth_list.append(self.installZope(port=port, name='keyauth_login_%s' % i, **common_kw)) + url_list = activity_list + login_list + keyauth_list + distribution_list else: url_list.append(self.installZope(ip=self.getLocalIPv4Address(), - port=12000 + 1, name='zope_%s' % 1, simple_zope=True)) + port=12000 + 1, name='zope_%s' % 1, zodb_root_path=CONFIG['zodb_root_path'])) self.installHaproxy(ip=self.getGlobalIPv6Address(), port='15000', name='login', url_list=url_list) @@ -414,14 +432,16 @@ class Recipe(BaseSlapRecipe): )[0] self.path_list.append(wrapper) - def installZope(self, ip, port, name, simple_zope): + def installZope(self, ip, port, name, zeo_address=None, zeo_storagename=None, + zodb_root_path=None): # Create zope configuration file zope_config = dict( products=self.options['products'], - zeo_ip=CONFIG['zeo_ip'], - zeo_port=CONFIG['zeo_port'], - zeo_storagename=CONFIG['zeo_storagename'], ) + if zeo_address is not None and zeo_storagename is not None: + zope_config.update(zeo_address=zeo_address, zeo_storagename=zeo_storagename) + elif zodb_root_path is not None: + zope_config.update(zodb_root_path=zodb_root_path) zope_config['instance'] = self.erp5_directory zope_config['event_log'] = os.path.join(self.log_directory, '%s-event.log' % name) @@ -445,7 +465,7 @@ class Recipe(BaseSlapRecipe): zope_config['path'] = ':'.join([self.bin_directory] + os.environ['PATH'].split(':')) - if simple_zope: + if zeo_address is None: zope_wrapper_template_location = self.getTemplateFilename( 'zope.conf.simple.in') else: diff --git a/slapos/recipe/erp5/src/slapos/recipe/erp5/template/zope.conf.in b/slapos/recipe/erp5/src/slapos/recipe/erp5/template/zope.conf.in index 56d2bcf5f5..365a025838 100644 --- a/slapos/recipe/erp5/src/slapos/recipe/erp5/template/zope.conf.in +++ b/slapos/recipe/erp5/src/slapos/recipe/erp5/template/zope.conf.in @@ -46,7 +46,7 @@ lock-filename %(lock-filename)s <zodb_db main> mount-point / <zeoclient> - server %(zeo_ip)s:%(zeo_port)s + server %(zeo_address)s storage %(zeo_storagename)s name %(zeo_storagename)s </zeoclient> -- 2.30.9