bundlewrap/bundles/nginx/metadata.py

48 lines
985 B
Python

defaults = {
'apt': {
'repos': {
'nginx': {
'items': [
'deb http://nginx.org/packages/{os} {os_release} nginx',
],
},
},
'packages': {
'nginx': {},
},
},
'nginx': {
'worker_connections': 768,
'use_ssl_for_all_connections': True,
},
}
@metadata_reactor
def worker_processes(metadata):
return {
'nginx': {
'worker_processes': metadata.get('vm/cpu', 2),
},
}
@metadata_reactor
def letsencrypt(metadata):
if not node.has_bundle('letsencrypt'):
raise DoNotRunAgain
domains = {}
for vhost, config in metadata.get('nginx/vhosts', {}).items():
domain = config.get('domain', vhost)
domains[domain] = set()
return {
'letsencrypt': {
'domains': domains,
'reload_after': {
'nginx',
},
},
}