bringup/morph/Makefile

88 lines
2.8 KiB
Makefile
Raw Normal View History

FROSTFS_VERSION?=0.42.9
2024-09-13 15:33:02 +00:00
FROSTFS_CONTRACTS_VERSION=0.19.4
NEOGO_VERSION?=0.104.0
SHELL=/bin/bash
.SHELLFLAGS=-euo pipefail -c
.PHONY: up
up: morph
2024-09-13 15:33:02 +00:00
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 $@)"
2024-09-17 07:21:45 +00:00
$(NEOGO) wallet dump-keys -w $@
2024-09-13 15:33:02 +00:00
2024-09-17 08:32:21 +00:00
NEOGO_RPC_ENDPOINT=http://127.0.0.200:30333
ADM_ARGS=--rpc-endpoint $(NEOGO_RPC_ENDPOINT) --alphabet-wallets wallet
2024-09-13 15:33:02 +00:00
.PHONY: bootstrap
2024-09-17 08:32:21 +00:00
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
2024-09-13 15:33:02 +00:00
wallet/az.json: | $(ADM) $(NEOGO)
mkdir -p $(dir $@)
2024-09-13 15:33:02 +00:00
cd wallet; $(abspath $(ADM)) morph generate-alphabet --size 1 --verbose
$(NEOGO) wallet dump-keys -w $@
2024-09-13 15:33:02 +00:00
2024-09-17 08:32:21 +00:00
wallet/%.json: wallet/%.template | $(NEOGO)
mkdir -p $(dir $@)
$(NEOGO) wallet init --account --wallet-config $<
2024-09-13 15:33:02 +00:00
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