bundles/docker-engine: fix backups and zfs dependencies

This commit is contained in:
Franzi 2025-03-29 13:37:45 +01:00
parent 38ec7af32c
commit a592de005e
Signed by: kunsi
GPG key ID: 12E3D2136B818350
2 changed files with 17 additions and 9 deletions

View file

@ -46,6 +46,10 @@ actions['docker_create_nondefault_network'] = {
for app, config in node.metadata.get('docker-engine/containers', {}).items(): for app, config in node.metadata.get('docker-engine/containers', {}).items():
volumes = config.get('volumes', {}) volumes = config.get('volumes', {})
user = config.get('user', f'docker-{app}') user = config.get('user', f'docker-{app}')
directories[f'/var/opt/docker-engine/{app}'] = {
'owner': user,
'group': user,
}
files[f'/opt/docker-engine/{app}'] = { files[f'/opt/docker-engine/{app}'] = {
'source': 'docker-wrapper', 'source': 'docker-wrapper',
@ -97,6 +101,7 @@ for app, config in node.metadata.get('docker-engine/containers', {}).items():
svc_systemd[f'docker-{app}'] = { svc_systemd[f'docker-{app}'] = {
'needs': { 'needs': {
*deps, *deps,
f'directory:/var/opt/docker-engine/{app}',
f'file:/opt/docker-engine/{app}', f'file:/opt/docker-engine/{app}',
f'file:/usr/local/lib/systemd/system/docker-{app}.service', f'file:/usr/local/lib/systemd/system/docker-{app}.service',
f'user:{user}', f'user:{user}',

View file

@ -13,11 +13,6 @@ defaults = {
}, },
}, },
}, },
'backups': {
'paths': {
'/var/opt/docker-engine',
},
},
'nftables': { 'nftables': {
'forward': { 'forward': {
'docker-engine': [ 'docker-engine': [
@ -39,9 +34,7 @@ defaults = {
}, },
'zfs': { 'zfs': {
'datasets': { 'datasets': {
'tank/docker-data': { 'tank/docker-data': {},
'mountpoint': '/var/opt/docker-engine',
},
}, },
}, },
} }
@ -72,6 +65,7 @@ def monitoring(metadata):
@metadata_reactor.provides( @metadata_reactor.provides(
'backups/paths',
'zfs/datasets', 'zfs/datasets',
) )
def zfs(metadata): def zfs(metadata):
@ -79,10 +73,19 @@ def zfs(metadata):
for app in metadata.get('docker-engine/containers', {}): for app in metadata.get('docker-engine/containers', {}):
datasets[f'tank/docker-data/{app}'] = { datasets[f'tank/docker-data/{app}'] = {
'mountpoint': f'/var/opt/docker-engine/{app}' 'mountpoint': f'/var/opt/docker-engine/{app}',
'needed_by': {
f'directory:/var/opt/docker-engine/{app}',
},
} }
return { return {
'backups': {
'paths': {
v['mountpoint']
for v in datasets.values()
},
},
'zfs': { 'zfs': {
'datasets': datasets, 'datasets': datasets,
}, },