From 9e5a8dce5180d664abd7b65bb02a1b17ddeda778 Mon Sep 17 00:00:00 2001 From: Ryan Butler Date: Tue, 10 Dec 2024 03:38:59 -0600 Subject: [PATCH] chore(backend-state): move to /usr/local/bin and add .service file (#315) chore(backend-state): correct path and add .service file --- Cargo.lock | 18 +++++++++--------- Cargo.toml | 1 + backend-state/Cargo.toml | 15 +++++++++++---- ...ckend-state.worldcoin-backend-state.service | 15 +++++++++++++++ backend-state/src/api.rs | 2 +- header-parsing/Cargo.toml | 2 +- 6 files changed, 38 insertions(+), 15 deletions(-) create mode 100644 backend-state/debian/orb-backend-state.worldcoin-backend-state.service diff --git a/Cargo.lock b/Cargo.lock index d66fd0b0..20b5c4f0 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -2811,13 +2811,6 @@ dependencies = [ "num-traits", ] -[[package]] -name = "header-parsing" -version = "0.0.0" -dependencies = [ - "http 0.2.11", -] - [[package]] name = "heck" version = "0.4.1" @@ -4381,15 +4374,15 @@ dependencies = [ [[package]] name = "orb-backend-state" -version = "0.0.4" +version = "0.0.5" dependencies = [ "clap", "color-eyre", "derive_more", "futures", - "header-parsing", "orb-attest-dbus", "orb-build-info 0.0.0", + "orb-header-parsing", "orb-security-utils", "reqwest", "tokio", @@ -4469,6 +4462,13 @@ dependencies = [ "url", ] +[[package]] +name = "orb-header-parsing" +version = "0.0.0" +dependencies = [ + "http 0.2.11", +] + [[package]] name = "orb-hil" version = "0.0.0" diff --git a/Cargo.toml b/Cargo.toml index 14818c36..652fdf8c 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -93,6 +93,7 @@ orb-slot-ctrl.path = "slot-ctrl" orb-telemetry.path = "telemetry" orb-update-agent-core.path = "update-agent/core" orb-zbus-proxies.path = "zbus-proxies" +orb-header-parsing.path = "header-parsing" [workspace.dependencies.orb-messages] git = "https://github.com/worldcoin/orb-messages" diff --git a/backend-state/Cargo.toml b/backend-state/Cargo.toml index 2d749500..8dd1841f 100644 --- a/backend-state/Cargo.toml +++ b/backend-state/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "orb-backend-state" -version = "0.0.4" +version = "0.0.5" description = "Systemd service that reads current orb state from orb-manager backend" authors = ["Ryan Butler "] publish = false @@ -19,9 +19,9 @@ clap.workspace = true color-eyre.workspace = true derive_more.workspace = true futures.workspace = true -header-parsing.path = "../header-parsing" +orb-header-parsing.workspace = true orb-attest-dbus.workspace = true -orb-build-info.path = "../build-info" +orb-build-info.workspace = true orb-security-utils = { workspace = true, features = ["reqwest"] } reqwest.workspace = true tokio.workspace = true @@ -30,6 +30,13 @@ tracing.workspace = true zbus.workspace = true [build-dependencies] -orb-build-info = { path = "../build-info", features = ["build-script"] } +orb-build-info = { workspace = true, features = ["build-script"] } [package.metadata.deb] +assets = [ + ["target/release/orb-backend-state", "/usr/local/bin/", "755"] +] +maintainer-scripts = "debian/" +systemd-units = [ + { unit-name = "worldcoin-backend-state" }, +] diff --git a/backend-state/debian/orb-backend-state.worldcoin-backend-state.service b/backend-state/debian/orb-backend-state.worldcoin-backend-state.service new file mode 100644 index 00000000..abb2eab2 --- /dev/null +++ b/backend-state/debian/orb-backend-state.worldcoin-backend-state.service @@ -0,0 +1,15 @@ +[Unit] +Description=Worldcoin Backend State +Requires=worldcoin-backend-online.target +After=wordcoin-backend-online.target + +[Service] +Type=simple +User=worldcoin +Environment=DBUS_SESSION_BUS_ADDRESS=unix:path=/tmp/worldcoin_bus_socket +Environment=RUST_BACKTRACE=1 +SyslogIdentifier=worldcoin-backend-state +ExecStart=/usr/local/bin/orb-backend-state + +[Install] +WantedBy=multi-user.target diff --git a/backend-state/src/api.rs b/backend-state/src/api.rs index 952f9788..2ba74033 100644 --- a/backend-state/src/api.rs +++ b/backend-state/src/api.rs @@ -4,7 +4,7 @@ use std::sync::OnceLock; use color_eyre::{eyre::WrapErr, Result}; use derive_more::{Display, From}; -use header_parsing::time_until_max_age; +use orb_header_parsing::time_until_max_age; use crate::state::State; diff --git a/header-parsing/Cargo.toml b/header-parsing/Cargo.toml index 5fe0d2b0..a0f9af0e 100644 --- a/header-parsing/Cargo.toml +++ b/header-parsing/Cargo.toml @@ -1,5 +1,5 @@ [package] -name = "header-parsing" +name = "orb-header-parsing" version = "0.0.0" description = "Common header parsing functionality" authors = ["Ryan Butler