Skip to content

Commit

Permalink
update-verifier: merge into orb-software
Browse files Browse the repository at this point in the history
  • Loading branch information
TheButlah committed Sep 8, 2024
2 parents 7eb9dd9 + 966a3bd commit 18ac22f
Show file tree
Hide file tree
Showing 9 changed files with 1,183 additions and 0 deletions.
70 changes: 70 additions & 0 deletions update-verifier/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
[package]
name = "orb-update-verifier"
version = "0.2.1"
authors = [
"Mark Eder <56895722+mrkdir@users.noreply.github.com>",
]
edition = "2021"
license = "MIT OR (Apache-2.0 WITH LLVM-exception)"
description = """
Checks general system health and manages the slot and rootfs state of the Orb.
"""

[dependencies]
eyre = "0.6.8"
flume = "0.11.0"
jod-thread = "0.1.2"
libc = "0.2.137"
polling = "2.2.0"
prost = "0.12.4"
tap = "1.0.1"
tracing = "0.1.37"
tracing-journald = "0.3.0"
tracing-subscriber = { version = "0.3.16", features = ["env-filter"] }
thiserror = "1.0.37"
zbus = "4.1.2"
zbus_systemd = { version = "0.0.16", features = ["login1"] }
semver = "1.0.22"
log = "0.4.18"

[dependencies.reqwest]
version = "0.11.4"
default-features = false
features = ["blocking", "json"]

[dependencies.orb-slot-ctrl]
git = "https://github.com/worldcoin/orb-software"
rev = "7eb9dd9ce0bc92269b21815d11943ad452860bf7"

[dependencies.can]
package = "can-rs"
git = "https://github.com/worldcoin/orb-software"
rev = "7eb9dd9ce0bc92269b21815d11943ad452860bf7"

[dependencies.orb-messages]
git = "https://github.com/worldcoin/orb-messages"
rev = "449bb1c73af41334e5dc44e12f6200d315aaa9d2"

[dev-dependencies]
serde = { version = "1.0.147", features = ["derive"] }
# isahc = { version = "1.7", features = ["static-ssl"] }
httpmock = "0.6.7"
serde_json = "1.0.94"
prost-build = "0.12.4"

[package.metadata.deb]
maintainer-scripts = "debian/"
assets = [
["target/release/orb-update-verifier", "/usr/local/bin/", "755"]
]
systemd-units = [
{ unit-name = "worldcoin-update-verifier" },
]

# What we use when producing artifacts to distribute
[profile.artifact]
inherits = "release"
lto = true
strip = true
debug = false

49 changes: 49 additions & 0 deletions update-verifier/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
# orb-update-verifier
Checks general system health and manages the slot and rootfs state of the Orb.
It is designed to run as systemd oneshot service that will run once on boot.

## Systemd and integration
The systemd service configuration can be found in `debpkg/lib/systemd/system/worldcoin-update-verifier.service` and
will be packaged together with the binary in CI.

## Building

### Prerequisites
+ `rustup`: `1.25.2` (tested with 1.25, might work with older versions)
+ `rustc`: `1.67.0`
+ `ziglang`: `0.10.1`

Using Arch Linux as an example, you can install `ziglang` and `rustup` using pacman, and in turn
get the most recent version of `rustc`:

```sh
$ sudo pacman -S zig rustup
$ rustup install stable
```

```sh
$ brew install zig rustup-init
$ rustup-init
```

The easiest way to cross-compile for the orb is to use `cargo-zigbuild`, which
in turn relies on ziglang's tooling to act as a linker.

```sh
$ rustup target add aarch64-unknown-linux-gnu
$ cargo install cargo-zigbuild
```

### Compiling

```sh
$ cargo zigbuild --release --target aarch64-unknown-linux-gnu.2.27
```

### Testing

Health test can be forced by setting environment variable `UPDATE_VERIFIER_DRY_RUN`.

```sh
$ sudo UPDATE_VERIFIER_DRY_RUN="1" ./update-verifier
```
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
[Unit]
Description=Worldcoin Update Verifier Service.
After=teleport.service
StartLimitInterval=0

[Service]
Type=oneshot
User=root
ExecStart=/usr/local/bin/update-verifier
Restart=on-failure
RestartSec=10s
SyslogIdentifier=worldcoin-update-verifier

[Install]
WantedBy=multi-user.target
Loading

0 comments on commit 18ac22f

Please sign in to comment.