2.2 KiB · text History e832e77
set shell := ["bash", "-cu"]

# Default: list recipes
default:
    @just --list

# Build everything
build:
    cargo build --workspace

# Run all unit tests
test:
    cargo test --workspace

# Cross-build a release arm64 (aarch64 glibc) agent binary via `cross` + podman.
# Requires: `cargo install cross` and podman. Output:
#   target/aarch64-unknown-linux-gnu/release/devendra-agent
build-agent-arm64:
    CROSS_CONTAINER_ENGINE=podman cross build --release \
        -p devendra-agent \
        --target aarch64-unknown-linux-gnu

# Build a native (amd64) .deb of the agent. Requires `cargo install cargo-deb`.
# Output: target/debian/devendra-agent_<ver>_amd64.deb
deb:
    cargo deb -p devendra-agent

# Build an arm64 .deb: cross-compile first, then package without rebuilding.
# Requires cargo-deb + the build-agent-arm64 prerequisites (cross + podman).
# Output: target/debian/devendra-agent_<ver>_arm64.deb
deb-arm64: build-agent-arm64
    cargo deb -p devendra-agent --no-build --target aarch64-unknown-linux-gnu

# Format, lint, test
check:
    cargo fmt --all
    cargo clippy --workspace --all-targets
    cargo test --workspace

# Serve the controller web UI (publishes ./config first). http://127.0.0.1:3900
serve:
    cargo run -p devendra-controller -- serve

# Print the agent join ticket
ticket:
    cargo run -p devendra-controller -- ticket

# Publish ./config to the document without serving
publish:
    cargo run -p devendra-controller -- publish

# Run an agent for HOST using TICKET. Writes its store under ./data-agent.
# WARNING: this reconciles the *local* machine's files + systemd units.
# Usage: just agent web-01 'devendra-doc-ticket...'
agent host ticket:
    cargo run -p devendra-agent -- run \
        --host-id {{host}} \
        --ticket '{{ticket}}' \
        --data-dir ./data-agent

# Adopt existing files on THIS machine into a proposal for HOST. Scans DIR
# (default /etc/containers/systemd). Review + accept in the controller UI.
# Usage: just adopt web-01 'ticket...' [/etc/containers/systemd]
adopt host ticket dir="/etc/containers/systemd":
    cargo run -p devendra-agent -- adopt \
        --host-id {{host}} \
        --ticket '{{ticket}}' \
        --data-dir ./data-agent \
        --dir {{dir}}