Commit 507993c4 authored by Łukasz Nowak's avatar Łukasz Nowak

Use declarative way to install Zeo cluster.


git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@45775 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 924f5362
...@@ -499,20 +499,39 @@ class Recipe(BaseSlapRecipe): ...@@ -499,20 +499,39 @@ class Recipe(BaseSlapRecipe):
bt5_repository_list])) bt5_repository_list]))
return [] return []
def installZeo(self, ip, port, name, path): def installZeo(self, ip):
zeo_event_log = os.path.join(self.log_directory, 'zeo.log') zodb_dir = os.path.join(self.data_root_directory, 'zodb')
zeo_pid = os.path.join(self.run_directory, 'zeo.pid') self._createDirectory(zodb_dir)
zeo_configuration_list = []
zeo_number = 0
for zeo_server in sorted(self._zeo_storage_dict.iterkeys()):
zeo_number += 1
zeo_event_log = os.path.join(self.log_directory, 'zeo-%s.log'% zeo_number)
zeo_pid = os.path.join(self.run_directory, 'zeo-%s.pid'% zeo_number)
self.registerLogRotation('zeo', [zeo_event_log], self.registerLogRotation('zeo', [zeo_event_log],
self.killpidfromfile + ' ' + zeo_pid + ' SIGUSR2') self.killpidfromfile + ' ' + zeo_pid + ' SIGUSR2')
config = dict( config = dict(
zeo_ip=ip, zeo_ip=ip,
zeo_port=port, zeo_port=self._zeo_storage_port_dict[zeo_server],
zeo_storagename=name,
zeo_event_log=zeo_event_log, zeo_event_log=zeo_event_log,
zeo_pid=zeo_pid, zeo_pid=zeo_pid,
zeo_zodb=path
) )
zeo_conf_path = self.createConfigurationFile('zeo.conf', storage_number = 0
storage_definition_list = []
for storage_name in sorted(self._zeo_storage_dict[zeo_server]):
storage_number += 1
path = os.path.join(zodb_dir, 'zodb_%s.fs' % storage_number)
storage_definition_list.append("""<filestorage %(storage_name)s>
path %(path)s
</filestorage>"""% dict(storage_name=storage_name, path=path))
zeo_configuration_list.append(dict(
ip=ip,
port=config['zeo_port'],
path=path,
storage_name=storage_name,
))
config['zeo_filestorage_snippet'] = '\n'.join(storage_definition_list)
zeo_conf_path = self.createConfigurationFile('zeo-%s.conf' % zeo_number,
self.substituteTemplate(self.getTemplateFilename('zeo.conf.in'), config)) self.substituteTemplate(self.getTemplateFilename('zeo.conf.in'), config))
self.path_list.append(zeo_conf_path) self.path_list.append(zeo_conf_path)
wrapper = zc.buildout.easy_install.scripts([('zeo', __name__ + '.execute', wrapper = zc.buildout.easy_install.scripts([('zeo', __name__ + '.execute',
...@@ -520,9 +539,7 @@ class Recipe(BaseSlapRecipe): ...@@ -520,9 +539,7 @@ class Recipe(BaseSlapRecipe):
self.options['runzeo_binary'].strip(), '-C', zeo_conf_path] self.options['runzeo_binary'].strip(), '-C', zeo_conf_path]
)[0] )[0]
self.path_list.append(wrapper) self.path_list.append(wrapper)
return dict( return zeo_configuration_list
zeo_address='%s:%s' % (config['zeo_ip'], config['zeo_port']),
zeo_storagename=config['zeo_storagename'])
def installZope(self, ip, port, name, zeo_address=None, zeo_storagename=None, def installZope(self, ip, port, name, zeo_address=None, zeo_storagename=None,
zodb_root_path=None, with_timerservice=False): zodb_root_path=None, with_timerservice=False):
......
...@@ -6,9 +6,7 @@ ...@@ -6,9 +6,7 @@
pid-filename %(zeo_pid)s pid-filename %(zeo_pid)s
</zeo> </zeo>
<filestorage %(zeo_storagename)s> %(zeo_filestorage_snippet)s
path %(zeo_zodb)s
</filestorage>
<eventlog> <eventlog>
<logfile> <logfile>
......
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