bundlewrap/bundles/ntfy/metadata.py

93 lines
2.3 KiB
Python
Raw Normal View History

2022-10-19 13:24:39 +00:00
defaults = {
'apt': {
'repos': {
'ntfy': {
'items': {
'deb [arch=amd64] https://archive.heckel.io/apt debian main',
},
},
},
'packages': {
'ntfy': {},
},
},
'backups': {
'paths': {
2022-10-19 14:33:36 +00:00
"/var/cache/ntfy",
"/var/lib/ntfy",
"/var/opt/ntfy",
2022-10-19 13:24:39 +00:00
},
},
'ntfy': {
'allow_unauthorized_write': False,
},
2022-10-19 13:24:39 +00:00
'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',
},
},
2022-10-19 15:23:57 +00:00
'tank/ntfy/attachments': {
2022-10-19 13:24:39 +00:00
'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 = {
'/': {
2022-10-19 15:23:57 +00:00
'target': 'http://127.0.0.1:22100',
2022-10-19 13:24:39 +00:00
'proxy_set_header': {
'X-Real-IP': '$remote_addr',
},
'websockets': True,
'proxy_read_timeout': '3m',
'max_body_size': '20m',
2022-11-04 06:27:38 +00:00
'additional_config': {
2022-10-19 13:24:39 +00:00
'proxy_connect_timeout 3m',
'proxy_send_timeout 3m',
2022-10-19 14:33:36 +00:00
'proxy_request_buffering off',
'proxy_redirect off',
2022-10-19 13:24:39 +00:00
}
},
}
vhosts = {
'ntfy': {
2022-10-19 13:38:10 +00:00
'domain': metadata.get('ntfy/domain'),
2022-10-19 13:24:39 +00:00
'locations': locations,
# This only does websockets connections, which stay
# open for a very long time. This only generates
# useless metrics.
'timing_log': False,
2022-10-19 13:24:39 +00:00
'website_check_path': '/',
'website_check_string': 'ntfy',
},
}
return {
'nginx': {
'vhosts': vhosts
},
}