Compare commits
4 commits
12268daad6
...
4530a34175
Author | SHA1 | Date | |
---|---|---|---|
![]() |
4530a34175 | ||
![]() |
b8100f472b | ||
![]() |
9b104cac25 | ||
![]() |
7243ad9e9b |
5 changed files with 52 additions and 13 deletions
|
@ -141,10 +141,10 @@ def www_conf(metadata):
|
||||||
'listen.owner': 'www-data',
|
'listen.owner': 'www-data',
|
||||||
'listen.group': 'www-data',
|
'listen.group': 'www-data',
|
||||||
'pm': 'dynamic',
|
'pm': 'dynamic',
|
||||||
'pm.max_children': '30',
|
'pm.max_children': '32',
|
||||||
'pm.start_servers': '10',
|
'pm.start_servers': '16',
|
||||||
'pm.min_spare_servers': '5',
|
'pm.min_spare_servers': '8',
|
||||||
'pm.max_spare_servers': '10',
|
'pm.max_spare_servers': '16',
|
||||||
'pm.max_requests': '500',
|
'pm.max_requests': '500',
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|
|
@ -6,7 +6,7 @@ directories = {
|
||||||
'group': 'postgres',
|
'group': 'postgres',
|
||||||
'needs': [
|
'needs': [
|
||||||
'pkg_apt:postgresql',
|
'pkg_apt:postgresql',
|
||||||
'zfs_dataset:tank/postgresql',
|
f"zfs_dataset:{node.metadata.get('zfs/storage_classes/ssd')}/postgresql",
|
||||||
],
|
],
|
||||||
'needed_by': [
|
'needed_by': [
|
||||||
'svc_systemd:postgresql',
|
'svc_systemd:postgresql',
|
||||||
|
|
|
@ -1,3 +1,6 @@
|
||||||
|
from importlib.metadata import metadata
|
||||||
|
|
||||||
|
|
||||||
root_password = repo.vault.password_for(f'{node.name} postgresql root')
|
root_password = repo.vault.password_for(f'{node.name} postgresql root')
|
||||||
|
|
||||||
defaults = {
|
defaults = {
|
||||||
|
@ -23,15 +26,24 @@ defaults = {
|
||||||
'grafana_rows': set(),
|
'grafana_rows': set(),
|
||||||
}
|
}
|
||||||
|
|
||||||
if node.has_bundle('zfs'):
|
|
||||||
defaults['zfs'] = {
|
@metadata_reactor.provides(
|
||||||
|
'zfs/datasets',
|
||||||
|
)
|
||||||
|
def zfs(metadata):
|
||||||
|
if not node.has_bundle('zfs'):
|
||||||
|
return {}
|
||||||
|
|
||||||
|
return {
|
||||||
|
'zfs': {
|
||||||
'datasets': {
|
'datasets': {
|
||||||
'tank/postgresql': {
|
f"{metadata.get('zfs/storage_classes/ssd')}/postgresql": {
|
||||||
'mountpoint': '/var/lib/postgresql',
|
'mountpoint': '/var/lib/postgresql',
|
||||||
'recordsize': '8192',
|
'recordsize': '8192',
|
||||||
'atime': 'off',
|
'atime': 'off',
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -78,9 +78,13 @@ defaults = {
|
||||||
'datasets': {},
|
'datasets': {},
|
||||||
'pools': {},
|
'pools': {},
|
||||||
'kernel_params': {},
|
'kernel_params': {},
|
||||||
|
'storage_classes': {
|
||||||
|
'ssd': 'tank',
|
||||||
|
},
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@metadata_reactor.provides(
|
@metadata_reactor.provides(
|
||||||
'zfs/datasets'
|
'zfs/datasets'
|
||||||
)
|
)
|
||||||
|
@ -132,3 +136,23 @@ def headers(metadata):
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@metadata_reactor.provides(
|
||||||
|
'zfs/kernel_params/zfs_arc_max',
|
||||||
|
)
|
||||||
|
def arc_size(metadata):
|
||||||
|
arc_percent = metadata.get('zfs/zfs_arc_max_percent', None)
|
||||||
|
|
||||||
|
if arc_percent:
|
||||||
|
return {
|
||||||
|
'zfs': {
|
||||||
|
'kernel_params': {
|
||||||
|
'zfs_arc_max': str(int(
|
||||||
|
metadata.get('vm/ram') * 1024 * 1024 * (arc_percent/100)
|
||||||
|
)),
|
||||||
|
},
|
||||||
|
},
|
||||||
|
}
|
||||||
|
else:
|
||||||
|
return {}
|
||||||
|
|
|
@ -119,7 +119,7 @@
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
'vm': {
|
'vm': {
|
||||||
'cores': 2,
|
'cores': 16,
|
||||||
'ram': 32384,
|
'ram': 32384,
|
||||||
},
|
},
|
||||||
'wireguard': {
|
'wireguard': {
|
||||||
|
@ -136,6 +136,9 @@
|
||||||
},
|
},
|
||||||
'zfs': {
|
'zfs': {
|
||||||
'zfs_arc_max_percent': 75,
|
'zfs_arc_max_percent': 75,
|
||||||
|
'storage_classes': {
|
||||||
|
'ssd': 'ssd',
|
||||||
|
},
|
||||||
'pools': {
|
'pools': {
|
||||||
'tank': {
|
'tank': {
|
||||||
'type': 'mirror',
|
'type': 'mirror',
|
||||||
|
|
Loading…
Reference in a new issue