Skip to content

Commit 7cda735

Browse files
committed
Update Release Candidate
2 parents 71d83d4 + 637c464 commit 7cda735

File tree

12 files changed

+162
-11
lines changed

12 files changed

+162
-11
lines changed

software/erp5/instance-erp5-input-schema.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -798,7 +798,7 @@
798798
},
799799
"apachedex-promise-threshold": {
800800
"type": "number",
801-
"title": "Promise fails if the overall Apdex score for the previous day is below than this value.",
801+
"title": "Promise fails if the overall Apdex score for the previous day is below than this value. A value of 0 disables the promise.",
802802
"default": 70,
803803
"minimum": 0,
804804
"maximum": 100

software/erp5/test/test/test_balancer.py

Lines changed: 36 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import ipaddress
22
import json
33
import logging
4+
import lzma
45
import os
56
import re
67
import socket
@@ -104,7 +105,7 @@ def _getInstanceParameterDict(cls) -> dict:
104105
'--js-embed',
105106
'--quiet',
106107
],
107-
'apachedex-promise-threshold': 100,
108+
'apachedex-promise-threshold': 0,
108109
'haproxy-server-check-path': '/',
109110
'zope-family-dict': {
110111
'default': ['dummy_http_server'],
@@ -264,7 +265,7 @@ def test_access_log_apachedex_report(self) -> None:
264265
# make a request so that we have something in the logs
265266
requests.get(self.default_balancer_zope_url, verify=False)
266267

267-
# crontab for apachedex is executed
268+
# crontab for daily apachedex is executed
268269
self._executeCrontabAtDate('generate-apachedex-report', '23:59')
269270
# it creates a report for the day
270271
apachedex_report, = (
@@ -278,6 +279,39 @@ def test_access_log_apachedex_report(self) -> None:
278279
# having this table means that apachedex could parse some lines.
279280
self.assertIn('<h2>Hits per status code</h2>', report_text)
280281

282+
# weekly apachedex uses the logs after rotation, we'll run log rotation
283+
# until we have a xz file for two days ago and a non compressed file for
284+
# yesterday
285+
# run logrotate a first time so that it create state files
286+
self._executeCrontabAtDate('logrotate', '2000-01-01')
287+
requests.get(urllib.parse.urljoin(self.default_balancer_zope_url, 'error-two-days-ago'), verify=False)
288+
self._executeCrontabAtDate('logrotate', 'yesterday 00:00')
289+
requests.get(urllib.parse.urljoin(self.default_balancer_zope_url, 'error-yesterday'), verify=False)
290+
self._executeCrontabAtDate('logrotate', '00:00')
291+
292+
# this apachedex command uses compressed files, verify that our test setup
293+
# is correct and that the error from two days ago is in the compressed file.
294+
two_days_ago_log, = (
295+
self.computer_partition_root_path / 'srv' / 'backup'/ 'logrotate'
296+
).glob("apache-access.log-*.xz")
297+
with lzma.open(two_days_ago_log) as f:
298+
self.assertIn(b'GET /error-two-days-ago', f.read())
299+
300+
self._executeCrontabAtDate('generate-weekly-apachedex-report', '23:59')
301+
# this creates a report for the week
302+
apachedex_weekly_report, = (
303+
self.computer_partition_root_path
304+
/ 'srv'
305+
/ 'monitor'
306+
/ 'private'
307+
/ 'apachedex'
308+
/ 'weekly').glob('*.html')
309+
weekly_report_text = apachedex_weekly_report.read_text()
310+
self.assertIn('APacheDEX', weekly_report_text)
311+
# because we run apachedex with error details, we can see our error requests
312+
self.assertIn('error-two-days-ago', weekly_report_text)
313+
self.assertIn('error-yesterday', weekly_report_text)
314+
281315
def test_access_log_rotation(self) -> None:
282316
# run logrotate a first time so that it create state files
283317
self._executeCrontabAtDate('logrotate', '2000-01-01')

software/neoppod/buildout.hash.cfg

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ md5sum = b4baf7f21f450fa522c2a69f5a4aedf7
1818

1919
[root-common]
2020
filename = root-common.cfg.in
21-
md5sum = eefc3358852b7509bfe1b18da19abca0
21+
md5sum = 1320dbea362ce6909f1490ba349c3e6c
2222

2323
[instance-neo-admin]
2424
filename = instance-neo-admin.cfg.in
@@ -30,7 +30,7 @@ md5sum = 9f27195d770b2f57461c60a82c851ab9
3030

3131
[instance-neo]
3232
filename = instance-neo.cfg.in
33-
md5sum = 53b2c73a0c5c7cb5f6b841ba6892fa46
33+
md5sum = d8a62f4a2b68fe97146871d07a500443
3434

3535
[template-neo-my-cnf]
3636
filename = my.cnf.in

software/neoppod/instance-neo-input-schema.json

Lines changed: 44 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,49 @@
2828
"description": "Master nodes in the cluster to backup.",
2929
"type": "string"
3030
},
31+
"reflink": {
32+
"description": "Track references between OIDs of an external ZODB.",
33+
"additionalProperties": false,
34+
"required": [
35+
"zurl"
36+
],
37+
"properties": {
38+
"zurl": {
39+
"description": "ZODB to track.",
40+
"type": "string"
41+
},
42+
"_ca": {
43+
"type": "string"
44+
},
45+
"_cert": {
46+
"type": "string"
47+
},
48+
"_key": {
49+
"type": "string"
50+
},
51+
"max-txn-size": {
52+
"description": "Maximum number of OIDs to delete per transaction.",
53+
"default": 2097151,
54+
"type": "integer"
55+
},
56+
"commit-interval": {
57+
"description": "Commit every SECONDS of work.",
58+
"default": 10,
59+
"type": "integer"
60+
},
61+
"period": {
62+
"description": "Age of the historical revision at which a GC is performed (this can be seen as a grace period). See --period option.",
63+
"default": 86400,
64+
"type": "integer"
65+
},
66+
"no-gc": {
67+
"description": "Only track references.",
68+
"default": false,
69+
"type": "boolean"
70+
},
71+
},
72+
"type": "object"
73+
},
3174
"monitor": {
3275
"description": "Parameters for monitoring.",
3376
"properties": {
@@ -124,7 +167,7 @@
124167
"type": "array"
125168
},
126169
"storage-type": {
127-
"description": "Storage type. Required when several types are configured and you select which one to use via 'node!' parameter. Defaults to whatever is configured ('sqlite' or 'mysql'), else MySQL if available, else SQLite.",
170+
"description": "Storage type. Required when several types are configured and you select which one to use via 'node!' parameter. Defaults to whatever is configured ('sqlite' or 'mysql'), else MySQL if available, else SQLite. SQLite is recommended for a reflink DB.",
128171
"enum": [
129172
"MySQL",
130173
"SQLite"

software/neoppod/instance-neo.cfg.in

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -194,6 +194,44 @@ post = {{ bin_directory }}/slapos-kill -s RTMIN+1 -- {{ bin_directory }}/neostor
194194

195195
{% endfor -%}
196196

197+
{% set reflink = slapparameter_dict.get('reflink') -%}
198+
{% if reflink -%}
199+
{% set zurl = 'neo://%s@%s' % (slapparameter_dict['cluster'], slapparameter_dict['masters'].replace(' ', ',')) -%}
200+
{% if slapparameter_dict['ssl'] -%}
201+
{% set zurl = zurl + '?ca=${ca.crt:output}&cert=${neo.crt:output}&key=${neo.key:output}' -%}
202+
{% endif -%}
203+
[{{ section('reflink') }}]
204+
recipe = slapos.cookbook:wrapper
205+
wrapper-path = ${directory:etc_run}/reflink
206+
{% set args = [] -%}
207+
{% if 'commit-interval' in reflink -%}
208+
{% do args.extend(('-i', str(reflink['commit-interval']))) -%}
209+
{% endif -%}
210+
{% if 'period' in reflink -%}
211+
{% do args.extend(('-p', str(reflink['period']))) -%}
212+
{% endif -%}
213+
{% if 'no-gc' in reflink -%}
214+
{% do args.append('--no-gc') -%}
215+
{% endif -%}
216+
command-line = {{ bin_directory }}/reflink -v {{ zurl }} run {{ ' '.join(args) }} {{ reflink['zurl'] }}
217+
{% if reflink['zurl'].startswith('neos://') -%}
218+
environment =
219+
NEO_CA=${reflink-ca:output}
220+
NEO_CERT=${reflink-cert:output}
221+
NEO_KEY=${reflink-key:output}
222+
223+
{% for x in 'ca', 'cert', 'key' -%}
224+
[reflink-{{x}}]
225+
recipe = slapos.recipe.template:jinja2
226+
output = ${directory:etc}/${:_buildout_section_name_}.pem
227+
inline =
228+
{{'{{'}}pem}}
229+
context = key pem :pem
230+
pem = {{dumps(reflink['_'+x])}}
231+
{% endfor -%}
232+
{% endif -%}
233+
{% endif -%}
234+
197235
{% if mysql -%}
198236
[init-script]
199237
recipe = slapos.recipe.template

software/neoppod/root-common.cfg.in

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -133,6 +133,9 @@ config-monitor-port = {{ dumps(port) }}
133133
{%- endif %}
134134
config-monitor = {{ dumps(parameter_dict.get('monitor', {})) }}
135135
{%- endif %}
136+
{%- if 'reflink' in parameter_dict %}
137+
config-reflink = {{ dumps(parameter_dict.pop('reflink')) }}
138+
{%- endif %}
136139
{%- for k, v in six.iteritems(node) %}
137140
config-{{ k }} = {{ dumps(v) }}
138141
{%- endfor %}

stack/erp5-zope2/buildout.hash.cfg

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ md5sum = 6d9a926e07b674ffdaecd381d763c068
7474

7575
[template-erp5]
7676
filename = instance-erp5.cfg.in
77-
md5sum = 6b10ab0c54278156caf058ebb7246645
77+
md5sum = 7ac187ff9fe306297724a730459e1a4d
7878

7979
[template-zeo]
8080
filename = instance-zeo.cfg.in

stack/erp5-zope2/instance-erp5.cfg.in

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -186,6 +186,7 @@ connection-url = smtp://127.0.0.2:0/
186186
{% set ((name, server_dict),) = server_dict.items() -%}
187187
{% do neo.append(server_dict.get('cluster')) -%}
188188
{% do server_dict.update(cluster='${publish-early:neo-cluster}') -%}
189+
{{ assert('reflink' not in server_dict, 'reflink option is meaningless in ERP5 SR') }}
189190
{{ root_common.request_neo(server_dict, 'zodb-neo', 'neo-', monitor_base_url_dict) }}
190191
{% set client_dict = zodb_dict[name].setdefault('storage-dict', {}) -%}
191192
{% for k in 'ssl', '_ca', '_cert', '_key' -%}

stack/erp5/buildout.cfg

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -529,6 +529,7 @@ eggs =
529529
lock_file
530530
astor
531531
APacheDEX
532+
${backports.lzma:egg}
532533
chardet
533534
collective.recipe.template
534535
erp5diff

stack/erp5/buildout.hash.cfg

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ md5sum = 8e452bd32fc0d4d858b275a2b3ee790b
7474

7575
[template-erp5]
7676
filename = instance-erp5.cfg.in
77-
md5sum = 1333d2fc21f64da4010a4eafea59d141
77+
md5sum = bd8cb060b37d8dc6a1ab4e25a2a7e109
7878

7979
[template-zeo]
8080
filename = instance-zeo.cfg.in
@@ -94,7 +94,7 @@ md5sum = 9c580be982d8c63ec06fc273ef3cb971
9494

9595
[template-balancer]
9696
filename = instance-balancer.cfg.in
97-
md5sum = 409a7505548576ebf0e4d5cc218e0753
97+
md5sum = e9aa89754085bdc7a6fb9e53c0c97f9d
9898

9999
[template-haproxy-cfg]
100100
filename = haproxy.cfg.in

0 commit comments

Comments
 (0)