bundlewrap/bundles/nginx/metadata.py

52 lines
1,023 B
Python
Raw Normal View History

2020-08-18 13:27:55 +00:00
defaults = {
'apt': {
'repos': {
'nginx': {
'items': [
'deb http://nginx.org/packages/{os} {os_release} nginx',
2020-08-18 13:27:55 +00:00
],
2020-03-14 09:56:19 +00:00
},
2020-08-18 13:27:55 +00:00
},
'unattended-upgrades': {
'origins': {
'o=nginx,a=stable,l=nginx,c=nginx',
},
2020-03-14 09:56:19 +00:00
},
2020-08-18 13:27:55 +00:00
'packages': {
'nginx': {},
2020-04-13 07:52:26 +00:00
},
2020-08-18 13:27:55 +00:00
},
'nginx': {
'worker_connections': 768,
2020-08-18 13:27:55 +00:00
},
}
@metadata_reactor
def worker_processes(metadata):
return {
'nginx': {
'worker_processes': metadata.get('vm/cpu', 2),
},
}
2020-08-18 13:27:55 +00:00
@metadata_reactor
def letsencrypt(metadata):
if not node.has_bundle('letsencrypt'):
2020-08-18 13:27:55 +00:00
raise DoNotRunAgain
domains = {}
2020-08-18 13:27:55 +00:00
for domain in metadata.get('nginx/vhosts', {}).keys():
domains[domain] = set()
return {
'letsencrypt': {
'domains': domains,
'reload_after': {
'nginx',
},
},
2020-08-18 13:27:55 +00:00
}