Commit 82441c4c authored by Łukasz Nowak's avatar Łukasz Nowak

- merge instance and site creation in one step

Work in progress.

Zope and site are controlled by common set of parameters. It is understood that
Zeo will behave slightly different but in case of standalone instance it is
better to not have two different steps to do one thing. Zeo support shall be
plugged between creation of instance and site itself.



git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@32510 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent c3620ed3
...@@ -8,14 +8,15 @@ parts += ...@@ -8,14 +8,15 @@ parts +=
products-other products-other
products-erp5 products-erp5
zope-instance zope-instance
create_erp5_site
# use locally developed recipe # use locally developed recipe
develop = recipes/erp5.recipe.standaloneinstance
[zope-instance] [zope-instance]
recipe = erp5.recipe.standaloneinstance recipe = erp5.recipe.standaloneinstance
zope2-location = ${software_definition:zope_software}
debug-mode = on
location = ${buildout:var-directory}/zope-instance location = ${buildout:var-directory}/zope-instance
eggs += eggs +=
ipdb ipdb
pysvn pysvn
...@@ -31,7 +32,6 @@ products = ...@@ -31,7 +32,6 @@ products =
${products-other:location} ${products-other:location}
${products-development:location} ${products-development:location}
[create_erp5_site]
# modify this to reflect your local mysql configuration # modify this to reflect your local mysql configuration
# Format: # Format:
# database[@host[:port]] [user [password [unix_socket]]] # database[@host[:port]] [user [password [unix_socket]]]
...@@ -39,11 +39,10 @@ products = ...@@ -39,11 +39,10 @@ products =
mysql_database_name = development_site mysql_database_name = development_site
erp5_sql_connection_string = ${:mysql_database_name}@${configuration:mysql_host}:${configuration:mysql_port} root erp5_sql_connection_string = ${:mysql_database_name}@${configuration:mysql_host}:${configuration:mysql_port} root
bt5-path = ${bt5-erp5:location}
bt5 = bt5 =
erp5_base erp5_base
erp5_forge erp5_forge
# for now override control script
control-script = ${zope-instance:location}/bin/zopectl
[requirements] [requirements]
binary += binary +=
......
...@@ -32,6 +32,7 @@ setup( ...@@ -32,6 +32,7 @@ setup(
namespace_packages = ['erp5', 'erp5.recipe'], namespace_packages = ['erp5', 'erp5.recipe'],
install_requires = [ install_requires = [
'erp5.recipe.zope2instance', 'erp5.recipe.zope2instance',
'erp5.recipe.createsite',
], ],
zip_safe=False, zip_safe=False,
entry_points = {'zc.buildout': ['default = %s:Recipe' % name]}, entry_points = {'zc.buildout': ['default = %s:Recipe' % name]},
......
...@@ -2,16 +2,20 @@ ...@@ -2,16 +2,20 @@
import os import os
import zc.buildout import zc.buildout
import erp5.recipe.zope2instance import erp5.recipe.zope2instance
import erp5.recipe.createsite
class Recipe(erp5.recipe.zope2instance.Recipe): class Recipe(erp5.recipe.zope2instance.Recipe, erp5.recipe.createsite.Recipe):
def __init__(self, buildout, name, options): def __init__(self, buildout, name, options):
standalone_location = options.get('location')
if not standalone_location:
raise zc.buildout.UserError('Location have to be specified')
options['control-script'] = options.get('control-script',
os.path.join(standalone_location, 'bin', 'zopectl'))
erp5.recipe.createsite.Recipe.__init__(self, buildout, name, options)
self.egg = zc.recipe.egg.Egg(buildout, options['recipe'], options) self.egg = zc.recipe.egg.Egg(buildout, options['recipe'], options)
self.buildout, self.options, self.name = buildout, options, name self.buildout, self.options, self.name = buildout, options, name
self.zope2_location = options.get('zope2-location', '') self.zope2_location = options.get('zope2-location', '')
standalone_location = options.get('location')
if not standalone_location:
raise zc.buildout.UserError('Location have to be specified')
options['bin-directory'] = os.path.join(standalone_location, 'bin') options['bin-directory'] = os.path.join(standalone_location, 'bin')
options['scripts'] = '' # suppress script generation. options['scripts'] = '' # suppress script generation.
options['file-storage'] = options.get('file-storage', options['file-storage'] = options.get('file-storage',
...@@ -30,10 +34,17 @@ class Recipe(erp5.recipe.zope2instance.Recipe): ...@@ -30,10 +34,17 @@ class Recipe(erp5.recipe.zope2instance.Recipe):
assert relative_paths == 'false' assert relative_paths == 'false'
def install(self): def install(self):
# initalise zope instance
erp5.recipe.zope2instance.Recipe.install(self) erp5.recipe.zope2instance.Recipe.install(self)
# initialise ERP5 part
erp5.recipe.createsite.Recipe.install(self)
# we return nothing, as this is totally standalone installation # we return nothing, as this is totally standalone installation
return [] return []
def build_zope_conf(self): def build_zope_conf(self):
# preparation for further fixing (chroot everything inside instance, etc) # preparation for further fixing (chroot everything inside instance, etc)
erp5.recipe.zope2instance.Recipe.build_zope_conf(self) erp5.recipe.zope2instance.Recipe.build_zope_conf(self)
def update(self):
return erp5.recipe.zope2instance.Recipe.update(self)
# adapt https://svn.erp5.org/repos/public/experimental/erp5.buildout # adapt https://svn.erp5.org/repos/public/experimental/erp5.buildout
[buildout]
develop = recipes/erp5.recipe.standaloneinstance
parts = zope-instance
[zope-instance] [zope-instance]
recipe = erp5.recipe.zope2instance depends = ${create_mysql_database:command}
recipe = erp5.recipe.standaloneinstance
zope2-location = ${software_definition:zope_software} zope2-location = ${software_definition:zope_software}
user = zope:zope user = zope:zope
http-address = 18080 http-address = 18080
debug-mode = off debug-mode = off
control-script = zopectl
#Only for zope2.8 #Only for zope2.8
default-zpublisher-encoding = default-zpublisher-encoding =
zope-conf-additional= zope-conf-additional=
...@@ -36,20 +40,15 @@ products = ...@@ -36,20 +40,15 @@ products =
${products-erp5:location} ${products-erp5:location}
${products-other:location} ${products-other:location}
portal_id = erp5
bt5-path = ${bt5-erp5:location}
bt5 =
[create_mysql_database] [create_mysql_database]
# XXX: This have to be converted into recipe # XXX: This have to be converted into recipe
recipe = plone.recipe.command recipe = plone.recipe.command
command = command =
echo "CREATE DATABASE IF NOT EXISTS ${create_erp5_site:mysql_database_name} DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci" | ${buildout:data-bin-directory}/mysql -u root echo "CREATE DATABASE IF NOT EXISTS ${zope-instance:mysql_database_name} DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci" | ${buildout:data-bin-directory}/mysql -u root
[create_erp5_site]
depends = ${create_mysql_database:command}
recipe = erp5.recipe.createsite
portal_id = erp5
control-script = ${zope-instance:control-script}
user = ${zope-instance:user}
bt5-path = ${bt5-erp5:location}
bt5 =
[bt5list] [bt5list]
recipe = erp5.recipe.genbt5list recipe = erp5.recipe.genbt5list
......
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