Commit 5f28dac0 authored by Łukasz Nowak's avatar Łukasz Nowak

- configure apache and switch it to backend


git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@44111 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 8e3dcb33
...@@ -134,8 +134,12 @@ class Recipe(BaseSlapRecipe): ...@@ -134,8 +134,12 @@ class Recipe(BaseSlapRecipe):
url_list.append(self.installZope(ip=self.getLocalIPv4Address(), url_list.append(self.installZope(ip=self.getLocalIPv4Address(),
port=12000 + 1, name='zope_%s' % 1, zodb_root_path=CONFIG['zodb_root_path'])) port=12000 + 1, name='zope_%s' % 1, zodb_root_path=CONFIG['zodb_root_path']))
self.installHaproxy(ip=self.getGlobalIPv6Address(), port='15000', self.connection_dict.update(
name='login', url_list=login_list) haproxy_login=self.installHaproxy(
ip=self.getGlobalIPv6Address(), port='15000', name='login', url_list=login_list))
self.connection_dict.update(
apache_login=self.installLoginApache(ip=self.getGlobalIPv6Address(), port=13000,
backend=self.connection_dict['haproxy_login']))
self.installTestRunner() self.installTestRunner()
self.linkBinary() self.linkBinary()
self.computer_partition.setConnectionDict(self.connection_dict) self.computer_partition.setConnectionDict(self.connection_dict)
...@@ -364,6 +368,7 @@ class Recipe(BaseSlapRecipe): ...@@ -364,6 +368,7 @@ class Recipe(BaseSlapRecipe):
self.options['haproxy_binary'].strip(), '-f', haproxy_conf_path] self.options['haproxy_binary'].strip(), '-f', haproxy_conf_path]
)[0] )[0]
self.path_list.append(wrapper) self.path_list.append(wrapper)
return '%s:%s' % (ip, port)
def installERP5(self): def installERP5(self):
""" """
...@@ -498,16 +503,15 @@ class Recipe(BaseSlapRecipe): ...@@ -498,16 +503,15 @@ class Recipe(BaseSlapRecipe):
prefix + '-access.log') prefix + '-access.log')
return apache_conf return apache_conf
def _writeApacheConfiguration(self, prefix, apache_conf): def _writeApacheConfiguration(self, prefix, apache_conf, backend):
rewrite_rule_template = \ rewrite_rule_template = \
"RewriteRule (.*) http://%(backend_ip)s:%(backend_port)s$1 [L,P]" "RewriteRule (.*) http://%(backend)s$1 [L,P]"
path_template = pkg_resources.resource_string(__name__, path_template = pkg_resources.resource_string(__name__,
'template/apache.zope.conf.path.in') 'template/apache.zope.conf.path.in')
path = path_template % dict(path='/') path = path_template % dict(path='/')
d = dict( d = dict(
path=path, path=path,
backend_ip=self.backend_ip, backend=backend,
backend_port=self.backend_port,
backend_path='/', backend_path='/',
port=apache_conf['port'], port=apache_conf['port'],
vhname=path.replace('/', ''), vhname=path.replace('/', ''),
...@@ -521,22 +525,21 @@ class Recipe(BaseSlapRecipe): ...@@ -521,22 +525,21 @@ class Recipe(BaseSlapRecipe):
pkg_resources.resource_string(__name__, pkg_resources.resource_string(__name__,
'template/apache.zope.conf.in') % apache_conf) 'template/apache.zope.conf.in') % apache_conf)
def installLoginApache(self, index): def installLoginApache(self, ip, port, backend):
ssl_template = """SSLEngine on ssl_template = """SSLEngine on
SSLCertificateFile %(login_certificate)s SSLCertificateFile %(login_certificate)s
SSLCertificateKeyFile %(login_key)s SSLCertificateKeyFile %(login_key)s
SSLRandomSeed startup builtin SSLRandomSeed startup builtin
SSLRandomSeed connect builtin SSLRandomSeed connect builtin
""" """
apache_conf = self._getApacheConfigurationDict('login_apache_%s' % index, apache_conf = self._getApacheConfigurationDict('login_apache', ip, port)
self.getLocalIPv4Address(), CONFIG['login_apache_port_base'] + index)
apache_conf['server_name'] = '%s' % apache_conf['ip'] apache_conf['server_name'] = '%s' % apache_conf['ip']
apache_conf['ssl_snippet'] = ssl_template % CONFIG apache_conf['ssl_snippet'] = ssl_template % CONFIG
apache_config_file = self._writeApacheConfiguration('login_apache_%s' % \ apache_config_file = self._writeApacheConfiguration('login_apache',
index, apache_conf) apache_conf, backend)
self.path_list.append(apache_config_file) self.path_list.append(apache_config_file)
self.path_list.extend(zc.buildout.easy_install.scripts([( self.path_list.extend(zc.buildout.easy_install.scripts([(
'login_apache_%s' % index, 'login_apache',
__name__ + '.apache', 'runApache')], self.ws, __name__ + '.apache', 'runApache')], self.ws,
sys.executable, self.wrapper_directory, arguments=[ sys.executable, self.wrapper_directory, arguments=[
dict( dict(
...@@ -546,7 +549,7 @@ SSLRandomSeed connect builtin ...@@ -546,7 +549,7 @@ SSLRandomSeed connect builtin
config=apache_config_file config=apache_config_file
) )
])) ]))
self.connection_dict['login_%s' % index] = '%(ip)s:%(port)s' % apache_conf return 'https://%(ip)s:%(port)s' % apache_conf
def installKeyAuthorisationApache(self, index): def installKeyAuthorisationApache(self, index):
ssl_template = """SSLEngine on ssl_template = """SSLEngine on
......
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