Skip to content

Commit

Permalink
Add Makefile commands to run full hierarchy of nodes
Browse files Browse the repository at this point in the history
  • Loading branch information
wizeguyy committed Jan 25, 2023
1 parent dafa0d4 commit 290b672
Show file tree
Hide file tree
Showing 3 changed files with 185 additions and 21 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -47,3 +47,5 @@ profile.cov
/dashboard/assets/package-lock.json

**/yarn-error.log
network.env
nodelogs
112 changes: 91 additions & 21 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,15 @@ GORUN = env GO111MODULE=on go run
go-quai:
$(GORUN) build/ci.go install ./cmd/go-quai
@echo "Done building."
@echo "Run \"$(GOBIN)/go-quai\" to launch geth."
@echo "Run \"$(GOBIN)/quai\" to launch go-quai."

bootnode:
$(GORUN) build/ci.go install ./cmd/bootnode
@echo "Done building."
@echo "Run \"$(GOBIN)/bootnode\" to launch bootnode binary."

debug:
go build -gcflags=all="-N -l" -v -o build/bin/go-quai ./cmd/go-quai

all:
$(GORUN) build/ci.go install
Expand All @@ -30,7 +38,7 @@ android:
ios:
$(GORUN) build/ci.go xcode --local
@echo "Done building."
@echo "Import \"$(GOBIN)/Geth.framework\" to use the library."
@echo "Import \"$(GOBIN)/Quai.framework\" to use the library."

test: all
$(GORUN) build/ci.go test
Expand All @@ -56,92 +64,154 @@ devtools:

# Cross Compilation Targets (xgo)

go-quai-cross: geth-linux geth-darwin geth-windows geth-android geth-ios
go-quai-cross: go-quai-linux go-quai-darwin go-quai-windows go-quai-android go-quai-ios
@echo "Full cross compilation done:"
@ls -ld $(GOBIN)/go-quai-*

go-quai-linux: geth-linux-386 geth-linux-amd64 geth-linux-arm geth-linux-mips64 geth-linux-mips64le
go-quai-linux: go-quai-linux-386 go-quai-linux-amd64 go-quai-linux-arm go-quai-linux-mips64 go-quai-linux-mips64le
@echo "Linux cross compilation done:"
@ls -ld $(GOBIN)/go-quai-linux-*

go-quai-linux-386:
$(GORUN) build/ci.go xgo -- --go=$(GO) --targets=linux/386 -v ./cmd/go-quai
$(GORUN) build/ci.go xgo -- --go=$(GO) --targets=linux/386 -v ./cmd/quai
@echo "Linux 386 cross compilation done:"
@ls -ld $(GOBIN)/go-quai-linux-* | grep 386

go-quai-linux-amd64:
$(GORUN) build/ci.go xgo -- --go=$(GO) --targets=linux/amd64 -v ./cmd/go-quai
$(GORUN) build/ci.go xgo -- --go=$(GO) --targets=linux/amd64 -v ./cmd/quai
@echo "Linux amd64 cross compilation done:"
@ls -ld $(GOBIN)/go-quai-linux-* | grep amd64

go-quai-linux-arm: geth-linux-arm-5 geth-linux-arm-6 geth-linux-arm-7 geth-linux-arm64
go-quai-linux-arm: go-quai-linux-arm-5 go-quai-linux-arm-6 go-quai-linux-arm-7 go-quai-linux-arm64
@echo "Linux ARM cross compilation done:"
@ls -ld $(GOBIN)/go-quai-linux-* | grep arm

go-quai-linux-arm-5:
$(GORUN) build/ci.go xgo -- --go=$(GO) --targets=linux/arm-5 -v ./cmd/go-quai
$(GORUN) build/ci.go xgo -- --go=$(GO) --targets=linux/arm-5 -v ./cmd/quai
@echo "Linux ARMv5 cross compilation done:"
@ls -ld $(GOBIN)/go-quai-linux-* | grep arm-5

