Commit b3edaef2 authored by Jérome Perrin's avatar Jérome Perrin

ERP5: set $TMPDIR for zeo

See merge request !1640
parents 618d96ca bcc64932
Pipeline #36800 failed with stage
in 0 seconds
...@@ -165,7 +165,6 @@ setup(name=name, ...@@ -165,7 +165,6 @@ setup(name=name,
'userinfo = slapos.recipe.userinfo:Recipe', 'userinfo = slapos.recipe.userinfo:Recipe',
'wrapper = slapos.recipe.wrapper:Recipe', 'wrapper = slapos.recipe.wrapper:Recipe',
'zabbixagent = slapos.recipe.zabbixagent:Recipe', 'zabbixagent = slapos.recipe.zabbixagent:Recipe',
'zeo = slapos.recipe.zeo:Recipe',
'zero-knowledge.read = slapos.recipe.zero_knowledge:ReadRecipe', 'zero-knowledge.read = slapos.recipe.zero_knowledge:ReadRecipe',
'zero-knowledge.write = slapos.recipe.zero_knowledge:WriteRecipe' 'zero-knowledge.write = slapos.recipe.zero_knowledge:WriteRecipe'
], ],
......
##############################################################################
#
# 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.
#
##############################################################################
from slapos.recipe.librecipe import GenericBaseRecipe
import os
class Recipe(GenericBaseRecipe):
"""
ZEO instance configuration.
wrapper-path -- location of the init script to generate
binary-path -- location of the runzeo command
ip -- ip of the zeo server
port -- port of the zeo server
log-path -- location of the log file
pid-path -- location of the pid file
conf-path -- location of the configuration file
zodb-path -- location of the zodb directory (which contains all storage)
storage -- string with list of all resquested storage
Example: event_module person_module
"""
def install(self):
snippet_filename = self.getTemplateFilename(
'zeo-filestorage-snippet.conf.in')
# Prepare all filestorages
filestorage_snippet = ""
storage = self.options['storage']
if isinstance(storage, str):
for storage_definition in storage.splitlines():
storage_definition = storage_definition.strip()
if not storage_definition:
continue
for q in storage_definition.split():
if 'storage-name' in q:
storage_name = q.split('=')[1].strip()
if 'zodb-path' in q:
zodb_path = q.split('=')[1].strip()
filestorage_snippet += self.substituteTemplate(
snippet_filename, dict(storage_name=storage_name, path=zodb_path))
else:
for storage_name, path in storage:
filestorage_snippet += self.substituteTemplate(snippet_filename,
{'storage_name': storage_name, 'path': path})
config = dict(
zeo_ip=self.options['ip'],
zeo_port=self.options['port'],
zeo_event_log=self.options['log-path'],
zeo_pid=self.options['pid-path'],
zeo_filestorage_snippet=filestorage_snippet,
)
# Create configuration file
template_filename = self.getTemplateFilename('zeo.conf.in')
configuration_path = self.createFile(
self.options['conf-path'],
self.substituteTemplate(template_filename, config))
# Create running wrapper
wrapper_path = self.createWrapper(
self.options['wrapper-path'],
(self.options['binary-path'].strip(),
'-C', self.options['conf-path']))
return [configuration_path, wrapper_path]
<filestorage %(storage_name)s>
path %(path)s
# pack-gc false
</filestorage>
# ZEO configuration file generated by SlapOS
<zeo>
address %(zeo_ip)s:%(zeo_port)s
pid-filename %(zeo_pid)s
</zeo>
%(zeo_filestorage_snippet)s
<eventlog>
<logfile>
dateformat
path %(zeo_event_log)s
</logfile>
</eventlog>
...@@ -226,6 +226,7 @@ context = ...@@ -226,6 +226,7 @@ context =
key template_postfix_master_cf template-postfix-master-cf:target key template_postfix_master_cf template-postfix-master-cf:target
key instance_wcfs_cfg_in instance-wcfs.cfg.in:target key instance_wcfs_cfg_in instance-wcfs.cfg.in:target
key template_zeo template-zeo:target key template_zeo template-zeo:target
key template_zeo_conf template-zeo-conf:target
key template_zodb_base template-zodb-base:target key template_zodb_base template-zodb-base:target
key template_zope template-zope:target key template_zope template-zope:target
key template_zope_conf template-zope-conf:target key template_zope_conf template-zope-conf:target
...@@ -245,6 +246,9 @@ context = ...@@ -245,6 +246,9 @@ context =
[template-zeo] [template-zeo]
<= download-base <= download-base
[template-zeo-conf]
<= download-base
[template-zodb-base] [template-zodb-base]
<= download-base <= download-base
......
...@@ -70,7 +70,7 @@ md5sum = b95084ae9eed95a68eada45e28ef0c04 ...@@ -70,7 +70,7 @@ md5sum = b95084ae9eed95a68eada45e28ef0c04
[template] [template]
filename = instance.cfg.in filename = instance.cfg.in
md5sum = ca0cb83950dd9079cc289891cce08e76 md5sum = b15425c6e37314c499ad4c0dd52a8212
[template-erp5] [template-erp5]
filename = instance-erp5.cfg.in filename = instance-erp5.cfg.in
...@@ -78,7 +78,11 @@ md5sum = d6f7d2fa1bde019892897c767f93e089 ...@@ -78,7 +78,11 @@ md5sum = d6f7d2fa1bde019892897c767f93e089
[template-zeo] [template-zeo]
filename = instance-zeo.cfg.in filename = instance-zeo.cfg.in
md5sum = a9d42d8b2aee3c329913d46e0e3cd108 md5sum = 3190fb6b2380ffbef40db62e1d4ba4d0
[template-zeo-conf]
filename = zeo.conf.in
md5sum = 9e15886206c5deda35542c98acb42e70
[template-zodb-base] [template-zodb-base]
filename = instance-zodb-base.cfg.in filename = instance-zodb-base.cfg.in
......
...@@ -8,14 +8,6 @@ ...@@ -8,14 +8,6 @@
{% set default_backup_path = buildout_directory ~ '/srv/backup/zodb' -%} {% set default_backup_path = buildout_directory ~ '/srv/backup/zodb' -%}
{% set bin_directory = parameter_dict['buildout-bin-directory'] -%} {% set bin_directory = parameter_dict['buildout-bin-directory'] -%}
[zeo-base]
recipe = slapos.cookbook:zeo
log-path = ${directory:log}/${:base-name}.log
pid-path = ${directory:run}/${:base-name}.pid
conf-path = ${directory:etc}/${:base-name}.conf
wrapper-path = ${directory:services}/${:base-name}
binary-path = {{ bin_directory }}/runzeo
ip = {{ ipv4 }}
{% set known_tid_storage_identifier_dict = {} -%} {% set known_tid_storage_identifier_dict = {} -%}
{% set zodb_dict = {} -%} {% set zodb_dict = {} -%}
...@@ -41,12 +33,33 @@ ip = {{ ipv4 }} ...@@ -41,12 +33,33 @@ ip = {{ ipv4 }}
{% endfor -%} {% endfor -%}
{% set zeo_section_name = 'zeo-' ~ family %} {% set zeo_section_name = 'zeo-' ~ family %}
[{{ zeo_section_name }}] [{{ zeo_section_name ~ "-base" }}]
< = zeo-base
base-name = zeo-{{ family }} base-name = zeo-{{ family }}
log-path = ${directory:log}/${:base-name}.log
pid-path = ${directory:run}/${:base-name}.pid
ip = {{ ipv4 }}
port = {{ current_port }} port = {{ current_port }}
storage = {{ dumps(storage_list) }} storage = {{ dumps(storage_list) }}
[{{ zeo_section_name ~ "-conf" }}]
<= {{ zeo_section_name ~ "-base" }}
recipe = slapos.recipe.template:jinja2
url = {{ parameter_dict['zeo-conf-template'] }}
output = ${directory:etc}/${:base-name}.conf
context =
section parameter_dict ${:_buildout_section_name_}
[{{ zeo_section_name }}]
<= {{ zeo_section_name ~ "-base" }}
recipe = slapos.cookbook:wrapper
base-name = {{ "${" ~ zeo_section_name ~"-conf:base-name}" }}
log-path = {{ "${" ~ zeo_section_name ~"-conf:log-path}" }}
wrapper-path = ${directory:services}/${:base-name}
command-line = {{ bin_directory }}/runzeo -C {{ "${" ~ zeo_section_name ~"-conf:output}" }}
environment =
TMPDIR=${directory:tmp}
TMP=${directory:tmp}
[{{ section("logrotate-" ~ zeo_section_name) }}] [{{ section("logrotate-" ~ zeo_section_name) }}]
< = logrotate-entry-base < = logrotate-entry-base
name = {{ "${" ~ zeo_section_name ~ ":base-name}" }} name = {{ "${" ~ zeo_section_name ~ ":base-name}" }}
...@@ -196,6 +209,7 @@ srv = ${buildout:directory}/srv ...@@ -196,6 +209,7 @@ srv = ${buildout:directory}/srv
var = ${buildout:directory}/var var = ${buildout:directory}/var
log = ${:var}/log log = ${:var}/log
run = ${:var}/run run = ${:var}/run
tmp = ${buildout:directory}/tmp
backup-zodb = {{ default_backup_path }} backup-zodb = {{ default_backup_path }}
zodb = {{ default_zodb_path }} zodb = {{ default_zodb_path }}
tidstorage = {{ tidstorage_repozo_path }} tidstorage = {{ tidstorage_repozo_path }}
......
...@@ -102,6 +102,7 @@ import-list = ...@@ -102,6 +102,7 @@ import-list =
[dynamic-template-zeo-parameters] [dynamic-template-zeo-parameters]
<= default-dynamic-template-parameters <= default-dynamic-template-parameters
zeo-conf-template = {{ template_zeo_conf }}
[dynamic-template-zeo] [dynamic-template-zeo]
<= jinja2-template-base <= jinja2-template-base
......
<zeo>
address {{ parameter_dict['ip'] }}:{{ parameter_dict['port'] }}
pid-filename {{ parameter_dict['pid-path'] }}
</zeo>
{% for (storage_name, storage_path) in parameter_dict['storage'] -%}
<filestorage {{ storage_name }}>
path {{ storage_path }}
# pack-gc false
</filestorage>
{% endfor %}
<eventlog>
<logfile>
dateformat
path {{ parameter_dict['log-path'] }}
</logfile>
</eventlog>
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