Compare commits
No commits in common. "c37be210343a138167e6e09165318bbe305a9885" and "cd5b854b00d2891fa3814d54ece0076bc9609adf" have entirely different histories.
c37be21034
...
cd5b854b00
3 changed files with 3 additions and 54 deletions
|
@ -1,8 +1,5 @@
|
|||
from bundlewrap.utils.dicts import merge_dict
|
||||
|
||||
|
||||
version = node.metadata.get('postgresql/version')
|
||||
|
||||
directories = {
|
||||
'/var/lib/postgresql': {
|
||||
'owner': 'postgres',
|
||||
|
@ -17,22 +14,6 @@ directories = {
|
|||
}
|
||||
}
|
||||
|
||||
files = {
|
||||
f"/etc/postgresql/{version}/main/conf.d/managed.conf": {
|
||||
'content': '\n'.join(
|
||||
f'{key} = {value}'
|
||||
for key, value in sorted(node.metadata.get('postgresql/conf').items())
|
||||
) + '\n',
|
||||
'owner': 'postgres',
|
||||
'group': 'postgres',
|
||||
'needed_by': [
|
||||
'svc_systemd:postgresql',
|
||||
],
|
||||
'triggers': [
|
||||
'svc_systemd:postgresql:restart',
|
||||
],
|
||||
},
|
||||
}
|
||||
|
||||
svc_systemd['postgresql'] = {
|
||||
'needs': [
|
||||
|
|
|
@ -1,6 +1,3 @@
|
|||
import builtins
|
||||
|
||||
|
||||
root_password = repo.vault.password_for(f'{node.name} postgresql root')
|
||||
|
||||
defaults = {
|
||||
|
@ -15,7 +12,6 @@ defaults = {
|
|||
},
|
||||
},
|
||||
'postgresql': {
|
||||
'conf': {},
|
||||
'roles': {
|
||||
'root': {
|
||||
'password': root_password,
|
||||
|
@ -28,32 +24,6 @@ defaults = {
|
|||
}
|
||||
|
||||
|
||||
@metadata_reactor.provides(
|
||||
'postgresql/conf',
|
||||
)
|
||||
def conf(metadata):
|
||||
conf = {}
|
||||
|
||||
def limit(value, min=float('-inf'), max=float('inf'), unit=None):
|
||||
result = int(builtins.max([builtins.min([max, value]), min]))
|
||||
return str(result) + unit if unit else result
|
||||
|
||||
ram = metadata.get('vm/ram', None)
|
||||
if ram:
|
||||
conf['max_connections'] = limit(ram/50, min=100)
|
||||
conf['shared_buffers'] = limit(ram/20, min=128, unit='MB')
|
||||
conf['work_mem'] = limit(ram/500, min=4, max=64, unit='MB')
|
||||
conf['temp_buffers'] = limit(ram/500, min=8, max=64, unit='MB')
|
||||
conf['effective_cache_size'] = limit(ram/3, min=4096, unit='MB')
|
||||
conf['maintenance_work_mem'] = limit(ram/50, min=64, unit='MB')
|
||||
|
||||
return {
|
||||
'postgresql': {
|
||||
'conf': conf,
|
||||
},
|
||||
}
|
||||
|
||||
|
||||
@metadata_reactor.provides(
|
||||
'zfs/datasets',
|
||||
)
|
||||
|
|
|
@ -83,7 +83,6 @@
|
|||
'nextcloud': {
|
||||
'hostname': 'cloud.sublimity.de',
|
||||
'version': '24.0.2',
|
||||
'instance_id': 'oci6dw1woodz',
|
||||
},
|
||||
'nextcloud-picsort': {
|
||||
'ckn': {
|
||||
|
@ -121,8 +120,7 @@
|
|||
},
|
||||
'vm': {
|
||||
'cores': 16,
|
||||
'threads': 32,
|
||||
'ram': 49152,
|
||||
'ram': 32384,
|
||||
},
|
||||
'wireguard': {
|
||||
'my_ip': '172.30.0.2/32',
|
||||
|
@ -137,7 +135,7 @@
|
|||
},
|
||||
},
|
||||
'zfs': {
|
||||
'zfs_arc_max_percent': 80,
|
||||
'zfs_arc_max_percent': 75,
|
||||
'storage_classes': {
|
||||
'ssd': 'ssd',
|
||||
},
|
||||
|
|
Loading…
Reference in a new issue