go-quai-linux-arm-6:
$(GORUN) build/ci.go xgo -- --go=$(GO) --targets=linux/arm-6 -v ./cmd/go-quai
$(GORUN) build/ci.go xgo -- --go=$(GO) --targets=linux/arm-6 -v ./cmd/quai
@echo "Linux ARMv6 cross compilation done:"
@ls -ld $(GOBIN)/go-quai-linux-* | grep arm-6

go-quai-linux-arm-7:
$(GORUN) build/ci.go xgo -- --go=$(GO) --targets=linux/arm-7 -v ./cmd/go-quai
$(GORUN) build/ci.go xgo -- --go=$(GO) --targets=linux/arm-7 -v ./cmd/quai
@echo "Linux ARMv7 cross compilation done:"
@ls -ld $(GOBIN)/go-quai-linux-* | grep arm-7

go-quai-linux-arm64:
$(GORUN) build/ci.go xgo -- --go=$(GO) --targets=linux/arm64 -v ./cmd/go-quai
$(GORUN) build/ci.go xgo -- --go=$(GO) --targets=linux/arm64 -v ./cmd/quai
@echo "Linux ARM64 cross compilation done:"
@ls -ld $(GOBIN)/go-quai-linux-* | grep arm64

go-quai-linux-mips:
$(GORUN) build/ci.go xgo -- --go=$(GO) --targets=linux/mips --ldflags '-extldflags "-static"' -v ./cmd/go-quai
$(GORUN) build/ci.go xgo -- --go=$(GO) --targets=linux/mips --ldflags '-extldflags "-static"' -v ./cmd/quai
@echo "Linux MIPS cross compilation done:"
@ls -ld $(GOBIN)/go-quai-linux-* | grep mips

go-quai-linux-mipsle:
$(GORUN) build/ci.go xgo -- --go=$(GO) --targets=linux/mipsle --ldflags '-extldflags "-static"' -v ./cmd/go-quai
$(GORUN) build/ci.go xgo -- --go=$(GO) --targets=linux/mipsle --ldflags '-extldflags "-static"' -v ./cmd/quai
@echo "Linux MIPSle cross compilation done:"
@ls -ld $(GOBIN)/go-quai-linux-* | grep mipsle

go-quai-linux-mips64:
$(GORUN) build/ci.go xgo -- --go=$(GO) --targets=linux/mips64 --ldflags '-extldflags "-static"' -v ./cmd/go-quai
$(GORUN) build/ci.go xgo -- --go=$(GO) --targets=linux/mips64 --ldflags '-extldflags "-static"' -v ./cmd/quai
@echo "Linux MIPS64 cross compilation done:"
@ls -ld $(GOBIN)/go-quai-linux-* | grep mips64

go-quai-linux-mips64le:
$(GORUN) build/ci.go xgo -- --go=$(GO) --targets=linux/mips64le --ldflags '-extldflags "-static"' -v ./cmd/go-quai
$(GORUN) build/ci.go xgo -- --go=$(GO) --targets=linux/mips64le --ldflags '-extldflags "-static"' -v ./cmd/quai
@echo "Linux MIPS64le cross compilation done:"
@ls -ld $(GOBIN)/go-quai-linux-* | grep mips64le

go-quai-darwin: geth-darwin-386 geth-darwin-amd64
go-quai-darwin: go-quai-darwin-386 go-quai-darwin-amd64
@echo "Darwin cross compilation done:"
@ls -ld $(GOBIN)/go-quai-darwin-*

go-quai-darwin-386:
$(GORUN) build/ci.go xgo -- --go=$(GO) --targets=darwin/386 -v ./cmd/go-quai
$(GORUN) build/ci.go xgo -- --go=$(GO) --targets=darwin/386 -v ./cmd/quai
@echo "Darwin 386 cross compilation done:"
@ls -ld $(GOBIN)/go-quai-darwin-* | grep 386

go-quai-darwin-amd64:
$(GORUN) build/ci.go xgo -- --go=$(GO) --targets=darwin/amd64 -v ./cmd/go-quai
$(GORUN) build/ci.go xgo -- --go=$(GO) --targets=darwin/amd64 -v ./cmd/quai
@echo "Darwin amd64 cross compilation done:"
@ls -ld $(GOBIN)/go-quai-darwin-* | grep amd64

