Commit 8b485dc7 authored by Łukasz Nowak's avatar Łukasz Nowak

Switch cloudooo instantiation to a profile based.

parent 0978df85
...@@ -49,6 +49,7 @@ setup(name=name, ...@@ -49,6 +49,7 @@ setup(name=name,
'erp5 = slapos.recipe.erp5:Recipe', 'erp5 = slapos.recipe.erp5:Recipe',
'erp5testnode = slapos.recipe.erp5testnode:Recipe', 'erp5testnode = slapos.recipe.erp5testnode:Recipe',
'helloworld = slapos.recipe.helloworld:Recipe', 'helloworld = slapos.recipe.helloworld:Recipe',
'generic.cloudooo = slapos.recipe.generic-cloudooo:Recipe',
'java = slapos.recipe.java:Recipe', 'java = slapos.recipe.java:Recipe',
'kumofs = slapos.recipe.kumofs:Recipe', 'kumofs = slapos.recipe.kumofs:Recipe',
'generic.kumofs = slapos.recipe.generic-kumofs:Recipe', 'generic.kumofs = slapos.recipe.generic-kumofs:Recipe',
......
...@@ -67,8 +67,8 @@ class Recipe(BaseSlapRecipe): ...@@ -67,8 +67,8 @@ class Recipe(BaseSlapRecipe):
# memcached_conf = self.installMemcached(ip=self.getLocalIPv4Address(), # memcached_conf = self.installMemcached(ip=self.getLocalIPv4Address(),
# port=11000) # port=11000)
# kumo_conf = self.installKumo(self.getLocalIPv4Address()) # kumo_conf = self.installKumo(self.getLocalIPv4Address())
conversion_server_conf = self.installConversionServer( # conversion_server_conf = self.installConversionServer(
self.getLocalIPv4Address(), 23000, 23060) # self.getLocalIPv4Address(), 23000, 23060)
mysql_conf = self.installMysqlServer(self.getLocalIPv4Address(), 45678) mysql_conf = self.installMysqlServer(self.getLocalIPv4Address(), 45678)
user, password = self.installERP5() user, password = self.installERP5()
...@@ -569,40 +569,6 @@ SSLCARevocationPath %(ca_crl)s""" ...@@ -569,40 +569,6 @@ SSLCARevocationPath %(ca_crl)s"""
certificate_authority_path=config['ca_dir'] certificate_authority_path=config['ca_dir']
) )
def installConversionServer(self, ip, port, openoffice_port):
name = 'conversion_server'
working_directory = self.createDataDirectory(name)
conversion_server_dict = dict(
working_path=working_directory,
uno_path=self.options['ooo_uno_path'],
office_binary_path=self.options['ooo_binary_path'],
ip=ip,
port=port,
openoffice_port=openoffice_port,
)
for env_line in self.options['environment'].splitlines():
env_line = env_line.strip()
if not env_line:
continue
if '=' in env_line:
env_key, env_value = env_line.split('=')
conversion_server_dict[env_key.strip()] = env_value.strip()
else:
raise zc.buildout.UserError('Line %r in environment parameter is '
'incorrect' % env_line)
config_file = self.createConfigurationFile(name + '.cfg',
self.substituteTemplate(self.getTemplateFilename('cloudooo.cfg.in'),
conversion_server_dict))
self.path_list.append(config_file)
self.path_list.extend(zc.buildout.easy_install.scripts([(name,
'slapos.recipe.librecipe.execute', 'execute_with_signal_translation')], self.ws,
sys.executable, self.wrapper_directory,
arguments=[self.options['ooo_paster'].strip(), 'serve', config_file]))
return {
name + '_port': conversion_server_dict['port'],
name + '_ip': conversion_server_dict['ip']
}
def installHaproxy(self, ip, port, name, server_check_path, url_list): def installHaproxy(self, ip, port, name, server_check_path, url_list):
# inter must be quite short in order to detect quickly an unresponsive node # inter must be quite short in order to detect quickly an unresponsive node
# and to detect quickly a node which is back # and to detect quickly a node which is back
......
##############################################################################
#
# 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 zc.buildout
from slapos.recipe.librecipe import GenericBaseRecipe
class Recipe(GenericBaseRecipe):
def install(self):
path_list = []
conversion_server_dict = dict(
working_path=self.optios['cloudooo-data'],
uno_path=self.options['ooo-uno-path'],
office_binary_path=self.options['ooo-binary-path'],
ip=self.options['ip'],
port=int(self.options['port']),
openoffice_port=int(self.options['openoffice_port']),
)
for env_line in self.options['environment'].splitlines():
env_line = env_line.strip()
if not env_line:
continue
if '=' in env_line:
env_key, env_value = env_line.split('=')
conversion_server_dict[env_key.strip()] = env_value.strip()
else:
raise zc.buildout.UserError('Line %r in environment parameter is '
'incorrect' % env_line)
config_file = self.createFile(self.options['configuration-file'],
self.substituteTemplate(self.getTemplateFilename('cloudooo.cfg.in'),
conversion_server_dict))
path_list.append(config_file)
path_list.append(self.createPythonScript(self.options['wrapper'],
'slapos.recipe.librecipe.execute.execute_with_signal_translation',
[self.options['ooo-paster'].strip(), 'serve', config_file]))
return path_list
[buildout]
parts =
publish-cloudooo-connection-information
cloudooo-instance
eggs-directory = ${buildout:eggs-directory}
develop-eggs-directory = ${buildout:develop-eggs-directory}
offline = true
[publish-cloudooo-connection-information]
recipe = slapos.cookbook:publishurl
url = cloudooo://$${cloudooo:ip}:$${cloudooo:port}/
[cloudooo-instance]
recipe = slapos.cookbook:generic.cloudooo
# Network options
ip = $${slap-network-information:local-ipv4}
port = 23000
openoffice-port = 23060
# Paths
configuration-file = $${basedirectory:etc}/cloudooo.cfg
wrapper = $${basedirectory:services}/cloudooo
# Paths: Data
data-directory = $${directory:cloudooo-data}
environment =
LD_LIBRARY_PATH = ${file:location}/lib:${fontconfig:location}/lib:${freetype:location}/lib:${libICE:location}/lib:${libSM:location}/lib:${libX11:location}/lib:${libXau:location}/lib:${libXdmcp:location}/lib:${libXext:location}/lib:${libXinerama:location}/lib:${libxcb:location}/lib:${zlib:location}/lib
# Binary information
# cloudooo specific configuration
ooo-binary-path = ${libreoffice-bin:location}/program
ooo-paster = ${buildout:bin-directory}/cloudooo_paster
ooo-uno-path = ${libreoffice-bin:location}/basis-link/program
# rest of parts are candidates for some generic stuff
[basedirectory]
recipe = slapos.cookbook:mkdirectory
log = $${rootdirectory:var}/log/
services = $${rootdirectory:etc}/run/
run = $${rootdirectory:var}/run/
[directory]
recipe = slapos.cookbook:mkdirectory
cloudooo-data = $${rootdirectory:srv}/cloudooo
[rootdirectory]
recipe = slapos.cookbook:mkdirectory
etc = $${buildout:directory}/etc/
var = $${buildout:directory}/var/
srv = $${buildout:directory}/srv/
bin = $${buildout:directory}/bin/
...@@ -39,11 +39,6 @@ mk-error-log_binary = ${perl:siteprefix}/bin/mk-error-log ...@@ -39,11 +39,6 @@ mk-error-log_binary = ${perl:siteprefix}/bin/mk-error-log
mk-index-usage_binary = ${perl:siteprefix}/bin/mk-index-usage mk-index-usage_binary = ${perl:siteprefix}/bin/mk-index-usage
mk-query-advisor_binary = ${perl:siteprefix}/bin/mk-query-advisor mk-query-advisor_binary = ${perl:siteprefix}/bin/mk-query-advisor
# cloudooo specific configuration
ooo_binary_path = ${libreoffice-bin:location}/program
ooo_paster = ${buildout:bin-directory}/cloudooo_paster
ooo_uno_path = ${libreoffice-bin:location}/basis-link/program
link_binary_list = link_binary_list =
${coreutils:location}/bin/basename ${coreutils:location}/bin/basename
${coreutils:location}/bin/cat ${coreutils:location}/bin/cat
...@@ -90,4 +85,4 @@ offline = true ...@@ -90,4 +85,4 @@ offline = true
recipe = slapos.cookbook:softwaretype recipe = slapos.cookbook:softwaretype
kumofs = ${template-kumofs:output} kumofs = ${template-kumofs:output}
memcached = ${template-memcached:output} memcached = ${template-memcached:output}
cloudooo = ${template-cloudooo:output}
...@@ -9,6 +9,7 @@ parts += ...@@ -9,6 +9,7 @@ parts +=
# Create instance template # Create instance template
template-memcached template-memcached
template-kumofs template-kumofs
template-cloudooo
template template
validator validator
...@@ -17,6 +18,13 @@ parts += ...@@ -17,6 +18,13 @@ parts +=
# development / fast switching environment for whole software # development / fast switching environment for whole software
unzip = true unzip = true
[template-cloudooo]
recipe = slapos.recipe.template
url = ${:_profile_base_location_}/instance-cloudooo.cfg
md5sum = c297075209459d62942a30181795ada2
output = ${buildout:directory}/template-cloudooo.cfg
mode = 0644
[template-kumofs] [template-kumofs]
recipe = slapos.recipe.template recipe = slapos.recipe.template
url = ${:_profile_base_location_}/instance-kumofs.cfg url = ${:_profile_base_location_}/instance-kumofs.cfg
......
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