router.loadBalancers: services on several hosts (HAProxy) with HTTP checks, TLS terminated on the router or passed through, the client in X-Forwarded-For or the PROXY protocol, host names that choose a service on a shared port and are published in the local DNS. A status page lists the backends.
49 lines
2.1 KiB
HTML
49 lines
2.1 KiB
HTML
{{define "content"}}
|
|
{{with .Data}}
|
|
{{if .Note}}<p class="flash">{{.Note}}</p>{{end}}
|
|
{{range .Services}}
|
|
<section>
|
|
<h2>{{.Name}}
|
|
{{if not $.Data.Note}}{{if not .Running}}<span class="badge">not applied</span>{{else if .Up}}<span class="badge ok">up</span>{{else}}<span class="badge bad">down</span>{{end}}{{end}}
|
|
</h2>
|
|
<dl>
|
|
<dt>Listens on</dt><dd>port {{.Port}} in {{.Zones}}</dd>
|
|
<dt>TLS</dt><dd>{{if eq .TLS "terminate"}}decrypted on the router{{else if eq .TLS "passthrough"}}passed through{{else}}none{{end}}, {{.Protocol}}</dd>
|
|
{{if .Hosts}}<dt>Names</dt><dd>{{.Hosts}}</dd>{{end}}
|
|
<dt>Balancing</dt><dd>{{.Balance}}</dd>
|
|
</dl>
|
|
{{if .Servers}}
|
|
<table>
|
|
<thead><tr><th>Backend</th><th>Address</th><th>State</th><th>Last check</th><th>Connections</th><th>In this state</th></tr></thead>
|
|
<tbody>
|
|
{{range .Servers}}<tr>
|
|
<td>{{.Name}}</td><td>{{.Address}}</td>
|
|
<td>{{if .Up}}<span class="badge ok">{{.Status}}</span>{{else}}<span class="badge bad">{{.Status}}</span>{{end}}</td>
|
|
<td>{{.Check}}</td><td>{{.Current}} now, {{.Total}} in all</td><td>{{.Since}} s</td>
|
|
</tr>{{end}}
|
|
</tbody>
|
|
</table>
|
|
{{else if .Running}}<p class="muted">HAProxy has no backend for it.</p>{{end}}
|
|
</section>
|
|
{{else}}
|
|
<section>
|
|
<p>No load balancer is set up. A load balancer spreads the connections to a service over several hosts and leaves out a host
|
|
that fails its checks. Add one under <code>router.loadBalancers</code> in <a href="/advanced">Advanced</a>, for example:</p>
|
|
<pre class="log">"loadBalancers": {
|
|
"api": {
|
|
"listen": { "port": 8443, "zones": ["wan", "lan"] },
|
|
"tls": "terminate",
|
|
"hosts": ["api.example.org"],
|
|
"backends": ["hv1", "hv2"],
|
|
"backendTls": { "enable": true },
|
|
"check": { "path": "/healthz" }
|
|
}
|
|
}</pre>
|
|
<p>The backends are names of DHCP reservations or addresses. With <code>"tls": "passthrough"</code> the backends keep their
|
|
certificate and the router only forwards; the client's address then reaches them with <code>"proxyProtocol": true</code>
|
|
(if they read it). Saved changes take effect when you apply them.</p>
|
|
</section>
|
|
{{end}}
|
|
{{end}}
|
|
{{end}}
|