bundlewrap/bundles/ntfy/metadata.py

92 lines
2.3 KiB
Python

defaults = {
'apt': {
'repos': {
'ntfy': {
'items': {
'deb [arch=amd64] https://archive.heckel.io/apt debian main',
},
},
},
'packages': {
'ntfy': {},
},
},
'backups': {
'paths': {
"/var/cache/ntfy",
"/var/lib/ntfy",
"/var/opt/ntfy",
},
},
'ntfy': {
'allow_unauthorized_write': False,
},
'zfs': {
'datasets': {
'tank/ntfy': {},
'tank/ntfy/cache': {
'mountpoint': '/var/cache/ntfy',
'needed_by': {
'directory:/var/cache/ntfy',
},
},
'tank/ntfy/lib': {
'mountpoint': '/var/lib/ntfy',
'needed_by': {
'directory:/var/lib/ntfy',
},
},
'tank/ntfy/attachments': {
'mountpoint': '/var/opt/ntfy',
'needed_by': {
'directory:/var/opt/ntfy',
},
},
},
},
}
@metadata_reactor.provides(
'nginx/vhosts',
)
def nginx(metadata):
if not node.has_bundle('nginx'):
raise DoNotRunAgain
locations = {
'/': {
'target': 'http://127.0.0.1:22100',
'proxy_set_header': {
'X-Real-IP': '$remote_addr',
},
'websockets': True,
'proxy_read_timeout': '3m',
'max_body_size': '20m',
'additional_config': {
'proxy_connect_timeout 3m',
'proxy_send_timeout 3m',
'proxy_request_buffering off',
'proxy_redirect off',
}
},
}
vhosts = {
'ntfy': {
'domain': metadata.get('ntfy/domain'),
'locations': locations,
# This only does websockets connections, which stay
# open for a very long time. This only generates
# useless metrics.
'timing_log': False,
'website_check_path': '/',
'website_check_string': 'ntfy',
},
}
return {
'nginx': {
'vhosts': vhosts
},
}