bundlewrap/bundles/jellyfin/metadata.py

70 lines
1.6 KiB
Python
Raw Normal View History

2023-09-24 13:22:38 +00:00
from bundlewrap.metadata import atomic
defaults = {
'apt': {
'packages': {
'jellyfin': {},
},
'repos': {
'jellyfin': {
'uris': {
'https://repo.jellyfin.org/{os}'
},
},
},
},
2023-09-24 14:48:19 +00:00
'backups': {
'paths': {
f'/var/lib/jellyfin/{x}' for x in ('data', 'metadata', 'plugins', 'root')
},
},
2023-09-24 13:22:38 +00:00
'icinga2_api': {
'transmission': {
'services': {
'JELLYFIN PROCESS': {
'command_on_monitored_host': '/usr/lib/nagios/plugins/check_procs -C jellyfin -c 1:',
},
},
},
},
}
@metadata_reactor.provides(
2023-09-24 14:48:19 +00:00
'nginx/vhosts/jellyfin',
2023-09-24 13:22:38 +00:00
)
2023-09-24 14:48:19 +00:00
def nginx(metadata):
if not node.has_bundle('nginx'):
raise DoNotRunAgain
if 'jellyfin' not in metadata.get('nginx/vhosts', {}):
return {}
2023-09-24 13:22:38 +00:00
return {
2023-09-24 14:48:19 +00:00
'nginx': {
'vhosts': {
'jellyfin': {
'do_not_add_content_security_headers': True,
'locations': {
'/': {
'target': 'http://127.0.0.1:8096',
'websockets': True,
},
},
},
2023-09-24 13:22:38 +00:00
},
},
}
@metadata_reactor.provides(
'firewall/port_rules',
)
def firewall(metadata):
return {
'firewall': {
'port_rules': {
'8096/tcp': atomic(metadata.get('jellyfin/restrict-to', {'*'})),
},
},
}