bundlewrap/bundles/grafana/metadata.py

58 lines
1.5 KiB
Python
Raw Permalink Normal View History

defaults = {
'apt': {
'packages': {
'grafana': {},
},
'repos': {
'grafana': {
'items': {
2022-11-21 18:32:47 +00:00
'deb https://apt.grafana.com stable main',
},
},
},
},
'backups': {
'paths': {
'/var/lib/grafana',
},
},
'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'),
'locations': {
'/': {
'target': 'http://127.0.0.1:21010',
},
'/api/ds/query': {
'target': 'http://127.0.0.1:21010',
'proxy_read_timeout': 300,
},
},
'website_check_path': '/login',
'website_check_string': 'Grafana',
},
},
},
}