forked from unionlabs/union
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
81 lines (69 loc) · 3.55 KB
/
Copy pathMakefile
File metadata and controls
81 lines (69 loc) · 3.55 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
# union-voyager Makefile
#
# Wrapper around nix build for the Voyager IBC relayer.
# Supported systems: x86_64-linux, aarch64-linux, aarch64-darwin (M-series Mac).
# Intel Mac (x86_64-darwin) is not supported by the upstream nix flake.
SHELL := /bin/bash
.SHELLFLAGS := -o pipefail -c
# Make recipes can use `voyager` directly without the full path.
export PATH := $(CURDIR)/result-voyager/bin:$(PATH)
VOYAGER_LOG := voyager.log
VOYAGER_MODULES_LOG := voyager-modules-plugins.log
VOYAGER_RUN_LOG := voyager-run.log
.PHONY: help build-voyager build-plugins init run run-reset stop
help:
@echo "Targets:"
@echo " build-voyager — build voyager in the background (nohup)"
@echo " build-plugins — build voyager-modules-plugins in the background (nohup)"
@echo " init — symlink nix store binaries to target/debug/ after build completes"
@echo " run — start voyager in the background (nohup)"
@echo " run-reset — truncate the voyager queue then start voyager"
@echo " stop — kill the running voyager process"
@echo ""
@echo "Logs:"
@echo " voyager build output → $(VOYAGER_LOG)"
@echo " voyager-modules-plugins output → $(VOYAGER_MODULES_LOG)"
@echo " voyager runtime output → $(VOYAGER_RUN_LOG)"
stop:
@pgrep voyager >/dev/null 2>&1 || { echo "voyager is not running"; exit 0; }
@kill $$(pgrep voyager)
@echo "ok: voyager stopped"
run-reset:
@command -v voyager >/dev/null 2>&1 || { \
echo "ERROR: voyager not found. Run 'make build' first."; exit 1; }
@echo ">> truncating queue"
@voyager queue truncate --queue --done --optimize --failed --config-file-path voyager/config.jsonc
@echo "ok: queue truncated"
@RUST_LOG=info nohup voyager --config-file-path voyager/config.jsonc start > $(VOYAGER_RUN_LOG) 2>&1 &
@echo ">> voyager started (pid: $$!)"
@echo " tail -f $(VOYAGER_RUN_LOG)"
run:
@command -v nix >/dev/null 2>&1 || { \
echo "ERROR: 'nix' not found on PATH. Install Nix from https://nixos.org/download"; exit 1; }
@command -v voyager >/dev/null 2>&1 || { \
echo "ERROR: voyager not found. Run 'make build' first."; exit 1; }
@RUST_LOG=info nohup voyager --config-file-path voyager/config.jsonc start > $(VOYAGER_RUN_LOG) 2>&1 &
@echo ">> voyager started (pid: $$!)"
@echo " tail -f $(VOYAGER_RUN_LOG)"
init:
@[ -f ./result-voyager/bin/voyager ] || { \
echo "ERROR: voyager binary not found. Run 'make build-voyager' and wait for it to complete."; exit 1; }
@[ -d ./result-plugins/bin ] || { \
echo "ERROR: plugins not found. Run 'make build-plugins' and wait for it to complete."; exit 1; }
@echo ">> symlinking voyager modules to target/debug/"
@mkdir -p target/debug && \
for bin in $(CURDIR)/result-plugins/bin/voyager-*; do ln -sf "$$bin" "target/debug/$$(basename $$bin)"; done
@echo "ok: $$(ls target/debug/ | wc -l) symlinks created in target/debug/"
@echo ""
@echo " to use voyager in your shell:"
@echo " export PATH=\$$PATH:$(CURDIR)/result-voyager/bin"
build-voyager:
@command -v nix >/dev/null 2>&1 || { \
echo "ERROR: 'nix' not found on PATH. Install Nix from https://nixos.org/download"; exit 1; }
@nohup nix build .#voyager -L --out-link result-voyager > $(VOYAGER_LOG) 2>&1 &
@echo "ok: voyager build started (tail -f $(VOYAGER_LOG))"
build-plugins:
@command -v nix >/dev/null 2>&1 || { \
echo "ERROR: 'nix' not found on PATH. Install Nix from https://nixos.org/download"; exit 1; }
@nohup nix build .#voyager-modules-plugins -L --out-link result-plugins > $(VOYAGER_MODULES_LOG) 2>&1 &
@echo "ok: plugins build started (tail -f $(VOYAGER_MODULES_LOG))"