Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion crates/berth-api/src/types.rs
Original file line number Diff line number Diff line change
Expand Up @@ -588,7 +588,7 @@ pub struct Action {
pub label: String,
#[serde(default)]
pub help: String,
/// The group of the page it is listed in; `System` when empty.
/// The group of the page it is listed in; `Host` when empty.
#[serde(default)]
pub group: String,
#[serde(default)]
Expand Down
2 changes: 1 addition & 1 deletion crates/berth-core/src/host_type.rs
Original file line number Diff line number Diff line change
Expand Up @@ -280,7 +280,7 @@ pub fn rename_action() -> Action {
name: "rename".into(),
label: "Rename".into(),
help: "Give the host another name in berth. Its profile, passwords, host keys, machine record, messages and jobs go with it. The machine itself stays as it is and keeps running, and so does its hostname unless hostname says otherwise.".into(),
group: "Set-Up".into(),
group: "Host".into(),
role: Role::Admin,
arguments: vec![
berth_api::Argument {
Expand Down
7 changes: 5 additions & 2 deletions crates/berth-tui/src/host.rs
Original file line number Diff line number Diff line change
Expand Up @@ -638,9 +638,12 @@ pub fn groups(host: &HostView, terminal_user: &str) -> Vec<(String, Vec<(String,
.map(|group| (group.title, group.rows))
.collect();
let terminal = (format!(" ▸ Terminal · as {terminal_user}"), Pick::Terminal);
match groups.iter_mut().find(|(title, _)| title == "System") {
match groups
.iter_mut()
.find(|(title, _)| title == page::HOST_GROUP)
{
Some((_, rows)) => rows.insert(1.min(rows.len()), terminal),
None => groups.insert(0, ("System".to_owned(), vec![terminal])),
None => groups.insert(0, (page::HOST_GROUP.to_owned(), vec![terminal])),
}
if !host.sessions.is_empty() {
let rows = host
Expand Down
10 changes: 7 additions & 3 deletions crates/berth-tui/src/page.rs
Original file line number Diff line number Diff line change
Expand Up @@ -36,12 +36,16 @@ pub struct Group<E> {

/// The group an action is listed in.
pub fn group_of(action: &Action) -> &str {
match action.group.is_empty() {
true => "System",
false => &action.group,
match action.group.as_str() {
// A controller applied by an earlier berth says System for these.
"" | "System" => HOST_GROUP,
group => group,
}
}

/// The group of what a host does that belongs to no other group.
pub const HOST_GROUP: &str = "Host";

/// What a row says of an action that cannot run now; its help says why.
pub const UNAVAILABLE: &str = " · not now";

Expand Down
2 changes: 1 addition & 1 deletion docs/content/docs/(guide)/extend/writing-plugins.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ An action becomes an action of the host's controller named `PLUGIN:ACTION`. Appl
arguments: { type: 'Argument[]', description: 'Values asked for before it runs: {name, label, required, default, choices}.' },
confirm: { type: 'string', description: 'A sentence to confirm before it runs, for something that cannot be taken back.' },
terminal: { type: 'boolean', default: 'false', description: 'For a command that asks something or shows a link to follow, such as a sign-in.' },
group: { type: 'string', description: 'The overview group: System, Access, Sync, Sign-In, or your own. Default: a group named after the plugin.' },
group: { type: 'string', description: 'The overview group: Host, Power, Access, Sync, Sign-In, or your own. Default: a group named after the plugin.' },
extends: { type: 'string | string[]', description: 'Run as a step after status, smoke, update, secrets or sign-in:status instead of having a row of its own.' },
}}
/>
Expand Down
2 changes: 1 addition & 1 deletion docs/content/docs/(guide)/index.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import { Cloud, Container, Server, Usb } from 'lucide-react';

berth sets up Ubuntu 26.04 amd64 machines for coding agents and manages them from your own computer. Each machine, a *host*, gets a desktop you can watch from the browser and the agents you choose. berth's terminal UI has a page per host for status, sign-ins, updates and secrets.

<Screen name="overview" alt="The overview of a host in berth: its connection, and actions grouped under System, Access, Sync, Sign-In, Backup and Set-Up" />
<Screen name="overview" alt="The overview of a host in berth: its connection, and actions grouped under Host, Power, Access, Sync, Sign-In, Backup and Set-Up" />

## On each host

Expand Down
2 changes: 1 addition & 1 deletion docs/content/docs/(guide)/use/overview.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ icon: LayoutDashboard

Opening an installed host shows its overview, with the connection at the top and the host's actions in groups below. The host's controller reports its own actions, and the list changes with what is installed there.

<Screen name="overview" alt="The overview of a host: connection settings, then System, Access, Sync, Sign-In, Backup and Set-Up groups" />
<Screen name="overview" alt="The overview of a host: connection settings, then Host, Power, Access, Sync, Sign-In, Backup and Set-Up groups" />

The line under the title is the host's load, CPU, memory, disk and uptime. Under **Connection**, a line says the host's [type](/docs/use/types), and what the host itself was seen to be when that differs.

Expand Down
2 changes: 1 addition & 1 deletion docs/openapi/berth.openapi.json
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@
]
},
"group": {
"description": "The group of the page it is listed in; `System` when empty.",
"description": "The group of the page it is listed in; `Host` when empty.",
"type": "string"
},
"help": {
Expand Down
2 changes: 1 addition & 1 deletion docs/openapi/berth.operations.json
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@
]
},
"group": {
"description": "The group of the page it is listed in; `System` when empty.",
"description": "The group of the page it is listed in; `Host` when empty.",
"type": "string"
},
"help": {
Expand Down
50 changes: 25 additions & 25 deletions provision/ansible/roles/devbox/vars/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,30 +5,30 @@ devbox_task_dir: /usr/local/lib/berth/tasks
devbox_core_tasks:
- name: status
label: Status
group: System
group: Host
user: root
help: Provisioning state, services, graphics renderer, disk space and failed units, followed by the access links and what the plugins of this host report.
run: "{{ devbox_task_dir }}/status.sh"
- name: smoke
label: Self-Test
group: System
group: Host
user: agent
agent: true
help: "Run devbox-smoke as the agent: graphics, browser, office tools and the coding agents. The plugins of this host add their own checks."
run: devbox-smoke
- name: update
label: Update
group: System
user: root
help: apt update and dist-upgrade on the host, then what the plugins of this host keep up to date. Says whether a reboot is needed afterwards.
run: "{{ devbox_task_dir }}/update.sh"
- name: reboot
label: Reboot
group: System
group: Power
user: root
confirm: Restart the host? Everything running on it ends, sessions included.
help: Restart the host.
run: "{{ devbox_task_dir }}/reboot.sh"
- name: update
label: Update
group: Sync
user: root
help: apt update and dist-upgrade on the host, then what the plugins of this host keep up to date. Says whether a reboot is needed afterwards.
run: "{{ devbox_task_dir }}/update.sh"
- name: access
label: Access links and desktop password
group: Access
Expand Down Expand Up @@ -66,23 +66,23 @@ devbox_core_tasks:
devbox_controller_tasks:
- name: status
label: Status
group: System
group: Host
user: root
help: The host, how long it has been up, the state of SSH and berthd, disk space and failed units.
run: "{{ devbox_task_dir }}/status.sh controller"
- name: update
label: Update
group: System
user: root
help: apt update and dist-upgrade on the host. Says whether a reboot is needed afterwards.
run: "{{ devbox_task_dir }}/update.sh"
- name: reboot
label: Reboot
group: System
group: Power
user: root
confirm: Restart the host? Everything running on it ends, sessions included.
help: Restart the host.
run: "{{ devbox_task_dir }}/reboot.sh"
- name: update
label: Update
group: Sync
user: root
help: apt update and dist-upgrade on the host. Says whether a reboot is needed afterwards.
run: "{{ devbox_task_dir }}/update.sh"
- name: secrets
label: Secrets and registry logins
group: Sync
Expand All @@ -96,23 +96,23 @@ devbox_controller_tasks:
devbox_node_tasks:
- name: status
label: Status
group: System
group: Host
user: root
help: The node, how long it has been up, the state of SSH, berthd, the firewall and the tailnet, disk space and failed units, followed by what its features report.
run: "{{ devbox_task_dir }}/status.sh node"
- name: update
label: Update
group: System
user: root
help: apt update and dist-upgrade on the node, then what its features keep up to date. Says whether a reboot is needed afterwards.
run: "{{ devbox_task_dir }}/update.sh"
- name: reboot
label: Reboot
group: System
group: Power
user: root
confirm: Restart the node? Everything running on it ends, sessions and the machines it hosts included.
help: Restart the node.
run: "{{ devbox_task_dir }}/reboot.sh"
- name: update
label: Update
group: Sync
user: root
help: apt update and dist-upgrade on the node, then what its features keep up to date. Says whether a reboot is needed afterwards.
run: "{{ devbox_task_dir }}/update.sh"
- name: secrets
label: Secrets and registry logins
group: Sync
Expand Down
4 changes: 2 additions & 2 deletions tests/e2e/e2e_host.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@ def setUpClass(cls):

def test_tasks_are_listed_by_group(self):
listed = json.loads(self.station.berth('action', 'list', HOST, '-o', 'json').stdout)
groups = {action['group'] or 'System' for action in listed}
self.assertLessEqual({'System', 'Sync', 'Sign-In'}, groups)
groups = {action['group'] or 'Host' for action in listed}
self.assertLessEqual({'Host', 'Power', 'Sync', 'Sign-In'}, groups)
secrets = next(action for action in listed if action['name'] == 'secrets')
self.assertEqual(secrets['label'], 'Secrets and registry logins')
self.assertRegex(self.station.berth('action', 'list', HOST).stdout, r'(?m)^secrets\s+')
Expand Down
2 changes: 1 addition & 1 deletion tests/test_environment.py
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@ def test_shipped_plugins_make_valid_tasks(self):
def test_core_tasks_name_installed_scripts(self):
tasks = yaml.safe_load((ROLE / 'vars/main.yml').read_text())['devbox_core_tasks']
names = [task['name'] for task in tasks]
self.assertEqual(names, ['status', 'smoke', 'update', 'reboot', 'access', 'publish', 'pair',
self.assertEqual(names, ['status', 'smoke', 'reboot', 'update', 'access', 'publish', 'pair',
'secrets', 'sign-in:status'])
for task in tasks:
with self.subTest(task=task['name']):
Expand Down
2 changes: 1 addition & 1 deletion tests/test_node.py
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ def test_a_node_is_not_applied_over_a_workstation(self):

def test_the_actions_of_a_node_run_what_it_installs(self):
actions = {task['name']: task for task in yaml.safe_load((ROLE / 'vars/main.yml').read_text())['devbox_node_tasks']}
self.assertEqual(list(actions), ['status', 'update', 'reboot', 'secrets', 'upgrade-server'])
self.assertEqual(list(actions), ['status', 'reboot', 'update', 'secrets', 'upgrade-server'])
self.assertTrue(actions['status']['run'].endswith('/status.sh node'))
self.assertIn('if [[ ${1:-} == node ]]', (ROLE / 'files/tasks/status.sh').read_text())
upgrade = actions['upgrade-server']
Expand Down
Loading