OXYGENHUB
◆ main oxygenflow / Makefile
1.4 KiB · Makefile · last changed feat(runner): restarts cost no job (closes #49, closes #50) 22 days ago source blame history raw
1
# OxygenFlow on Earth (docs/m0.md §6): build the runner and the guest init,
2
# install them under /home/claude/flow, re-pin flow-init in flow.toml, and
3
# restart the flow-runner service.
4
5
EARTH ?= claude@earth
6
SSH ?= ssh -i $(HOME)/.ssh/earth_claude
7
SCP ?= scp -i $(HOME)/.ssh/earth_claude
8
FLOW_HOME_ON_EARTH ?= /home/claude/flow
9
INIT := target/x86_64-unknown-linux-gnu/release/flow-init
10
11
.PHONY: build deploy-runner
12
13
build:
14
	OXY_BUILD="$$(oxy --plain describe 2>/dev/null)" cargo build --release -p flow
15
	RUSTFLAGS="-C target-feature=+crt-static" cargo build --release -p flow-init --target x86_64-unknown-linux-gnu
16
17
deploy-runner: build
18
	$(SCP) target/release/flow $(EARTH):$(FLOW_HOME_ON_EARTH)/bin/flow.new
19
	$(SCP) $(INIT) $(EARTH):$(FLOW_HOME_ON_EARTH)/bin/flow-init.new
20
	$(SSH) $(EARTH) 'set -e; cd $(FLOW_HOME_ON_EARTH); \
21
		cp -p bin/flow bin/flow.prev; cp -p bin/flow-init bin/flow-init.prev; cp -p flow.toml flow.toml.prev; \
22
		mv bin/flow.new bin/flow; mv bin/flow-init.new bin/flow-init; \
23
		h=$$(bin/flow hash bin/flow-init | cut -d" " -f1); \
24
		sed -i "s|^init = .*|init = { path = \"bin/flow-init\", blake3 = \"$$h\" }|" flow.toml; \
25
		sudo systemctl restart --no-block flow-runner; echo "flow-runner: restarting (it drains: the job it holds finishes first)"'
26
27
# Move the pinned oxygen (deps/oxygen) to its main on Earth; the next commit
28
# records the new pin. Push oxygen first.
29
.PHONY: pins
30
pins:
31
	cd deps/oxygen && oxy --plain pull origin && oxy --plain checkout