bundlewrap/bundles/grafana/metadata.py

49 lines
1.2 KiB
Python
Raw Normal View History

defaults = {
'apt': {
'packages': {
'grafana': {},
},
'repos': {
'grafana': {
'items': {
'deb https://packages.grafana.com/oss/deb stable main',
},
},
},
},
'grafana': {
'allow_anonymous': False,
'allow_embedding': False,
'allow_sign_up': False,
'anonymous_org': 'public',
'enable_smtp': True,
'login_max_duration': '24h',
'secret_key': repo.vault.random_bytes_as_base64_for(f'{node.name} grafana secret_key'),
},
}
@metadata_reactor.provides(
'nginx/vhosts/grafana',
)
def nginx(metadata):
if not node.has_bundle('nginx'):
raise DoNotRunAgain
return {
'nginx': {
'vhosts': {
'grafana': {
'domain': metadata.get('grafana/domain'),
'proxy': {
'/': {
'target': 'http://127.0.0.1:21010',
},
},
'website_check_path': '/login',
'website_check_string': 'Grafana',
},
},
},
}