github.com/dominant-strategies/go-quai@v0.28.2/Makefile (about) 1 # This Makefile is meant to be used by people that do not usually work 2 # with Go source code. If you know what GOPATH is then you probably 3 # don't need to bother with make. 4 5 .PHONY: go-quai all clean 6 7 GOBIN = ./build/bin 8 GO ?= latest 9 GORUN = env GO111MODULE=on go run 10 11 go-quai: 12 $(GORUN) build/ci.go install ./cmd/go-quai 13 @echo "Done building." 14 @echo "Run \"$(GOBIN)/go-quai\" to launch go-quai." 15 16 bootnode: 17 $(GORUN) build/ci.go install ./cmd/bootnode 18 @echo "Done building." 19 @echo "Run \"$(GOBIN)/bootnode\" to launch bootnode binary." 20 21 debug: 22 go build -gcflags=all="-N -l" -v -o build/bin/go-quai ./cmd/go-quai 23 24 all: 25 $(GORUN) build/ci.go install 26 27 test: all 28 $(GORUN) build/ci.go test 29 30 lint: ## Run linters. 31 $(GORUN) build/ci.go lint 32 33 clean: 34 env GO111MODULE=on go clean -cache 35 rm -fr build/_workspace/pkg/ $(GOBIN)/* 36 37 include network.env 38 39 # Build the base command 40 # WARNING: WS_ADDR is a sensitive interface and should only be exposed to trusted networks 41 BASE_CMD = ./build/bin/go-quai --$(NETWORK) --syncmode $(SYNCMODE) --verbosity $(VERBOSITY) --nonce $(NONCE) 42 BASE_CMD += --http --http.vhosts=* --http.addr $(HTTP_ADDR) --http.api $(HTTP_API) 43 BASE_CMD += --ws --ws.addr $(WS_ADDR) --ws.api $(WS_API) 44 BASE_CMD += --slices $(SLICES) 45 BASE_CMD += --db.engine $(DB_ENGINE) 46 BASE_CMD += $(if $(MAX_PEERS),--maxpeers $(MAX_PEERS)) 47 ifeq ($(ENABLE_NAT),true) 48 BASE_CMD += --nat extip:$(EXT_IP) 49 endif 50 ifeq ($(ENABLE_UNLOCK),true) 51 BASE_CMD += --allow-insecure-unlock 52 endif 53 ifeq ($(BOOTNODE),true) 54 ifndef EXT_IP 55 $(error Please set EXT_IP variable to your external ip in network.env and rerun the makefile) 56 endif 57 BASE_CMD += --nodekey bootnode.key --ws.origins=$(WS_ORIG) --http.corsdomain=$(HTTP_CORSDOMAIN) --nat extip:$(EXT_IP) 58 endif 59 ifeq ($(CORS),true) 60 BASE_CMD += --ws.origins=$(WS_ORIG) --http.corsdomain=$(HTTP_CORSDOMAIN) 61 endif 62 ifeq ($(QUAI_STATS),true) 63 BASE_CMD += --quaistats ${STATS_NAME}:${STATS_PASS}@${STATS_HOST} 64 endif 65 ifeq ($(SEND_FULL_STATS),true) 66 BASE_CMD += --sendfullstats 67 endif 68 69 ifeq ($(SHOW_COLORS),true) 70 BASE_CMD += --showcolors 71 endif 72 73 ifeq ($(RUN_BLAKE3),true) 74 BASE_CMD += --consensus.engine "blake3" 75 endif 76 ifeq ($(NO_DISCOVER),true) 77 BASE_CMD += --nodiscover 78 endif 79 80 ifeq ($(CUSTOM_DATA_DIR), true) 81 BASE_CMD += --datadir $(DATA_DIR) 82 endif 83 84 # Build suburl strings for slice specific subclient groups 85 # WARNING: Only connect to dom/sub clients over a trusted network. 86 ifeq ($(REGION),2) 87 PRIME_SUBS += ,,ws://127.0.0.1:$(REGION_$(REGION)_PORT_WS) 88 endif 89 ifeq ($(REGION),1) 90 PRIME_SUBS += ,ws://127.0.0.1:$(REGION_$(REGION)_PORT_WS), 91 endif 92 ifeq ($(REGION),0) 93 PRIME_SUBS += ws://127.0.0.1:$(REGION_$(REGION)_PORT_WS),, 94 endif 95 ifeq ($(ZONE),2) 96 REGION_SUBS =,,ws://127.0.0.1:$(ZONE_$(REGION)_$(ZONE)_PORT_WS) 97 endif 98 ifeq ($(ZONE),1) 99 REGION_SUBS =,ws://127.0.0.1:$(ZONE_$(REGION)_$(ZONE)_PORT_WS), 100 endif 101 ifeq ($(ZONE),0) 102 REGION_SUBS =ws://127.0.0.1:$(ZONE_$(REGION)_$(ZONE)_PORT_WS),, 103 endif 104 105 run: 106 ifeq (,$(wildcard nodelogs)) 107 mkdir nodelogs 108 endif 109 @nohup $(BASE_CMD) --port $(PRIME_PORT_TCP) --http.port $(PRIME_PORT_HTTP) --ws.port $(PRIME_PORT_WS) --sub.urls $(PRIME_SUB_URLS) >> nodelogs/prime.log 2>&1 & 110 @nohup $(BASE_CMD) --port $(REGION_0_PORT_TCP) --http.port $(REGION_0_PORT_HTTP) --ws.port $(REGION_0_PORT_WS) --dom.url $(REGION_0_DOM_URL):$(PRIME_PORT_WS) --sub.urls $(REGION_0_SUB_URLS) --region 0 >> nodelogs/region-0.log 2>&1 & 111 @nohup $(BASE_CMD) --port $(REGION_1_PORT_TCP) --http.port $(REGION_1_PORT_HTTP) --ws.port $(REGION_1_PORT_WS) --dom.url $(REGION_1_DOM_URL):$(PRIME_PORT_WS) --sub.urls $(REGION_1_SUB_URLS) --region 1 >> nodelogs/region-1.log 2>&1 & 112 @nohup $(BASE_CMD) --port $(REGION_2_PORT_TCP) --http.port $(REGION_2_PORT_HTTP) --ws.port $(REGION_2_PORT_WS) --dom.url $(REGION_2_DOM_URL):$(PRIME_PORT_WS) --sub.urls $(REGION_2_SUB_URLS) --region 2 >> nodelogs/region-2.log 2>&1 & 113 @nohup $(BASE_CMD) --miner.etherbase $(ZONE_0_0_COINBASE) --port $(ZONE_0_0_PORT_TCP) --http.port $(ZONE_0_0_PORT_HTTP) --ws.port $(ZONE_0_0_PORT_WS) --dom.url $(ZONE_0_0_DOM_URL):$(REGION_0_PORT_WS) --region 0 --zone 0 >> nodelogs/zone-0-0.log 2>&1 & 114 @nohup $(BASE_CMD) --miner.etherbase $(ZONE_0_1_COINBASE) --port $(ZONE_0_1_PORT_TCP) --http.port $(ZONE_0_1_PORT_HTTP) --ws.port $(ZONE_0_1_PORT_WS) --dom.url $(ZONE_0_1_DOM_URL):$(REGION_0_PORT_WS) --region 0 --zone 1 >> nodelogs/zone-0-1.log 2>&1 & 115 @nohup $(BASE_CMD) --miner.etherbase $(ZONE_0_2_COINBASE) --port $(ZONE_0_2_PORT_TCP) --http.port $(ZONE_0_2_PORT_HTTP) --ws.port $(ZONE_0_2_PORT_WS) --dom.url $(ZONE_0_2_DOM_URL):$(REGION_0_PORT_WS) --region 0 --zone 2 >> nodelogs/zone-0-2.log 2>&1 & 116 @nohup $(BASE_CMD) --miner.etherbase $(ZONE_1_0_COINBASE) --port $(ZONE_1_0_PORT_TCP) --http.port $(ZONE_1_0_PORT_HTTP) --ws.port $(ZONE_1_0_PORT_WS) --dom.url $(ZONE_1_0_DOM_URL):$(REGION_1_PORT_WS) --region 1 --zone 0 >> nodelogs/zone-1-0.log 2>&1 & 117 @nohup $(BASE_CMD) --miner.etherbase $(ZONE_1_1_COINBASE) --port $(ZONE_1_1_PORT_TCP) --http.port $(ZONE_1_1_PORT_HTTP) --ws.port $(ZONE_1_1_PORT_WS) --dom.url $(ZONE_1_1_DOM_URL):$(REGION_1_PORT_WS) --region 1 --zone 1 >> nodelogs/zone-1-1.log 2>&1 & 118 @nohup $(BASE_CMD) --miner.etherbase $(ZONE_1_2_COINBASE) --port $(ZONE_1_2_PORT_TCP) --http.port $(ZONE_1_2_PORT_HTTP) --ws.port $(ZONE_1_2_PORT_WS) --dom.url $(ZONE_1_2_DOM_URL):$(REGION_1_PORT_WS) --region 1 --zone 2 >> nodelogs/zone-1-2.log 2>&1 & 119 @nohup $(BASE_CMD) --miner.etherbase $(ZONE_2_0_COINBASE) --port $(ZONE_2_0_PORT_TCP) --http.port $(ZONE_2_0_PORT_HTTP) --ws.port $(ZONE_2_0_PORT_WS) --dom.url $(ZONE_2_0_DOM_URL):$(REGION_2_PORT_WS) --region 2 --zone 0 >> nodelogs/zone-2-0.log 2>&1 & 120 @nohup $(BASE_CMD) --miner.etherbase $(ZONE_2_1_COINBASE) --port $(ZONE_2_1_PORT_TCP) --http.port $(ZONE_2_1_PORT_HTTP) --ws.port $(ZONE_2_1_PORT_WS) --dom.url $(ZONE_2_1_DOM_URL):$(REGION_2_PORT_WS) --region 2 --zone 1 >> nodelogs/zone-2-1.log 2>&1 & 121 @nohup $(BASE_CMD) --miner.etherbase $(ZONE_2_2_COINBASE) --port $(ZONE_2_2_PORT_TCP) --http.port $(ZONE_2_2_PORT_HTTP) --ws.port $(ZONE_2_2_PORT_WS) --dom.url $(ZONE_2_2_DOM_URL):$(REGION_2_PORT_WS) --region 2 --zone 2 >> nodelogs/zone-2-2.log 2>&1 & 122 123 stop: 124 ifeq ($(shell uname -s), $(filter $(shell uname -s), Darwin Linux)) 125 @-pkill -f ./build/bin/go-quai; 126 @while pgrep quai >/dev/null; do \ 127 echo "Stopping all Quai Network nodes, please wait until terminated."; \ 128 sleep 3; \ 129 done; 130 else 131 @echo "Stopping all Quai Network nodes, please wait until terminated."; 132 @if pgrep quai; then killall -w quai; fi 133 endif