Skip to content

Commit d9dbdf4

Browse files
authored
feat: handle gondor in orb-supervisor via zoci (#1213)
* remove it from jobs-agent
1 parent 220e0fe commit d9dbdf4

15 files changed

Lines changed: 282 additions & 116 deletions

File tree

Cargo.lock

Lines changed: 19 additions & 16 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

deny.toml

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,6 @@ ignore = [
77
# List of advisories we have ignored
88
{ id = "RUSTSEC-2023-0071", reason = "we dont use rsa keys" },
99
{ id = "RUSTSEC-2026-0002", reason = "todo" },
10-
# astral-tokio-tar 0.5.6 is a transitive dep of testcontainers; upgrade blocked
11-
# until testcontainers releases a version depending on astral-tokio-tar >=0.6.0
12-
{ id = "RUSTSEC-2026-0066", reason = "transitive dep via testcontainers, low severity, no fix available upstream yet" },
1310
# rustls-webpki 0.101.7 and 0.102.8 are pulled in by older aws-sdk/reqwest 0.11
1411
# crates; upgrade blocked until those dependents update their rustls stack
1512
{ id = "RUSTSEC-2026-0049", reason = "transitive dep via aws-sdk and reqwest 0.11, low severity, upgrade blocked by upstream" },

orb-jobs-agent/src/handlers/gondor.rs

Lines changed: 0 additions & 35 deletions
This file was deleted.

orb-jobs-agent/src/handlers/mod.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@ pub mod beacon;
22
pub mod change_name;
33
pub mod check_my_orb;
44
pub mod fsck;
5-
pub mod gondor;
65
pub mod logs;
76
pub mod mcu;
87
pub mod netconfig_get;

orb-jobs-agent/src/program.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
use crate::{
22
conn_change,
33
handlers::{
4-
beacon, change_name, check_my_orb, fsck, gondor, logs, mcu, netconfig_get,
4+
beacon, change_name, check_my_orb, fsck, logs, mcu, netconfig_get,
55
netconfig_set, orb_details, read_file, read_gimbal, reboot, reset_gimbal,
66
reset_rgb_focus_calibration, sec_mcu_reboot, service, slot_switch, speed_test,
77
thermal_cam_recalibration, update_versions, wifi_ip, wipe_downloads,
@@ -57,7 +57,6 @@ pub async fn run(deps: Deps) -> Result<()> {
5757
.parallel("change_name", change_name::handler)
5858
.parallel("check_my_orb", check_my_orb::handler)
5959
.parallel("fsck", fsck::handler)
60-
.parallel("gondor", gondor::handler)
6160
.parallel("orb_details", orb_details::handler)
6261
.parallel("read_gimbal", read_gimbal::handler)
6362
.parallel("reset_gimbal", reset_gimbal::handler)

supervisor/Cargo.toml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,20 +18,23 @@ libc.workspace = true
1818
listenfd = "1.0.0"
1919
once_cell = "1.15.0"
2020
orb-build-info.workspace = true
21+
orb-info = { workspace = true, features = ["orb-id", "async"] }
2122
orb-telemetry.workspace = true
2223
tap = "1.0.1"
2324
thiserror = { workspace = true, features = ["std"] }
24-
tokio = { workspace = true, features = ["macros", "net", "rt-multi-thread"] }
25+
tokio = { workspace = true, features = ["macros", "net", "process", "rt-multi-thread"] }
2526
tokio-stream = "0.1.11"
2627
tracing = { workspace = true, features = ["attributes"] }
2728
zbus = { workspace = true, default-features = false, features = ["tokio"] }
2829
zbus_systemd = { workspace = true, features = ["systemd1", "login1"] }
30+
zenorb.workspace = true
2931

3032
[build-dependencies]
3133
orb-build-info = { workspace = true, features = ["build-script"] }
3234

3335
[dev-dependencies]
3436
dbus-launch = "0.2.0"
37+
portpicker = "0.1.1"
3538
tokio = { workspace = true, features = ["sync", "test-util"] }
3639

3740
[package.metadata.deb]

supervisor/debian/orb-supervisor.worldcoin-supervisor.service

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,16 @@
22
Description=Worldcoin Supervisor
33
After=worldcoin-dbus.socket
44
Wants=worldcoin-dbus.socket
5+
After=zenohd.service
6+
Requires=zenohd.service
57

68
[Service]
79
Type=dbus
810
BusName=org.worldcoin.OrbSupervisor1
911
SyslogIdentifier=worldcoin-supervisor
1012
Environment=DBUS_SESSION_BUS_ADDRESS=unix:path=/tmp/worldcoin_bus_socket
1113
ExecStart=/usr/local/bin/orb-supervisor
14+
SupplementaryGroups=zenohd
1215

1316
[Install]
1417
WantedBy=multi-user.target

supervisor/src/interfaces/manager.rs

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,9 @@ use tracing::{debug, info, instrument, warn};
1111
use zbus::{fdo::Error as FdoError, interface, Connection, DBusError, SignalContext};
1212
use zbus_systemd::{login1, systemd1};
1313

14-
use crate::shutdown::UnknownShutdownKind;
14+
use crate::{
15+
consts::DURATION_TO_STOP_CORE_AFTER_LAST_SIGNUP, shutdown::UnknownShutdownKind,
16+
};
1517

1618
/// The duration of time since the last "start signup" event that has to have passed
1719
/// before the update agent is permitted to start a download.
@@ -39,6 +41,7 @@ impl BusError {
3941

4042
pub struct Manager {
4143
duration_to_allow_downloads: Duration,
44+
stop_core_after_signup: Duration,
4245
last_signup_event: watch::Sender<Instant>,
4346
system_connection: Option<Connection>,
4447
}
@@ -58,6 +61,7 @@ impl Manager {
5861
);
5962
Self {
6063
duration_to_allow_downloads,
64+
stop_core_after_signup: DURATION_TO_STOP_CORE_AFTER_LAST_SIGNUP,
6165
last_signup_event: tx,
6266
system_connection: None,
6367
}
@@ -74,6 +78,14 @@ impl Manager {
7478
}
7579
}
7680

81+
#[must_use]
82+
pub fn stop_core_after_signup(self, stop_core_after_signup: Duration) -> Self {
83+
Self {
84+
stop_core_after_signup,
85+
..self
86+
}
87+
}
88+
7789
#[allow(clippy::must_use_candidate)]
7890
pub fn are_downloads_allowed(&self) -> bool {
7991
self.last_signup_event.borrow().elapsed() >= self.duration_to_allow_downloads
@@ -143,6 +155,7 @@ impl Manager {
143155
crate::tasks::update::spawn_shutdown_worldcoin_core_timer(
144156
systemd_proxy.clone(),
145157
self.last_signup_event.subscribe(),
158+
self.stop_core_after_signup,
146159
);
147160
// Wait for one second to see if worldcoin core is already shut down
148161
match tokio::time::timeout(Duration::from_secs(1), &mut shutdown_core_task)

supervisor/src/main.rs

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,10 @@ use clap::{
33
Parser,
44
};
55
use color_eyre::eyre::WrapErr as _;
6+
use orb_info::OrbId;
67
use orb_supervisor::startup::{Application, Settings};
78
use tracing::debug;
9+
use zenorb::Zenorb;
810

911
use orb_supervisor::BUILD_INFO;
1012

@@ -40,7 +42,15 @@ async fn main() -> color_eyre::Result<()> {
4042
let result = async move {
4143
let settings = Settings::default();
4244
debug!(?settings, "starting supervisor with settings");
43-
let application = Application::build(settings.clone())
45+
46+
let orb_id = OrbId::read().await.wrap_err("failed to read orb id")?;
47+
let zenorb = Zenorb::from_cfg(zenorb::default_cfg())
48+
.orb_id(orb_id)
49+
.with_name("supervisor")
50+
.await
51+
.wrap_err("failed to initialize zenorb session")?;
52+
53+
let application = Application::build(settings.clone(), zenorb)
4454
.await
4555
.wrap_err("failed to build supervisor")?;
4656

0 commit comments

Comments
 (0)