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
32 changes: 16 additions & 16 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ members = [
]

[workspace.package]
version = "0.2.29"
version = "0.2.30"
edition = "2024"
license = "MIT"
repository = "https://github.com/profullstack/c0mpute"
Expand Down
2 changes: 1 addition & 1 deletion apps/tui/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@c0mpute/tui",
"version": "0.2.29",
"version": "0.2.30",
"private": true,
"type": "module",
"bin": {
Expand Down
2 changes: 1 addition & 1 deletion apps/web/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "c0mpute",
"version": "0.2.29",
"version": "0.2.30",
"private": true,
"type": "module",
"scripts": {
Expand Down
2 changes: 1 addition & 1 deletion apps/web/src/app/releases/latest.json/route.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ export const dynamic = "force-dynamic";
* this in sync with the workspace version in `Cargo.toml` on each release so a
* freshly built CLI reports "already latest" rather than a phantom upgrade.
*/
const FALLBACK_VERSION = "0.2.29";
const FALLBACK_VERSION = "0.2.30";
const FALLBACK_MIN_REQUIRED = "0.0.1";

type Channel = "stable" | "beta" | "nightly";
Expand Down
29 changes: 28 additions & 1 deletion node/crates/c0mpute-cli/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2199,6 +2199,10 @@ fn ensure_infernet_daemon() {
if which_on_path("infernet").is_none() || !infernet_initialized() {
return;
}
if infernet_systemd_managed() {
tracing::info!("infernet daemon is managed by infernet.service; not starting another");
return;
}
tracing::info!("ensuring infernet node daemon is running");
let _ = infernet_cmd(&["start"]);
}
Expand Down Expand Up @@ -2681,7 +2685,8 @@ fn refresh_plugins() {
if let Some(path) = which_on_path(bin) {
// `infernet update` has no version check: every call reinstalls and restarts the
// daemon. Only run it when npm has something newer than what is installed.
if *bin == "infernet" && !infernet_update_available() {
// A systemd-managed daemon updates itself; `infernet update` would restart it from here.
if *bin == "infernet" && (infernet_systemd_managed() || !infernet_update_available()) {
continue;
}
tracing::debug!(plugin = bin, "checking plugin for upgrades");
Expand All @@ -2695,6 +2700,19 @@ fn refresh_plugins() {
}
}

/// True when a systemd `infernet.service` is running the node daemon. That unit owns the daemon
/// (and the daemon auto-updates itself), so the worker must not start, update or restart another
/// one: two daemons on one config dir fight over the socket, port and pidfile.
fn infernet_systemd_managed() -> bool {
Command::new("systemctl")
.args(["is-active", "--quiet", "infernet.service"])
.stdin(std::process::Stdio::null())
.stdout(std::process::Stdio::null())
.stderr(std::process::Stdio::null())
.status()
.is_ok_and(|s| s.success())
}

/// npm package the infernet installer pulls (`npm install -g @infernetprotocol/cli`).
const INFERNET_NPM_LATEST: &str = "https://registry.npmjs.org/@infernetprotocol/cli/latest";

Expand Down Expand Up @@ -2764,6 +2782,11 @@ fn reap_stale_infernet_daemons() {
return;
}
let me = unsafe { libc::getuid() };
// Only daemons this worker started (they share its cgroup): a daemon run by infernet.service or
// by hand is someone else's to manage.
let Ok(own_cgroup) = std::fs::read_to_string("/proc/self/cgroup") else {
return;
};
let Ok(dir) = std::fs::read_dir("/proc") else {
return;
};
Expand All @@ -2784,6 +2807,10 @@ fn reap_stale_infernet_daemons() {
};
if !is_infernet_daemon_cmdline(&cmdline)
|| entry.metadata().map(|m| m.uid()).ok() != Some(me)
|| std::fs::read_to_string(entry.path().join("cgroup"))
.ok()
.as_deref()
!= Some(own_cgroup.as_str())
{
continue;
}
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "c0mpute-monorepo",
"version": "0.2.29",
"version": "0.2.30",
"private": true,
"workspaces": [
"apps/*",
Expand Down
2 changes: 1 addition & 1 deletion packages/shared/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@c0mpute/shared",
"version": "0.2.29",
"version": "0.2.30",
"private": true,
"type": "module",
"main": "./dist/index.js",
Expand Down
Loading