go-quai-windows: geth-windows-386 geth-windows-amd64
go-quai-windows: go-quai-windows-386 go-quai-windows-amd64
@echo "Windows cross compilation done:"
@ls -ld $(GOBIN)/go-quai-windows-*

go-quai-windows-386:
$(GORUN) build/ci.go xgo -- --go=$(GO) --targets=windows/386 -v ./cmd/go-quai
$(GORUN) build/ci.go xgo -- --go=$(GO) --targets=windows/386 -v ./cmd/quai
@echo "Windows 386 cross compilation done:"
@ls -ld $(GOBIN)/go-quai-windows-* | grep 386

go-quai-windows-amd64:
$(GORUN) build/ci.go xgo -- --go=$(GO) --targets=windows/amd64 -v ./cmd/go-quai
$(GORUN) build/ci.go xgo -- --go=$(GO) --targets=windows/amd64 -v ./cmd/quai
@echo "Windows amd64 cross compilation done:"
@ls -ld $(GOBIN)/go-quai-windows-* | grep amd64

include network.env

BASE_COMMAND = ./build/bin/go-quai --$(NETWORK) --syncmode full --verbosity 3

ifeq ($(ENABLE_ARCHIVE),true)
BASE_COMMAND += --gcmode archive
endif

ifeq ($(ENABLE_HTTP),true)
BASE_COMMAND += --http --http.vhosts=*
endif

ifeq ($(ENABLE_WS),true)
BASE_COMMAND += --ws
endif

ifeq ($(ENABLE_UNLOCK),true)
BASE_COMMAND += --allow-insecure-unlock
endif

ifeq ($(QUAI_MINING),true)
MINING_BASE_COMMAND = $(BASE_COMMAND) --mine --miner.threads $(THREADS)
endif

ifeq ($(BOOTNODE),true)
BASE_COMMAND += --nodekey bootnode.key --ws.origins=$(WS_ORIG) --http.corsdomain=$(HTTP_CORSDOMAIN)
endif

ifeq ($(CORS),true)
BASE_COMMAND += --ws.origins=$(WS_ORIG) --http.corsdomain=$(HTTP_CORSDOMAIN)
endif

