87 lines
2.8 KiB
Makefile
87 lines
2.8 KiB
Makefile
FROSTFS_VERSION?=0.42.9
|
|
FROSTFS_CONTRACTS_VERSION=0.19.4
|
|
NEOGO_VERSION?=0.104.0
|
|
|
|
SHELL=/bin/bash
|
|
.SHELLFLAGS=-euo pipefail -c
|
|
|
|
.PHONY: up
|
|
up: morph
|
|
|
|
WALLET?=wallet/morph.json
|
|
TOOLS=$(NEOGO) $(ADM) $(CLI)
|
|
|
|
ADM?=bin/frostfs-adm-v$(FROSTFS_VERSION)
|
|
ADM_RELEASE_URL=https://git.frostfs.info/TrueCloudLab/frostfs-node/releases/download/v$(FROSTFS_VERSION)/frostfs-adm
|
|
|
|
CLI?=bin/frostfs-cli-v$(FROSTFS_VERSION)
|
|
CLI_RELEASE_URL=https://git.frostfs.info/TrueCloudLab/frostfs-node/releases/download/v$(FROSTFS_VERSION)/frostfs-cli
|
|
|
|
NEOGO?=bin/neo-go-v$(NEOGO_VERSION)
|
|
NEOGO_RELEASE_URL=https://github.com/nspcc-dev/neo-go/releases/download/v$(NEOGO_VERSION)/neo-go-linux-amd64
|
|
|
|
bin/frostfs-adm-v$(FROSTFS_VERSION):
|
|
mkdir -p $(dir $@)
|
|
wget -q "$(ADM_RELEASE_URL)" -O "$@"
|
|
chmod +x "$@"
|
|
|
|
bin/frostfs-cli-v$(FROSTFS_VERSION):
|
|
mkdir -p $(dir $@)
|
|
wget -q "$(CLI_RELEASE_URL)" -O "$@"
|
|
chmod +x "$@"
|
|
|
|
bin/neo-go-v$(NEOGO_VERSION):
|
|
mkdir -p $(dir $@)
|
|
wget -q "$(NEOGO_RELEASE_URL)" -O "$@"
|
|
chmod +x "$@"
|
|
|
|
.PHONY: morph
|
|
morph: $(WALLET) | $(NEOGO)
|
|
grep -F $$($(NEOGO) wallet dump-keys -w $(WALLET)|head -n2|tail -n1) protocol.privnet.yml
|
|
mkdir -p log
|
|
$(NEOGO) node --config-path . --privnet --debug 2>&1 | tee --append log/$@
|
|
|
|
wallet/morph.json: wallet/az.json
|
|
ln -sf "$(abspath $<)" "$(abspath $@)"
|
|
$(NEOGO) wallet dump-keys -w $@
|
|
|
|
NEOGO_RPC_ENDPOINT=http://127.0.0.200:30333
|
|
ADM_ARGS=--rpc-endpoint $(NEOGO_RPC_ENDPOINT) --alphabet-wallets wallet
|
|
|
|
.PHONY: bootstrap
|
|
bootstrap: data/contracts wallet/az.json wallet/subject.json | $(ADM)
|
|
bootstrap: wallet/storage01.json wallet/storage02.json wallet/storage03.json wallet/storage04.json
|
|
$(ADM) morph init --contracts data/contracts $(ADM_ARGS)
|
|
$(ADM) morph ape add-rule-chain --target-type namespace --target-name "" \
|
|
--rule "allow Container.* *" --chain-id "allow_container_ops" \
|
|
$(ADM_ARGS)
|
|
test -n "$$($(ADM) morph frostfsid list-subjects --namespace '' $(ADM_ARGS))" \
|
|
|| { $(ADM) morph frostfsid create-subject --namespace '' \
|
|
--subject-name walletsubject \
|
|
--subject-key $$($(NEOGO) wallet dump-keys -w wallet/subject.json|tail -n1) \
|
|
$(ADM_ARGS) \
|
|
&& echo "Subject created" ; }
|
|
for N in {1..4}; do \
|
|
$(ADM) morph refill-gas --storage-wallet wallet/storage0$$N.json --gas 10.0 $(ADM_ARGS); \
|
|
done
|
|
|
|
wallet/az.json: | $(ADM) $(NEOGO)
|
|
mkdir -p $(dir $@)
|
|
cd wallet; $(abspath $(ADM)) morph generate-alphabet --size 1 --verbose
|
|
$(NEOGO) wallet dump-keys -w $@
|
|
|
|
wallet/%.json: wallet/%.template | $(NEOGO)
|
|
mkdir -p $(dir $@)
|
|
$(NEOGO) wallet init --account --wallet-config $<
|
|
|
|
data/contracts: | $(NEOGO)
|
|
mkdir -p $(dir $@)
|
|
git clone https://git.frostfs.info/TrueCloudLab/frostfs-contract \
|
|
--branch=v$(FROSTFS_CONTRACTS_VERSION) \
|
|
--depth=1 --single-branch \
|
|
$@
|
|
$(MAKE) -C $@ all NEOGO=$(abspath $(NEOGO))
|
|
|
|
.PHONY: clean
|
|
clean:
|
|
git clean -idxff
|