Commit 61711abc authored by Julien Muchembled's avatar Julien Muchembled

logging: refactoring of crond/logrotate for NEO & ERP5

New 'slapos-kill' from slapos.toolbox is used instead of 'killpidfromfile'
This is required for NEO which does not write any pid file.
parent 7ece1a48
[buildout]
parts =
extends = {{ logrotate_cfg }}
parts +=
neo-admin-promise
logrotate-admin
[neo-admin]
recipe = slapos.cookbook:neoppod.admin
......@@ -30,3 +32,11 @@ recipe = slapos.cookbook:check_port_listening
hostname = ${neo-admin:ip}
port = ${neo-admin:port}
path = ${directory:promises}/neo-admin-promise
[logrotate-admin]
recipe = slapos.cookbook:logrotate.d
logrotate-entries = ${logrotate:logrotate-entries}
backup = ${logrotate:backup}
name = neo-admin
log = ${neo-admin:logfile}
post = {{ bin_directory }}/slapos-kill -n neoadmin -s RTMIN+1 ${:log}
[buildout]
parts =
extends = {{ logrotate_cfg }}
parts +=
neo-master-promise
logrotate-master
[neo-master]
recipe = slapos.cookbook:neoppod.master
......@@ -36,3 +38,11 @@ recipe = slapos.cookbook:check_port_listening
hostname = ${neo-master:ip}
port = ${neo-master:port}
path = ${directory:promises}/neo-master-promise
[logrotate-master]
recipe = slapos.cookbook:logrotate.d
logrotate-entries = ${logrotate:logrotate-entries}
backup = ${logrotate:backup}
name = neo-master
log = ${neo-master:logfile}
post = {{ bin_directory }}/slapos-kill -n neomaster -s RTMIN+1 ${:log}
[buildout]
extends = {{ master_cfg }}
parts += neo-storage
parts +=
neo-storage
logrotate-storage
[mariadb-instance]
recipe = slapos.cookbook:generic.mysql
......@@ -45,3 +47,11 @@ var = ${buildout:directory}/var
etc_run = ${:etc}/run
var_run = ${:var}/run
srv_mariadb = ${buildout:directory}/srv/mariadb
[logrotate-storage]
recipe = slapos.cookbook:logrotate.d
logrotate-entries = ${logrotate:logrotate-entries}
backup = ${logrotate:backup}
name = neo-storage
log = ${neo-storage:logfile}
post = {{ bin_directory }}/slapos-kill -n neostorage -s RTMIN+1 ${:log}
......@@ -22,6 +22,7 @@ context =
key ipv4_set slap-configuration:ipv4
raw bin_directory {{ bin_directory }}
key slapparameter_dict slap-configuration:configuration
raw logrotate_cfg {{ logrotate_base }}
${:extra-context}
[neo-cluster]
......
......@@ -7,6 +7,7 @@
[buildout]
extends =
../../stack/slapos.cfg
../../stack/erp5/logrotate-base.cfg
#LXML
../../component/lxml-python/buildout.cfg
#END LXML
......@@ -28,9 +29,10 @@ parts =
[slapos-deps-eggs]
recipe = zc.recipe.egg
eggs =
#LXML
${lxml-python:egg}
#END LXML
slapos.toolbox
scripts =
slapos-kill
[cluster]
recipe = slapos.recipe.build:download
......@@ -39,20 +41,20 @@ md5sum = 84cba584198a26289daacb3e6d199e2b
[instance-neo-admin]
< = cluster
md5sum = d9213500262acd61f0bb8e840b9af18b
md5sum = 43eb053841e9dabdbed2a3501a0a3f13
[instance-neo-master]
< = cluster
md5sum = 00e2a270d6d4e15b77e2e651ee5e7fa9
md5sum = 25724ba46203c57b680976dbe4ba67b7
[instance-neo-storage-mysql]
< = cluster
md5sum = c9dcaf0f4d45dd9422c39ce6ae87dfb3
md5sum = 1117184530207258b194e27dbe724cd5
[template]
recipe = slapos.recipe.template:jinja2
template = ${:_profile_base_location_}/instance.cfg.in
md5sum = 1d427e8aca550efda1635b4ee112f8ac
md5sum = c7147d7c09294385b4995f6480fd976e
# XXX: "template.cfg" is hardcoded in instanciation recipe
rendered = ${buildout:directory}/template.cfg
context =
......@@ -64,6 +66,7 @@ context =
key neo_master instance-neo-master:target
key neo_storage_mysql instance-neo-storage-mysql:target
key mariadb_location mariadb:location
key logrotate_base template-logrotate-base:rendered
[neoppod]
recipe = zc.recipe.egg
......
{% if software_type == slap_software_type -%}
{% set part_list = [] -%}
{% set ssl_parameter_dict = slapparameter_dict.get('ssl', {}) %}
{% macro section(name) %}{% do part_list.append(name) %}{{ name }}{% endmacro -%}
......@@ -177,7 +176,7 @@ logrotate-entries = ${logrotate:logrotate-entries}
backup = ${logrotate:backup}
name = apache
log = ${apache-conf-parameter-dict:error-log} ${apache-conf-parameter-dict:access-log}
post = {{ parameter_dict['bin-directory'] }}/killpidfromfile ${apache-conf-parameter-dict:pid-file} SIGUSR1
post = {{ parameter_dict['bin-directory'] }}/slapos-kill --pidfile ${apache-conf-parameter-dict:pid-file} -s USR1
[directory]
recipe = slapos.cookbook:mkdirectory
......@@ -197,13 +196,9 @@ newcerts = ${:ca-dir}/newcerts
crl = ${:ca-dir}/crl
[buildout]
extends = {{ parameter_dict['instance-logrotate-cfg'] }}
extends = {{ logrotate_cfg }}
parts +=
publish
logrotate-apache
apache-certificate-authority
{{ part_list | join('\n ') }}
eggs-directory = {{ eggs_directory }}
develop-eggs-directory = {{ develop_eggs_directory }}
{% endif %}
{% if slap_software_type == software_type -%}
{% set frontend_dict = slapparameter_dict.get('frontend', {}) %}
{% set has_frontend = frontend_dict.get('software-url', '') != '' -%}
{% set site_id = slapparameter_dict.get('site-id', 'erp5') -%}
......@@ -239,6 +238,3 @@ hosts-dict = {{ '${' ~ zope_address_list_id_dict.keys()[0] ~ ':connection-hosts-
[buildout]
parts = publish
eggs-directory = {{ eggs_directory }}
develop-eggs-directory = {{ develop_eggs_directory }}
{% endif %}
......@@ -54,29 +54,16 @@ dummy +=
extra-paths +=
${vifib:location}/master
[download-base-part]
recipe = slapos.recipe.build:download
url = ${:_profile_base_location_}/${:filename}
mode = 644
[template-erp5]
< = download-base-part
filename = instance-erp5.cfg.in
md5sum = e6e7e8add73df0bc7823dee2dd916d62
md5sum = 1b1ba4a3d57e6f91eb86e36b19f75463
[template-balancer]
< = download-base-part
filename = instance-balancer.cfg.in
md5sum = 08b9ef093af926378b58d384539b3417
md5sum = 818ab59ae966114735866aecef7a8563
[template-apache-conf]
< = download-base-part
filename = apache.conf.in
md5sum = bb329fc28bef095a01efc901d2f84149
[template-create-erp5-site-real]
< = download-base-part
filename = instance-create-erp5-site-real.cfg.in
md5sum = 61824aab2172d21f1d6403a35cab47cd
......
......@@ -6,10 +6,8 @@ extends =
# Exact version of Zope
https://raw.github.com/zopefoundation/Zope/2.13.22/versions.cfg
../../stack/slapos.cfg
../../component/logrotate/buildout.cfg
../../component/cups/buildout.cfg
../../component/dbus/buildout.cfg
../../component/dcron/buildout.cfg
../../component/file/buildout.cfg
../../component/fonts/buildout.cfg
../../component/ghostscript/buildout.cfg
......@@ -56,6 +54,7 @@ extends =
../../component/6tunnel/buildout.cfg
../../component/findutils/buildout.cfg
../../component/userhosts/buildout.cfg
logrotate-base.cfg
parts =
erp5-util-develop
......@@ -91,7 +90,6 @@ parts =
perl-DBI
percona-toolkit
zabbix-agent
dcron
dash
wget
userhosts
......@@ -159,7 +157,7 @@ context =
[template-mariadb]
< = download-base
filename = instance-mariadb.cfg.in
md5sum = 17c9e0f260c6464493e10582e9239409
md5sum = 8a59e1730391fb3a859cd973cd7c3a5b
link-binary =
${coreutils:location}/bin/basename
${coreutils:location}/bin/cat
......@@ -175,7 +173,7 @@ link-binary =
[template-kumofs]
< = download-base
filename = instance-kumofs.cfg.in
md5sum = 2e3230d57f2cfb3a9783fe808ccce08c
md5sum = 5ebf310655d5de27da039d71a63d209b
[template-cloudooo]
< = download-base
......@@ -217,7 +215,7 @@ md5sum = e40e2e39f4941c6372f4357e8589a5cf
# XXX: "template.cfg" is hardcoded in instanciation recipe
filename = template.cfg
template = ${:_profile_base_location_}/instance.cfg.in
md5sum = 92398630799f98dd3bffb0f2802d07e3
md5sum = 5e303e59c6674c98944120d6f1d01c28
extra-context =
key mariadb_link_binary template-mariadb:link-binary
key zope_link_binary template-zope:link-binary
......@@ -294,12 +292,12 @@ md5sum = 7dcac2eae332e2def17579888c045320
[template-zeo]
< = download-base
filename = instance-zeo.cfg.in
md5sum = 9a34fa84f8d0cfc0698ed2527f63aa61
md5sum = 651fa2ec2feb768e339936b7855774ca
[template-zope]
< = download-base
filename = instance-zope.cfg.in
md5sum = 91c5b56ba750cc4010bef4845b712861
md5sum = e128a47f37ba78dc7154daa80c2dd272
link-binary =
${aspell:location}/bin/aspell
${coreutils:location}/bin/basename
......@@ -329,7 +327,7 @@ link-binary =
[template-balancer]
< = download-base
filename = instance-balancer.cfg.in
md5sum = fc13d528e76eb9567925077d5472b285
md5sum = 3628f0ba358e7ee96a8d0185c4775911
[template-apache-conf]
< = download-base
......@@ -341,15 +339,6 @@ md5sum = dedfe759c3421e0186703fe1257bae8f
filename = haproxy.cfg.in
md5sum = d27fe9218cb737d8a76ba5df4740f947
[template-logrotate-base]
< = template-jinja2-base
filename = instance-logrotate-base.cfg
md5sum = af19ff0c7817df85987c69738fb083f2
extra-context =
key dcron_location dcron:location
key gzip_location gzip:location
key logrotate_location logrotate:location
[bt5-repository]
# Format:
# <url or path> [...]
......@@ -590,8 +579,8 @@ eggs =
scripts =
is-local-tcp-port-opened
killpidfromfile
onetimedownload
slapos-kill
zodbpack
[versions]
......@@ -696,7 +685,7 @@ restkit = 4.2.2
rtjp-eventlet = 0.3.2
slapos.recipe.build = 0.12
slapos.recipe.template = 2.5
slapos.toolbox = 0.41.0
slapos.toolbox = 0.43.0
smmap = 0.8.2
socketpool = 0.5.3
spyne = 2.11.0
......
......@@ -187,7 +187,7 @@ logrotate-entries = ${logrotate:logrotate-entries}
backup = ${logrotate:backup}
name = apache
log = ${apache-conf-parameter-dict:error-log} ${apache-conf-parameter-dict:access-log}
post = {{ parameter_dict['bin-directory'] }}/killpidfromfile ${apache-conf-parameter-dict:pid-file} SIGUSR1
post = {{ parameter_dict['bin-directory'] }}/slapos-kill --pidfile ${apache-conf-parameter-dict:pid-file} -s USR1
[directory]
recipe = slapos.cookbook:mkdirectory
......@@ -207,7 +207,7 @@ newcerts = ${:ca-dir}/newcerts
crl = ${:ca-dir}/crl
[buildout]
extends = {{ parameter_dict['instance-logrotate-cfg'] }}
extends = {{ logrotate_cfg }}
parts +=
publish
logrotate-apache
......
{% set use_ipv6 = slapparameter_dict.get('use-ipv6', False) -%}
[buildout]
parts =
extends = {{ logrotate_cfg }}
parts +=
publish-kumofs-connection-information
kumofs-instance
logrotate
logrotate-entry-kumofs
cron
cron-entry-logrotate
promise-kumofs-server
promise-kumofs-server-listen
promise-kumofs-gateway
......@@ -46,14 +44,14 @@ data-path = ${directory:kumofs-data}/kumodb.tch#bnum=10485760#opts=l
{% endif -%}
# Paths: Running wrappers
gateway-wrapper = ${basedirectory:services}/kumofs_gateway
manager-wrapper = ${basedirectory:services}/kumofs_manager
server-wrapper = ${basedirectory:services}/kumofs_server
gateway-wrapper = ${directory:services}/kumofs_gateway
manager-wrapper = ${directory:services}/kumofs_manager
server-wrapper = ${directory:services}/kumofs_server
# Paths: Logs
kumo-gateway-log = ${basedirectory:log}/kumo-gateway.log
kumo-manager-log = ${basedirectory:log}/kumo-manager.log
kumo-server-log = ${basedirectory:log}/kumo-server.log
kumo-gateway-log = ${directory:log}/kumo-gateway.log
kumo-manager-log = ${directory:log}/kumo-manager.log
kumo-server-log = ${directory:log}/kumo-server.log
# Binary information
kumo-gateway-binary = {{ parameter_dict['kumo-location'] }}/bin/kumo-gateway
......@@ -62,70 +60,18 @@ kumo-server-binary = {{ parameter_dict['kumo-location'] }}/bin/kumo-server
shell-path = {{ parameter_dict['dash-location'] }}/bin/dash
[logrotate-entry-kumofs]
<= logrotate
recipe = slapos.cookbook:logrotate.d
logrotate-entries = ${logrotate:logrotate-entries}
backup = ${logrotate:backup}
name = kumofs
log = ${kumofs-instance:kumo-gateway-log} ${kumofs-instance:kumo-manager-log} ${kumofs-instance:kumo-server-log}
# rest of parts are candidates for some generic stuff
[logrotate]
recipe = slapos.cookbook:logrotate
# Binaries
logrotate-binary = {{ parameter_dict['logrotate-location'] }}/usr/sbin/logrotate
gzip-binary = {{ parameter_dict['gzip-location'] }}/bin/gzip
gunzip-binary = {{ parameter_dict['gzip-location'] }}/bin/gunzip
# Directories
wrapper = ${rootdirectory:bin}/logrotate
conf = ${rootdirectory:etc}/logrotate.conf
logrotate-entries = ${directory:logrotate-entries}
backup = ${directory:logrotate-backup}
state-file = ${rootdirectory:srv}/logrotate.status
[basedirectory]
recipe = slapos.cookbook:mkdirectory
log = ${rootdirectory:var}/log
services = ${rootdirectory:etc}/run
promise = ${rootdirectory:etc}/promise
run = ${rootdirectory:var}/run
backup = ${rootdirectory:srv}/backup
[directory]
recipe = slapos.cookbook:mkdirectory
cron-entries = ${rootdirectory:etc}/cron.d
crontabs = ${rootdirectory:etc}/crontabs
cronstamps = ${rootdirectory:etc}/cronstamps
logrotate-backup = ${basedirectory:backup}/logrotate
logrotate-entries = ${rootdirectory:etc}/logrotate.d
kumofs-data = ${rootdirectory:srv}/kumofs
[rootdirectory]
recipe = slapos.cookbook:mkdirectory
etc = ${buildout:directory}/etc
var = ${buildout:directory}/var
srv = ${buildout:directory}/srv
bin = ${buildout:directory}/bin
[cron]
recipe = slapos.cookbook:cron
dcrond-binary = {{ parameter_dict['dcron-location'] }}/sbin/crond
cron-entries = ${directory:cron-entries}
crontabs = ${directory:crontabs}
cronstamps = ${directory:cronstamps}
catcher = ${cron-simplelogger:wrapper}
binary = ${basedirectory:services}/crond
[cron-simplelogger]
recipe = slapos.cookbook:simplelogger
wrapper = ${rootdirectory:bin}/cron_simplelogger
log = ${basedirectory:log}/cron.log
[cron-entry-logrotate]
<= cron
recipe = slapos.cookbook:cron.d
name = logrotate
frequency = 0 0 * * *
command = ${logrotate:wrapper}
log = ${buildout:directory}/var/log
services = ${buildout:directory}/etc/run
promise = ${buildout:directory}/etc/promise
kumofs-data = ${buildout:directory}/srv/kumofs
# Deploy zope promises scripts
[promise-template]
......@@ -135,20 +81,20 @@ port = ${kumofs-instance:server-listen-port}
[promise-kumofs-server]
<= promise-template
path = ${basedirectory:promise}/kumofs-server
path = ${directory:promise}/kumofs-server
port = ${kumofs-instance:server-port}
[promise-kumofs-server-listen]
<= promise-template
path = ${basedirectory:promise}/kumofs-server-listen
path = ${directory:promise}/kumofs-server-listen
port = ${kumofs-instance:server-listen-port}
[promise-kumofs-gateway]
<= promise-template
path = ${basedirectory:promise}/kumofs-gateway
path = ${directory:promise}/kumofs-gateway
port = ${kumofs-instance:gateway-port}
[promise-kumofs-manager]
<= promise-template
path = ${basedirectory:promise}/kumofs-manager
path = ${directory:promise}/kumofs-manager
port = ${kumofs-instance:manager-port}
......@@ -218,8 +218,7 @@ wrapper-path = ${directory:promise}/mariadb
parameters-extra = true
[buildout]
extends =
{{ parameter_dict['instance-logrotate-cfg'] }}
extends = {{ logrotate_cfg }}
parts +=
publish-mariadb-url
logrotate-entry-mariadb
......
......@@ -93,7 +93,7 @@ storage = {{ dumps(storage_list) }}
< = logrotate-base
name = {{ "${" ~ zeo_section_name ~ ":base-name}" }}
log = {{ "${" ~ zeo_section_name ~ ":log-path}" }}
post = {{ bin_directory }}/killpidfromfile {{ "${" ~ zeo_section_name ~ ":pid-path}" }} SIGUSR2
post = {{ bin_directory }}/slapos-kill --pidfile {{ "${" ~ zeo_section_name ~ ":pid-path}" }} -s USR2
[{{ section(zeo_section_name ~ "-promise") }}]
recipe = slapos.cookbook:check_port_listening
......@@ -189,7 +189,7 @@ wrapper-path = ${directory:bin}/cron-purge-repozo-fsindex
< = logrotate-base
name = tidstorage
log = ${tidstorage:logfile-name}
post = {{ bin_directory }}/killpidfromfile ${tidstorage:pidfile-name} SIGHUP
post = {{ bin_directory }}/slapos-kill --pidfile ${tidstorage:pidfile-name} -s HUP
{% else -%}
[tidstorage]
ip =
......@@ -226,8 +226,7 @@ zodb = {{ default_zodb_path }}
tidstorage = {{ default_tidstorage_timestamp_path }}
[buildout]
extends =
{{ parameter_dict['instance-logrotate-cfg'] }}
extends = {{ logrotate_cfg }}
parts +=
{{ part_list | join('\n ') }}
publish
......@@ -325,7 +325,7 @@ path = ${directory:promises}/{{ zope_tunnel_base_name }}
< = logrotate-entry-base
name = {{ name }}
log = {{ '${' ~ conf_parameter_name ~ ':event-log}' }} {{ '${' ~ conf_parameter_name ~ ':z2-log}' }} {{ '${' ~ name ~ ':longrequest-logger-file}' }}
post = {{ bin_directory }}/killpidfromfile {{ '${' ~ conf_parameter_name ~ ':pid-file}' }} SIGUSR2
post = {{ bin_directory }}/slapos-kill --pidfile {{ '${' ~ conf_parameter_name ~ ':pid-file}' }} -s USR2
{% endmacro -%}
{% for i in range(slapparameter_dict['instance-count']) -%}
......@@ -361,8 +361,7 @@ bt5 = {{ dumps(slapparameter_dict['bt5']) }}
bt5-repository-url = {{ dumps(slapparameter_dict['bt5-repository-url']) }}
[buildout]
extends =
{{ parameter_dict['instance-logrotate-cfg'] }}
extends = {{ logrotate_cfg }}
parts +=
erp5-promise
{{ part_list | join('\n ') }}
......
......@@ -21,6 +21,7 @@ context =
key slapparameter_dict slap-configuration:configuration
key computer_id slap-configuration:computer
raw slapos_core_version {{ slapos_core_version }}
raw logrotate_cfg {{ template_logrotate_base }}
${:extra-context}
[dynamic-template-cloudooo-parameters]
......@@ -70,7 +71,6 @@ extra-context =
apache = {{ apache_location }}
openssl = {{ openssl_location }}
haproxy = {{ haproxy_location }}
instance-logrotate-cfg = {{ template_logrotate_base }}
bin-directory = {{ bin_directory }}
6tunnel = {{ sixtunnel_location }}
dash = {{ dash_location }}
......@@ -93,7 +93,6 @@ extensions = jinja2.ext.do
[dynamic-template-zeo-parameters]
buildout-bin-directory = {{ buildout_bin_directory }}
instance-logrotate-cfg = {{ template_logrotate_base }}
6tunnel = {{ sixtunnel_location }}
dash = {{ dash_location }}
findutils-location = {{ findutils_location }}
......@@ -111,7 +110,6 @@ extra-context =
[dynamic-template-zope-parameters]
bin-directory = {{ bin_directory }}
zope-conf-template = {{ template_zope_conf }}
instance-logrotate-cfg = {{ template_logrotate_base }}
buildout-bin-directory = {{ buildout_bin_directory }}
6tunnel = {{ sixtunnel_location }}
dash = {{ dash_location }}
......@@ -146,15 +144,12 @@ extra-context =
[dynamic-template-mariadb-parameters]
coreutils-location = {{ coreutils_location }}
dcron-location = {{ dcron_location }}
findutils-location = {{ findutils_location }}
gzip-location = {{ gzip_location }}
logrotate-location = {{ logrotate_location }}
mariadb-location = {{ mariadb_location }}
template-my-cnf = {{ template_my_cnf }}
template-mariadb-initial-setup = {{ template_mariadb_initial_setup }}
link-binary = {{ dumps(mariadb_link_binary) }}
instance-logrotate-cfg = {{ template_logrotate_base }}
bin-directory = {{ bin_directory }}
[dynamic-template-mariadb]
......
# also extended by software/neoppod
[buildout]
extends =
../../component/dcron/buildout.cfg
../../component/gzip/buildout.cfg
../../component/logrotate/buildout.cfg
[template-logrotate-base]
recipe = slapos.recipe.template:jinja2
template = ${:_profile_base_location_}/${:filename}.in
rendered = ${buildout:directory}/${:filename}
filename = instance-logrotate-base.cfg
md5sum = af19ff0c7817df85987c69738fb083f2
context =
key dcron_location dcron:location
key gzip_location gzip:location
key logrotate_location logrotate:location
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