run-full-node:
ifeq (,$(wildcard nodelogs))
mkdir nodelogs
endif
@nohup $(BASE_COMMAND) --http.addr $(HTTP_ADDR) --ws.addr $(WS_ADDR) --ws.api $(WS_API) --port $(PRIME_PORT_TCP) --http.port $(PRIME_PORT_HTTP) --ws.port $(PRIME_PORT_WS) >> nodelogs/prime.log 2>&1 &
@nohup $(BASE_COMMAND) --http.addr $(HTTP_ADDR) --ws.addr $(WS_ADDR) --ws.api $(WS_API) --port $(REGION_0_PORT_TCP) --http.port $(REGION_0_PORT_HTTP) --ws.port $(REGION_0_PORT_WS) --region 0 >> nodelogs/region-0.log 2>&1 &
@nohup $(BASE_COMMAND) --http.addr $(HTTP_ADDR) --ws.addr $(WS_ADDR) --ws.api $(WS_API) --port $(REGION_1_PORT_TCP) --http.port $(REGION_1_PORT_HTTP) --ws.port $(REGION_1_PORT_WS) --region 1 >> nodelogs/region-1.log 2>&1 &
@nohup $(BASE_COMMAND) --http.addr $(HTTP_ADDR) --ws.addr $(WS_ADDR) --ws.api $(WS_API) --port $(REGION_2_PORT_TCP) --http.port $(REGION_2_PORT_HTTP) --ws.port $(REGION_2_PORT_WS) --region 2 >> nodelogs/region-2.log 2>&1 &
@nohup $(BASE_COMMAND) --http.addr $(HTTP_ADDR) --ws.addr $(WS_ADDR) --ws.api $(WS_API) --port $(ZONE_0_0_PORT_TCP) --http.port $(ZONE_0_0_PORT_HTTP) --ws.port $(ZONE_0_0_PORT_WS) --region 0 --zone 0 >> nodelogs/zone-0-0.log 2>&1 &
@nohup $(BASE_COMMAND) --http.addr $(HTTP_ADDR) --ws.addr $(WS_ADDR) --ws.api $(WS_API) --port $(ZONE_0_1_PORT_TCP) --http.port $(ZONE_0_1_PORT_HTTP) --ws.port $(ZONE_0_1_PORT_WS) --region 0 --zone 1 >> nodelogs/zone-0-1.log 2>&1 &
@nohup $(BASE_COMMAND) --http.addr $(HTTP_ADDR) --ws.addr $(WS_ADDR) --ws.api $(WS_API) --port $(ZONE_0_2_PORT_TCP) --http.port $(ZONE_0_2_PORT_HTTP) --ws.port $(ZONE_0_2_PORT_WS) --region 0 --zone 2 >> nodelogs/zone-0-2.log 2>&1 &
@nohup $(BASE_COMMAND) --http.addr $(HTTP_ADDR) --ws.addr $(WS_ADDR) --ws.api $(WS_API) --port $(ZONE_1_0_PORT_TCP) --http.port $(ZONE_1_0_PORT_HTTP) --ws.port $(ZONE_1_0_PORT_WS) --region 1 --zone 0 >> nodelogs/zone-1-0.log 2>&1 &
@nohup $(BASE_COMMAND) --http.addr $(HTTP_ADDR) --ws.addr $(WS_ADDR) --ws.api $(WS_API) --port $(ZONE_1_1_PORT_TCP) --http.port $(ZONE_1_1_PORT_HTTP) --ws.port $(ZONE_1_1_PORT_WS) --region 1 --zone 1 >> nodelogs/zone-1-1.log 2>&1 &
@nohup $(BASE_COMMAND) --http.addr $(HTTP_ADDR) --ws.addr $(WS_ADDR) --ws.api $(WS_API) --port $(ZONE_1_2_PORT_TCP) --http.port $(ZONE_1_2_PORT_HTTP) --ws.port $(ZONE_1_2_PORT_WS) --region 1 --zone 2 >> nodelogs/zone-1-2.log 2>&1 &
@nohup $(BASE_COMMAND) --http.addr $(HTTP_ADDR) --ws.addr $(WS_ADDR) --ws.api $(WS_API) --port $(ZONE_2_0_PORT_TCP) --http.port $(ZONE_2_0_PORT_HTTP) --ws.port $(ZONE_2_0_PORT_WS) --region 2 --zone 0 >> nodelogs/zone-2-0.log 2>&1 &
@nohup $(BASE_COMMAND) --http.addr $(HTTP_ADDR) --ws.addr $(WS_ADDR) --ws.api $(WS_API) --port $(ZONE_2_1_PORT_TCP) --http.port $(ZONE_2_1_PORT_HTTP) --ws.port $(ZONE_2_1_PORT_WS) --region 2 --zone 1 >> nodelogs/zone-2-1.log 2>&1 &
@nohup $(BASE_COMMAND) --http.addr $(HTTP_ADDR) --ws.addr $(WS_ADDR) --ws.api $(WS_API) --port $(ZONE_2_2_PORT_TCP) --http.port $(ZONE_2_2_PORT_HTTP) --ws.port $(ZONE_2_2_PORT_WS) --region 2 --zone 2 >> nodelogs/zone-2-2.log 2>&1 &

stop:
ifeq ($(shell uname -s),Darwin)
@if pgrep quai; then pkill -f ./build/bin/go-quai; fi
@while pgrep quai >/dev/null; do \
echo "Stopping all Quai Network nodes, please wait until terminated."; \
sleep 3; \
done;
else
@echo "Stopping all Quai Network nodes, please wait until terminated.";
@if pgrep quai; then killall -w quai; fi
endif
92 changes: 92 additions & 0 deletions network.env.dist
Original file line number Diff line number Diff line change
@@ -0,0 +1,92 @@
#Unique Coinbase addresses

