Commit ca34ed84 authored by Łukasz Nowak's avatar Łukasz Nowak

WIP of profile based erp5 update

parent ae4a5d25
......@@ -90,6 +90,7 @@ setup(name=name,
'generic.zope.zeo.client = slapos.recipe.generic_zope_zeo_client:Recipe',
'generate.erp5.tidstorage = slapos.recipe.generate_erp5_tidstorage:Recipe',
'zeo = slapos.recipe.zeo:Recipe',
'tidstorage = slapos.recipe.tidstorage:Recipe'
'tidstorage = slapos.recipe.tidstorage:Recipe',
'erp5.update = slapos.recipe.erp5_update:Recipe'
]},
)
......@@ -535,57 +535,6 @@ SSLCARevocationPath %(ca_crl)s"""
certificate_authority_path=config['ca_dir']
)
def installERP5Site(self, user, password, zope_access, mysql_conf,
conversion_server_conf=None, memcached_conf=None,
kumo_conf=None,
erp5_site_id='erp5', default_bt5_list=[], ca_conf={},
supervisor_controlled=True):
"""
Create a script to automatically set up an erp5 site (controlled by
supervisor by default) on available zope and mysql environments.
"""
conversion_server = None
if conversion_server_conf is not None:
conversion_server = "%s:%s" % (conversion_server_conf['conversion_server_ip'],
conversion_server_conf['conversion_server_port'])
if memcached_conf is None:
memcached_conf = {}
if kumo_conf is None:
kumo_conf = {}
# XXX Conversion server and memcache server coordinates are not relevant
# for pure site creation.
assert mysql_conf['mysql_user'] and mysql_conf['mysql_password'], \
"ZMySQLDA requires a user and a password for socket connections"
# XXX Use socket access to prevent unwanted connections to original MySQL
# server when cloning an existing ERP5 instance.
# TCP will be required if MySQL is in a different partition/server.
mysql_connection_string = "%(mysql_database)s %(mysql_user)s %(mysql_password)s %(socket)s" % mysql_conf
bt5_list = self.parameter_dict.get("bt5_list", "").split() or default_bt5_list
bt5_repository_list = self.parameter_dict.get("bt5_repository_list", "").split() \
or getattr(self, 'bt5_repository_list', [])
erp5_update_directory = supervisor_controlled and self.wrapper_directory or \
self.bin_directory
script = zc.buildout.easy_install.scripts([('erp5_update',
__name__ + '.erp5', 'updateERP5')], self.ws,
sys.executable, erp5_update_directory,
arguments=[erp5_site_id,
mysql_connection_string,
[user, password, zope_access],
memcached_conf.get('memcached_url'),
conversion_server,
kumo_conf.get("kumo_address"),
bt5_list,
bt5_repository_list,
ca_conf.get('certificate_authority_path'),
self.options.get('openssl_binary')])
self.path_list.extend(script)
return []
def installZeo(self, ip):
# zodb_dir = os.path.join(self.data_root_directory, 'zodb')
# self._createDirectory(zodb_dir)
......
##############################################################################
#
# Copyright (c) 2011 Vifib SARL and Contributors. All Rights Reserved.
#
# WARNING: This program as such is intended to be used by professional
# programmers who take the whole responsibility of assessing all potential
# consequences resulting from its eventual inadequacies and bugs
# End users who are looking for a ready-to-use solution with commercial
# guarantees and support are strongly adviced to contract a Free Software
# Service Company
#
# This program is Free Software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 3
# of the License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#
##############################################################################
import os
import urlparse
from slapos.recipe.librecipe import GenericBaseRecipe
class Recipe(GenericBaseRecipe):
def install(self):
# def installERP5Site(self, user, password, zope_access, mysql_conf,
# conversion_server_conf=None, memcached_conf=None,
# kumo_conf=None,
# erp5_site_id='erp5', default_bt5_list=[], ca_conf={},
# supervisor_controlled=True):
# """
# Create a script to automatically set up an erp5 site (controlled by
# supervisor by default) on available zope and mysql environments.
# """
conversion_server = None
if 'cloudooo-url' in self.options and self.options['cloudooo-url']:
parsed = urlparse.urlparse(self.options['cloudooo-url'])
conversion_server = "%s:%s" % (parsed.hostname, parsed.port)
memcached = None
if 'memcached-url' in self.options and self.options['memcached-url']:
parsed = urlparse.urlparse(self.options['memcached-url'])
memcached = "%s:%s" % (parsed.hostname, parsed.port)
kumofs = None
if 'kumofs-url' in self.options and self.options['kumofs-url']:
parsed = urlparse.urlparse(self.options['kumofs-url'])
kumofs = "%s:%s" % (parsed.hostname, parsed.port)
parsed = urlparse.urlparse(self.options['mysql-url'])
mysql_connection_string = "%(database)s %(hostname)s@%(port)s %(username)s %(password)s" % dict(
database=parsed.path.split('/')[1],
hostname=parsed.hostname,
port=parsed.port,
username=parsed.username,
password=parsed.password
)
raise NotImplementedError
bt5_list = self.parameter_dict.get("bt5_list", "").split() or default_bt5_list
bt5_repository_list = self.parameter_dict.get("bt5_repository_list", "").split() \
or getattr(self, 'bt5_repository_list', [])
erp5_update_directory = supervisor_controlled and self.wrapper_directory or \
self.bin_directory
script = zc.buildout.easy_install.scripts([('erp5_update',
__name__ + '.erp5', 'updateERP5')], self.ws,
sys.executable, erp5_update_directory,
arguments=[erp5_site_id,
mysql_connection_string,
[user, password, zope_access],
memcached,
conversion_server,
kumofs,
bt5_list,
bt5_repository_list,
ca_conf.get('certificate_authority_path'),
self.options.get('openssl_binary')])
self.path_list.extend(script)
return []
......@@ -16,6 +16,7 @@ parts =
cron
cron-entry-logrotate
certificate-authority
erp5-certificate-authority
tidstorage
cron-entry-tidstorage-backup
logrotate-entry-tidstorage
......@@ -108,6 +109,25 @@ recipe = slapos.cookbook:zeo
ip = $${slap-network-information:local-ipv4}
binary-path = ${buildout:bin-directory}/runzeo
[erp5-certificate-authority]
recipe = slapos.cookbook:certificate_authority
openssl-binary = ${openssl:location}/bin/openssl
ca-dir = $${directory:erp5-ca-dir}
requests-directory = $${erp5-cadirectory:requests}
wrapper = $${basedirectory:services}/erp5-ca
ca-private = $${erp5-cadirectory:private}
ca-certs = $${erp5-cadirectory:certs}
ca-newcerts = $${erp5-cadirectory:newcerts}
ca-crl = $${erp5-cadirectory:crl}
[erp5-cadirectory]
recipe = slapos.cookbook:mkdirectory
requests = $${directory:erp5-ca-dir}/requests/
private = $${directory:erp5-ca-dir}/private/
certs = $${directory:erp5-ca-dir}/certs/
newcerts = $${directory:erp5-ca-dir}/newcerts/
crl = $${directory:erp5-ca-dir}/crl/
[certificate-authority]
recipe = slapos.cookbook:certificate_authority
openssl-binary = ${openssl:location}/bin/openssl
......@@ -160,6 +180,7 @@ instance-constraint = $${:instance}/Constraint
instance-import = $${:instance}/import
instance-lib = $${:instance}/lib
instance-tests = $${:instance}/tests
erp5-ca-dir = $${rootdirectory:srv}/erp5-ssl/
ca-dir = $${rootdirectory:srv}/ssl/
cron-entries = $${rootdirectory:etc}/cron.d/
crontabs = $${rootdirectory:etc}/crontabs/
......@@ -202,3 +223,4 @@ memcached-url = %(memcached-url)s
cloudooo-url = %(cloudooo-url)s
site-id = %(site_id)s
openssl-binary = ${openssl:location}/bin/openssl
cadir-path = $${erp5-certificate-authority:ca-dir}
......@@ -88,7 +88,7 @@ mode = 0644
[template-snippet-master]
recipe = slapos.recipe.template
url = ${:_profile_base_location_}/snippet-master.cfg
md5sum = 7a4478ece1356918f37f4c98774b850b
md5sum = 538d6e58a1ac78a10084b78c90a3a98b
output = ${buildout:directory}/template-snippet-master.cfg
mode = 0644
......
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