From 394a7a3b3f1f9a5ba7c46c9e102256d4bc10b6ba Mon Sep 17 00:00:00 2001 From: mwiegand Date: Sat, 26 Jun 2021 16:51:12 +0200 Subject: [PATCH] wip --- bundles/backup-server/metadata.py | 22 +++++++++++++--------- bundles/dovecot/files/dovecot.conf | 2 +- bundles/dovecot/items.py | 1 + bundles/dovecot/metadata.py | 10 ++++++++++ bundles/php/items.py | 2 +- nodes/htz.mails.py | 3 ++- 6 files changed, 28 insertions(+), 12 deletions(-) diff --git a/bundles/backup-server/metadata.py b/bundles/backup-server/metadata.py index 4290898..386cb3f 100644 --- a/bundles/backup-server/metadata.py +++ b/bundles/backup-server/metadata.py @@ -43,19 +43,23 @@ def zfs(metadata): @metadata_reactor.provides( - 'dns' + 'dns', ) def dns(metadata): - records = {} - - if metadata.get('network/ipv4', None): - records['A'] = [str(ip_interface(metadata.get('network/ipv4')).ip)] - if metadata.get('network/ipv6', None): - records['AAAA'] = [str(ip_interface(metadata.get('network/ipv6')).ip)] - return { 'dns': { - metadata.get('backup-server/hostname'): records, + metadata.get('backup-server/hostname'): { + 'A': [ + str(ip_interface(network['ipv4']).ip) + for network in metadata.get('network').values() + if 'ipv4' in network + ], + 'AAAA': [ + str(ip_interface(network['ipv6']).ip) + for network in metadata.get('network').values() + if 'ipv6' in network + ], + }, }, } diff --git a/bundles/dovecot/files/dovecot.conf b/bundles/dovecot/files/dovecot.conf index fa89a46..1536130 100644 --- a/bundles/dovecot/files/dovecot.conf +++ b/bundles/dovecot/files/dovecot.conf @@ -101,7 +101,7 @@ plugin { fts_decoder = decode2text } service indexer-worker { - vsz_limit = 1G + vsz_limit = ${indexer_ram} } service decode2text { executable = script /usr/local/libexec/dovecot/decode2text.sh diff --git a/bundles/dovecot/items.py b/bundles/dovecot/items.py index 8d4e120..1848baa 100644 --- a/bundles/dovecot/items.py +++ b/bundles/dovecot/items.py @@ -31,6 +31,7 @@ files = { 'content_type': 'mako', 'context': { 'admin_email': node.metadata.get('mailserver/admin_email'), + 'indexer_ram': node.metadata.get('dovecot/indexer_ram'), }, 'needs': { 'pkg_apt:' diff --git a/bundles/dovecot/metadata.py b/bundles/dovecot/metadata.py index fb75bf5..58211d1 100644 --- a/bundles/dovecot/metadata.py +++ b/bundles/dovecot/metadata.py @@ -25,3 +25,13 @@ defaults = { }, }, } + +@metadata_reactor.provides( + 'dovecot/indexer_ram', +) +def indexer_ram(metadata): + return { + 'dovecot': { + 'indexer_ram': str(metadata.get('vm/ram')//2)+ 'M', + }, + } diff --git a/bundles/php/items.py b/bundles/php/items.py index 64b5aab..9d36098 100644 --- a/bundles/php/items.py +++ b/bundles/php/items.py @@ -1,7 +1,7 @@ version = node.metadata.get('php/version') php_ini_context = { - 'num_cpus': node.metadata.get('vm/cpu'), + 'num_cpus': node.metadata.get('vm/cores'), 'post_max_size': node.metadata.get('php/post_max_size', 10), } diff --git a/nodes/htz.mails.py b/nodes/htz.mails.py index c52bc99..d24805c 100644 --- a/nodes/htz.mails.py +++ b/nodes/htz.mails.py @@ -94,7 +94,8 @@ 'installer': True, }, 'vm': { - 'cpu': 2, + 'cores': 2, + 'ram': 8096, }, 'wireguard': { # ip r add 10.0.0.0/24 via 172.19.136.2 dev wg0