| 1 |
{% extends "base.html" %} |
| 2 |
{% block title %}Runners · Administration{% endblock %} |
| 3 |
{% block mainclass %} class="wide"{% endblock %} |
| 4 |
{% block content %} |
| 5 |
<div class="head"><h1>Runners <small>{{ runners.len()|plural("runner", "runners") }} · <a href="/admin">Administration</a></small></h1></div> |
| 6 |
{% if let Some(n) = notice %}<p class="note">{{ n }}</p>{% endif %} |
| 7 |
{% if let Some(e) = error %}<p class="error">{{ e }}</p>{% endif %} |
| 8 |
{% if let Some(t) = new_token %} |
| 9 |
<section class="panel strip ok"> |
| 10 |
<h2>Registration token</h2> |
| 11 |
<p>Use it once, within a day, on the machine that will run jobs. It is shown only now.</p> |
| 12 |
<pre class="snippet">flow runner register {{ hub }} --token {{ t }} --name NAME [--ca hub-ca.pem] [--label LABEL] |
| 13 |
flow runner</pre> |
| 14 |
<p class="small mute">The runner sends its signing identity when it registers; this hub accepts receipts from it signed by that key only.</p> |
| 15 |
</section> |
| 16 |
{% endif %} |
| 17 |
<section class="panel"> |
| 18 |
{% if runners.is_empty() %}<p class="mute">No runners yet. Create a registration token below and run <code>flow runner register</code> on the runner.</p>{% else %} |
| 19 |
<div class="table"><table> |
| 20 |
<tr><th>Runner</th><th>Status</th><th>Serves</th><th>Signing key</th><th>Machine</th><th>Labels</th><th>Capacity</th><th>Running</th><th>Last seen</th><th></th></tr> |
| 21 |
{% for row in runners %}{% let r = row.r %} |
| 22 |
<tr> |
| 23 |
<td><a href="/admin/runners/{{ r.id }}"><strong>{{ r.name }}</strong></a>{% if r.source == "config" %} <span class="tag" title="Configured with a hub.toml token">hub.toml</span>{% endif %}</td> |
| 24 |
<td><span class="runner-status st-{{ r.status() }}">{{ r.status() }}</span></td> |
| 25 |
<td class="small">{{ row.scope }} |
| 26 |
<form class="tiny" method="post" action="/admin/runners/{{ r.id }}/scope" title="Empty for the whole site, an owner, or owner/repository"><input type="hidden" name="_csrf" value="{{ shell.csrf }}"><input type="text" name="scope" size="14" placeholder="owner or owner/repo"> <button>set</button></form></td> |
| 27 |
<td>{% if r.key.is_empty() %}<span class="mute" title="Bound on its first signed receipt">not yet</span>{% else %}<code title="{{ r.key }} · {{ r.key_name }}">{{ r.key|short }}</code>{% endif %}</td> |
| 28 |
<td class="small">{% if r.arch.is_empty() %}<span class="mute">unknown</span>{% else %}{{ r.arch }} · {{ r.os }} · flow {{ r.version }}{% endif %}</td> |
| 29 |
<td class="small">{% for l in r.label_list() %}<span class="lbl">{{ l }}</span> {% endfor %}</td> |
| 30 |
<td class="small">{{ r.max_jobs|plural("job", "jobs") }}{% if let Some(m) = r.memory_mib %} · {{ m }} MiB{% endif %}{% if let Some(c) = r.cpus %} · {{ c }} vCPU{% endif %}</td> |
| 31 |
<td>{{ row.running }}</td> |
| 32 |
<td class="small">{% if let Some(t) = r.last_seen_ms %}<time title="{{ t|when_i }}">{{ t|ago_i }}</time>{% else %}<span class="mute">never</span>{% endif %}</td> |
| 33 |
<td><form class="tiny" method="post" action="/admin/runners/{{ r.id }}/state"><input type="hidden" name="_csrf" value="{{ shell.csrf }}"> |
| 34 |
{% if r.state == "active" %}<button name="state" value="draining" title="Finish current jobs, take no new ones">drain</button> <button name="state" value="disabled" title="Refuse its requests at once">disable</button>{% else %}<button name="state" value="active">resume</button>{% endif %}</form> |
| 35 |
<form class="tiny" method="post" action="/admin/runners/{{ r.id }}/remove" onsubmit="return confirm('Remove {{ r.name }}? Its credential stops working; its jobs keep its name.')"><input type="hidden" name="_csrf" value="{{ shell.csrf }}"><button class="danger-btn">remove</button></form></td> |
| 36 |
</tr> |
| 37 |
{% endfor %} |
| 38 |
</table></div> |
| 39 |
{% endif %} |
| 40 |
</section> |
| 41 |
<section class="panel"> |
| 42 |
<h2>Add a runner</h2> |
| 43 |
<p class="small">A runner registers with a one-time token: it sends its signing identity, architecture and labels, and gets its own credential, kept in <code>runner.toml</code> beside its <code>flow.toml</code>.</p> |
| 44 |
<p class="small">The runner serves the whole site, one owner's repositories, or one repository; it never takes another scope's jobs.</p> |
| 45 |
<form method="post" action="/admin/runners/token"><input type="hidden" name="_csrf" value="{{ shell.csrf }}"> |
| 46 |
<label for="scope">Serves (empty for the whole site, an owner, or owner/repository)</label> |
| 47 |
<input type="text" id="scope" name="scope" placeholder="andymccall or andymccall/oxygen"> |
| 48 |
<button type="submit" class="primary-btn">Create a registration token</button></form> |
| 49 |
{% if !pending.is_empty() %}<p class="small mute">Unused tokens: {% for (by, made, expires) in pending %}by {{ by }} {{ made|ago_i }}, expires {{ expires|when_i }}{% if !loop.last %}; {% endif %}{% endfor %}</p>{% endif %} |
| 50 |
</section> |
| 51 |
{% endblock %} |