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: 2 additions & 0 deletions .github/workflows/tag.yml
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,8 @@ jobs:
with:
context: .
file: Dockerfile
build-args: |
SPLATTER_VERSION=${{ github.ref_name }}
push: true
platforms: linux/amd64
cache-from: type=gha
Expand Down
6 changes: 6 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
##
## Build the Rust compute-node binary (splatter-bin)
##
ARG SPLATTER_VERSION=0.0.0-local
FROM --platform=$BUILDPLATFORM rust:1.89-bullseye AS rust-build
ARG SPLATTER_VERSION
ENV SPLATTER_VERSION="${SPLATTER_VERSION}"
WORKDIR /app
COPY server/rust/ server/rust/
RUN cargo build --release -p splatter-bin --manifest-path server/rust/Cargo.toml
Expand All @@ -11,6 +14,9 @@ RUN cargo build --release -p splatter-bin --manifest-path server/rust/Cargo.toml
##
FROM ghcr.io/nerfstudio-project/nerfstudio:latest

ARG SPLATTER_VERSION
ENV SPLATTER_SERVER_VERSION="${SPLATTER_VERSION}"

ARG USERNAME=splatter-server
ARG USER_UID=1000
ARG USER_GID=$USER_UID
Expand Down
1 change: 0 additions & 1 deletion server/rust/.env.example
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,4 @@ SECP256K1_PRIVHEX=00000000000000000000000000000000000000000000000000000000000000

# Optional quality-of-life settings
LOG_FORMAT=json
NODE_VERSION=v0.0.0
ENABLE_NOOP=false
1 change: 1 addition & 0 deletions server/rust/Cargo.lock

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

3 changes: 3 additions & 0 deletions server/rust/bin/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -13,3 +13,6 @@ tracing = "0.1.40"

posemesh-compute-node = { version = "=0.3.1" }
splatter-runner = { path = "../runner" }

[build-dependencies]
semver = "1"
30 changes: 30 additions & 0 deletions server/rust/bin/build.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
use std::env;

fn normalize_version(raw: &str) -> Option<String> {
let trimmed = raw.trim();
if trimmed.is_empty() {
return None;
}

let normalized = trimmed
.strip_prefix('v')
.or_else(|| trimmed.strip_prefix('V'))
.unwrap_or(trimmed);

if semver::Version::parse(normalized).is_ok() {
Some(normalized.to_string())
} else {
None
}
}

fn main() {
println!("cargo:rerun-if-env-changed=SPLATTER_VERSION");

let raw = env::var("SPLATTER_VERSION").unwrap_or_else(|_| "0.0.0-local".to_string());
let normalized = normalize_version(&raw).unwrap_or_else(|| {
panic!("Invalid SPLATTER_VERSION={raw:?}. Expected semver like 0.3.0 or v0.3.0")
});

println!("cargo:rustc-env=SPLATTER_NODE_VERSION={normalized}");
}
5 changes: 4 additions & 1 deletion server/rust/bin/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ use std::path::PathBuf;
use tracing::info;
use tracing::warn;

const SPLATTER_NODE_VERSION: &str = env!("SPLATTER_NODE_VERSION");

fn tasks_cleanup_disabled() -> bool {
match env::var("DISABLE_TASKS_CLEANUP") {
Ok(v) => matches!(v.to_ascii_lowercase().as_str(), "1" | "true" | "yes" | "on"),
Expand Down Expand Up @@ -55,7 +57,8 @@ async fn main() -> Result<()> {
let _ = axum::serve(listener, app).await;
});

let cfg = posemesh_compute_node::config::NodeConfig::from_env()?;
let mut cfg = posemesh_compute_node::config::NodeConfig::from_env()?;
cfg.node_version = SPLATTER_NODE_VERSION.to_string();

let registry: RunnerRegistry = splatter_runner::registry();
let capabilities = registry.capabilities();
Expand Down
684 changes: 393 additions & 291 deletions server/rust/runner/src/lib.rs

Large diffs are not rendered by default.

Loading