PRIME_COINBASE=0x0767d31b0d7671c3e97c6abed055a26fb59b4149
REGION_0_COINBASE=0x11a03db52d12201e614466cb98ec5d49a1205bda
REGION_1_COINBASE=0x3bcec1847c55246cf9ea32a5dfe652f147ac091c
REGION_2_COINBASE=0x5e6b0261c32b25f187786612d27a39f6d0c31771
ZONE_0_0_COINBASE=0x1a6ad97c8f06c7ae79fea47e43a8c048da5b1f7d
ZONE_0_1_COINBASE=0x186da447ec1dd29cdec8cca5653ccc4fd8f9e5e3
ZONE_0_2_COINBASE=0x2ab56840530b1c395ecf91e5923446fa696c7933
ZONE_1_0_COINBASE=0x454f47e9da39a4d2cff17d7ca50757576a298fb2
ZONE_1_1_COINBASE=0x4c190ab6136e94b3b510172784a4fed22f566622
ZONE_1_2_COINBASE=0x5446d13d4907630425928fceb67ca35a6bf1bb0e
ZONE_2_0_COINBASE=0x677c5623aabeb5d6d978cc2ec11ac5297a8afcbd
ZONE_2_1_COINBASE=0x7717ddddd08eacc0bb981c47348d1ec3a99566f8
ZONE_2_2_COINBASE=0x8169c0a78e20ee6e5c53cc18ee2f4eb3f762ee05



#Ports (TCP/UCP, HTTP, WS)

PRIME_PORT_TCP=30303
PRIME_PORT_HTTP=8546
PRIME_PORT_WS=8547
REGION_0_PORT_TCP=30304
REGION_0_PORT_HTTP=8578
REGION_0_PORT_WS=8579
REGION_1_PORT_TCP=30305
REGION_1_PORT_HTTP=8580
REGION_1_PORT_WS=8581
REGION_2_PORT_TCP=30306
REGION_2_PORT_HTTP=8582
REGION_2_PORT_WS=8583
ZONE_0_0_PORT_TCP = 30307
ZONE_0_0_PORT_HTTP=8610
ZONE_0_0_PORT_WS=8611
ZONE_0_1_PORT_TCP = 30308
ZONE_0_1_PORT_HTTP=8542
ZONE_0_1_PORT_WS=8643
ZONE_0_2_PORT_TCP = 30309
ZONE_0_2_PORT_HTTP=8674
ZONE_0_2_PORT_WS=8675
ZONE_1_0_PORT_TCP = 30310
ZONE_1_0_PORT_HTTP=8512
ZONE_1_0_PORT_WS=8613
ZONE_1_1_PORT_TCP = 30311
ZONE_1_1_PORT_HTTP=8544
ZONE_1_1_PORT_WS=8645
ZONE_1_2_PORT_TCP = 30312
ZONE_1_2_PORT_HTTP=8576
ZONE_1_2_PORT_WS=8677
ZONE_2_0_PORT_TCP = 30313
ZONE_2_0_PORT_HTTP=8614
ZONE_2_0_PORT_WS=8615
ZONE_2_1_PORT_TCP = 30314
ZONE_2_1_PORT_HTTP=8646
ZONE_2_1_PORT_WS=8647
ZONE_2_2_PORT_TCP = 30315
ZONE_2_2_PORT_HTTP=8678
ZONE_2_2_PORT_WS=8679

#Boolean Variable Definition
#Enables or disables http porting
#Enables or disables websocket porting
ENABLE_HTTP=true
ENABLE_WS=true
ENABLE_UNLOCK=false
ENABLE_ARCHIVE=false

#Input Variable Definition
#Network Options include mainnet, testnet, and rospten
#http.addr options include 0.0.0.0 and 127.0.0.1 (local host)
#ws.addr options include 0.0.0.0 and 127.0.0.1 (local host)
#ws.api options include any blockchain compatible api

NETWORK=mainnet
HTTP_ADDR=0.0.0.0
WS_ADDR=0.0.0.0
WS_API=eth,net,web3,quai
HTTP_API=eth,net,web3

#Mining Variables
QUAI_MINING=true

#Number of CPU threads
THREADS=1

#Bootnode Specific Variables
#Should only be used by bootnode operators, i.e. team developers
HTTP_CORSDOMAIN="*"
WS_ORIG="*"
BOOTNODE=false
CORS=false

0 comments on commit 290b672

Please sign in to comment.