- Auth: move from state.json to SQLite authed_chats table, with memory cache - Remove Persistent/state.json, all state now in noc.db - HTTP API: POST /api/chat (end-to-end LLM), GET /api/logs (failed API requests) - API logging: store raw request/response for 400 errors in api_log table - Agent completion: spawn_agent sends LifeEvent::AgentDone via channel, life loop picks up with full conversation context and responds - Config structs: derive Clone for HTTP server - System prompt: instruct LLM not to add timestamps - Makefile: rsync without --delete to preserve VPS-only tools
58 lines
2.2 KiB
Makefile
58 lines
2.2 KiB
Makefile
REPO := $(shell pwd)
|
|
SUITE := noc
|
|
HERA := heradev
|
|
HERA_DIR := noc
|
|
IMAGE := noc-suite
|
|
|
|
.PHONY: build build-musl test deploy deploy-hera docker
|
|
|
|
build:
|
|
cargo build --release
|
|
|
|
build-musl:
|
|
cargo build --release --target x86_64-unknown-linux-musl
|
|
strip target/x86_64-unknown-linux-musl/release/noc
|
|
|
|
test:
|
|
cargo clippy -- -D warnings
|
|
cargo test -- --nocapture
|
|
|
|
# ── docker ──────────────────────────────────────────────────────────
|
|
|
|
docker: build-musl
|
|
cp target/x86_64-unknown-linux-musl/release/noc deploy/noc
|
|
cp -r tools deploy/tools
|
|
cp config.example.yaml deploy/config.example.yaml
|
|
sudo docker build -t $(IMAGE) deploy/
|
|
rm -f deploy/noc deploy/config.example.yaml
|
|
rm -rf deploy/tools
|
|
|
|
# ── systemd deploy ──────────────────────────────────────────────────
|
|
|
|
deploy: test build
|
|
ssh $(SUITE) 'mkdir -p ~/bin /data/noc/tools ~/.config/systemd/user && systemctl --user stop noc 2>/dev/null || true'
|
|
scp target/release/noc $(SUITE):~/bin/
|
|
scp config.suite.yaml $(SUITE):/data/noc/config.yaml
|
|
scp noc.service.in $(SUITE):/data/noc/
|
|
rsync -a tools/ $(SUITE):/data/noc/tools/
|
|
ssh $(SUITE) 'bash -lc "\
|
|
cd /data/noc \
|
|
&& sed -e \"s|@REPO@|/data/noc|g\" -e \"s|@PATH@|\$$PATH|g\" noc.service.in > ~/.config/systemd/user/noc.service \
|
|
&& systemctl --user daemon-reload \
|
|
&& systemctl --user enable --now noc \
|
|
&& systemctl --user restart noc \
|
|
&& systemctl --user status noc"'
|
|
|
|
deploy-hera: build
|
|
ssh $(HERA) 'mkdir -p ~/bin ~/$(HERA_DIR) ~/.config/systemd/user && systemctl --user stop noc 2>/dev/null || true'
|
|
scp target/release/noc $(HERA):~/bin/
|
|
scp config.hera.yaml noc.service.in $(HERA):~/$(HERA_DIR)/
|
|
ssh $(HERA) 'bash -lc "\
|
|
cd ~/$(HERA_DIR) \
|
|
&& mv -f config.hera.yaml config.yaml \
|
|
&& sed -e \"s|@REPO@|\$$HOME/$(HERA_DIR)|g\" -e \"s|@PATH@|\$$PATH|g\" noc.service.in > ~/.config/systemd/user/noc.service \
|
|
&& systemctl --user daemon-reload \
|
|
&& systemctl --user enable --now noc \
|
|
&& systemctl --user restart noc \
|
|
&& systemctl --user status noc"'
|