Commit d741e678 authored by Romain Courteaud's avatar Romain Courteaud

Tidstorage configuration moved to JSON

parent 8915e06b
...@@ -59,51 +59,6 @@ class Recipe(slapos.recipe.erp5.Recipe): ...@@ -59,51 +59,6 @@ class Recipe(slapos.recipe.erp5.Recipe):
return self._getIpAddress(validPublicAddress) return self._getIpAddress(validPublicAddress)
def _getZeoClusterDict(self):
site_path = '/erp5/'
r = self._requestZeoFileStorage
s = lambda x: site_path + x
z1 = lambda x: (r('Zeo Server 1', x), None, 5000, '20MB')
z2 = lambda x: (r('Zeo Server 2', x), None, 5000, '20MB')
z3 = lambda x: (r('Zeo Server 3', x), None, 5000, '20MB')
z4 = lambda x: (r('Zeo Server 4', x), None, 5000, '20MB')
z5 = lambda x: (r('Zeo Server 5', x), None, 5000, '20MB')
return {
# Zeo server 1
'/': (r('Zeo Server 1', 'main'), s('account_module'), 2000, '400MB'),
s('portal_activities'): z1('portal_activities'),
s('task_report_module'): z1('task_report_module'),
s('video_request_module'): z1('video_request_module'),
s('bug_module'): z1('bug_module'),
s('portal_simulation'): z1('portal_simulation'),
s('notice_transfer_request_module'): z1('notice_transfer_request_module'),
s('accounting_module'): z1('accounting_module'),
s('task_module'): z1('task_module'),
# Zeo server 2
s('video_module'): (r('Zeo Server 2', 'video_module'), None, 2000, '400MB'),
# Zeo server 3
s('event_module'): z3('event_module'),
s('support_request_module'): z3('support_request_module'),
# Zeo server 4
s('person_module'): z4('person_module'),
s('organisation_module'): z4('organisation_module'),
# Zeo server 5
s('scanned_document_module'): (r('Zeo Server 5', 'scanned_document_module'),
None, 2000, '400MB'),
s('item_module'): z5('item_module'),
s('document_module'): z5('document_module'),
s('image_module'): z5('image_module'),
s('external_source_module'): z5('external_source_module'),
}
def installProductionMysql(self): def installProductionMysql(self):
mysql_conf = self.installMysqlServer(self.getGlobalIPv6Address(), 45678, mysql_conf = self.installMysqlServer(self.getGlobalIPv6Address(), 45678,
template_filename=pkg_resources.resource_filename(__name__, template_filename=pkg_resources.resource_filename(__name__,
...@@ -115,122 +70,6 @@ class Recipe(slapos.recipe.erp5.Recipe): ...@@ -115,122 +70,6 @@ class Recipe(slapos.recipe.erp5.Recipe):
)) ))
return self.path_list return self.path_list
def installProductionApplication(self):
site_check_path = '/%s/getId' % self.site_id
access_control_string = self.parameter_dict['backend_acl_string']
ca_conf = self.installCertificateAuthority()
backend_key, backend_certificate = self.requestCertificate('Login Based Access')
memcached_conf = self.installMemcached(ip=self.getLocalIPv4Address(),
port=11000)
conversion_server_conf = self.installConversionServer(
self.getLocalIPv4Address(), 23000, 23060)
user, password = self.installERP5()
ip = self.getLocalIPv4Address()
mount_point_zeo_dict = self._getZeoClusterDict()
zeo_conf = self.installZeo(ip)
zodb_configuration_list = []
known_tid_storage_identifier_dict = {}
for mount_point, \
(storage_dict, check_path, zodb_cache_size, zeo_client_cache_size) in \
mount_point_zeo_dict.iteritems():
known_tid_storage_identifier_dict[
(((storage_dict['ip'],storage_dict['port']),), storage_dict['storage_name'])
] = (zeo_conf[storage_dict['storage_name']]['path'], check_path or mount_point)
zodb_configuration_list.append(self.substituteTemplate(
self.getTemplateFilename('zope-zeo-snippet.conf.in'), dict(
storage_name=storage_dict['storage_name'],
address='%s:%s' % (storage_dict['ip'], storage_dict['port']),
mount_point=mount_point, zodb_cache_size=zodb_cache_size,
zeo_client_cache_size=zeo_client_cache_size,
)))
tidstorage_config = dict(host=self.getLocalIPv4Address(), port='6001')
zodb_configuration_string = '\n'.join(zodb_configuration_list)
zope_port = 12000
# One Distribution Node
zope_port +=1
self.installZope(ip, zope_port, 'zope_distribution',
with_timerservice=True,
zodb_configuration_string=zodb_configuration_string,
tidstorage_config=tidstorage_config,
)
# Two Activity Nodes
for i in (1, 2):
zope_port += 1
self.installZope(ip, zope_port, 'zope_activity_%s' % i,
with_timerservice=True,
zodb_configuration_string=zodb_configuration_string,
tidstorage_config=tidstorage_config,
)
# Eight Working Nodes (Human access)
login_url_list = []
for i in (1, 2, 3, 4, 5, 6, 7, 8):
zope_port += 1
login_url_list.append(self.installZope(ip, zope_port,
'zope_login_%s' % i, with_timerservice=False,
zodb_configuration_string=zodb_configuration_string,
tidstorage_config=tidstorage_config,
)
login_haproxy = self.installHaproxy(ip, 15001, 'login', site_check_path,
login_url_list)
# One Web Node
zope_port += 1
web_url_list = [self.installZope(ip, zope_port, 'zope_web',
with_timerservice=True,
zodb_configuration_string=zodb_configuration_string,
tidstorage_config=tidstorage_config,
thread_amount=10, )]
web_haproxy = self.installHaproxy(ip, 15002, 'web', site_check_path,
web_url_list)
apache_web = self.installBackendApache(self.getGlobalIPv6Address(), 15001,
web_haproxy, backend_key, backend_certificate, suffix='_web',
access_control_string=access_control_string)
apache_public_web = self.installPublicBackendApache(
self.getGlobalIPv6Address(), 15080,
web_haproxy, suffix='_public_web',
access_control_string=access_control_string)
# One Admin Node
zope_port += 1
admin_url_list = [self.installZope(ip, zope_port, 'zope_admin',
with_timerservice=True,
zodb_configuration_string=zodb_configuration_string,
tidstorage_config=tidstorage_config,
)]
admin_haproxy = self.installHaproxy(ip, 15003, 'admin', site_check_path,
admin_url_list)
apache_admin = self.installBackendApache(self.getGlobalIPv6Address(), 15002,
admin_haproxy, backend_key, backend_certificate, suffix='_admin',
access_control_string=access_control_string)
self.installTidStorage(tidstorage_config['host'], tidstorage_config['port'],
known_tid_storage_identifier_dict, 'http://'+login_haproxy)
apache_login = self.installBackendApache(self.getGlobalIPv6Address(), 15000,
login_haproxy, backend_key, backend_certificate, suffix='_user',
access_control_string=access_control_string)
memcached_conf = self.installMemcached(ip=self.getLocalIPv4Address(),
port=11000)
kumo_conf = self.installKumo(self.getLocalIPv4Address())
self.setConnectionDict(dict(
site_web_url=apache_web,
public_site_web_url=apache_public_web,
site_admin_url=apache_admin,
site_user_url=apache_login,
site_user=user,
site_password=password,
memcached_url=memcached_conf['memcached_url'],
kumo_url=kumo_conf['kumo_address'],
conversion_server_url='%(conversion_server_ip)s:%(conversion_server_port)s' %
conversion_server_conf,
# openssl binary might be removed, as soon as CP environment will be
# fully controlled
openssl_binary=self.options['openssl_binary'],
# As soon as there would be Vifib ERP5 configuration and possibility to
# call it over the network this can be removed
certificate_authority_path=ca_conf['certificate_authority_path'],
))
return self.path_list
def installProductionFrontend(self): def installProductionFrontend(self):
frontend_key, frontend_certificate = self.requestCertificate( frontend_key, frontend_certificate = self.requestCertificate(
self.parameter_dict['frontend_name']) self.parameter_dict['frontend_name'])
...@@ -344,54 +183,6 @@ class Recipe(slapos.recipe.erp5.Recipe): ...@@ -344,54 +183,6 @@ class Recipe(slapos.recipe.erp5.Recipe):
self.logger.debug('Created link %r -> %r' % (link, target)) self.logger.debug('Created link %r -> %r' % (link, target))
self.path_list.append(repo_path) self.path_list.append(repo_path)
def installPublicBackendApache(self, ip, port, backend,
suffix='', access_control_string=None):
apache_conf = self._getApacheConfigurationDict(
'public_backend_apache'+suffix, ip, port)
apache_conf['server_name'] = '%s' % apache_conf['ip']
# no ssl needed
prefix = 'public_backend_apache'+suffix
rewrite_rule_template = \
"RewriteRule (.*) http://%(backend)s$1 [L,P]"
if access_control_string is None:
path_template = pkg_resources.resource_string('slapos.recipe.erp5',
'template/apache.zope.conf.path.in')
path = path_template % dict(path='/')
else:
path_template = pkg_resources.resource_string('slapos.recipe.erp5',
'template/apache.zope.conf.path-protected.in')
path = path_template % dict(path='/',
access_control_string=access_control_string)
d = dict(
path=path,
backend=backend,
backend_path='/',
port=apache_conf['port'],
vhname=path.replace('/', ''),
)
rewrite_rule = rewrite_rule_template % d
apache_conf.update(**dict(
path_enable=path,
rewrite_rule=rewrite_rule
))
apache_conf_string = pkg_resources.resource_string('slapos.recipe.bef_erp5',
'template/apache.public.zope.conf.in') % apache_conf
apache_config_file = self.createConfigurationFile(prefix + '.conf',
apache_conf_string)
self.path_list.append(apache_config_file)
self.path_list.extend(zc.buildout.easy_install.scripts([(
'public_backend_apache'+suffix,
'slapos.recipe.erp5' + '.apache', 'runApache')], self.ws,
sys.executable, self.wrapper_directory, arguments=[
dict(
required_path_list=[],
binary=self.options['httpd_binary'],
config=apache_config_file
)
]))
# Note: IPv6 is assumed always
return 'https://[%(ip)s]:%(port)s' % apache_conf
def _install(self): def _install(self):
self.path_list = [] self.path_list = []
self.requirements, self.ws = self.egg.working_set() self.requirements, self.ws = self.egg.working_set()
......
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