adding new api route to use dynamic nginx upstreams

master
lza_menace 3 years ago
parent 906a9fb906
commit 492b7ddf2a

@ -25,3 +25,14 @@ def export_ansible():
ops=ops,
domain=config.DO_DOMAIN
)
@bp.route('/api/export/upstreams')
def export_upstreams():
ops = Operation.query.filter(
Operation.droplet_id > 0
)
return render_template(
'export_upstreams.html',
ops=ops,
domain=config.DO_DOMAIN
)

@ -0,0 +1,5 @@
upstream xmrnodes {
{% for op in ops %}
server {{ op.codename }}.node.{{ domain }}:18081 max_fails=3 fail_timeout=5s;
{% endfor %}
}
Loading…
Cancel
Save