[#18] bin: Replace some commands with frostfs-adm
Signed-off-by: Evgenii Stratonikov <e.stratonikov@yadro.com>
This commit is contained in:
parent
db0ebb7349
commit
6d6aaefaec
6 changed files with 14 additions and 140 deletions
6
Makefile
6
Makefile
|
@ -66,8 +66,8 @@ up: up/basic
|
||||||
.PHONY: up/basic
|
.PHONY: up/basic
|
||||||
up/basic: up/bootstrap
|
up/basic: up/bootstrap
|
||||||
@$(foreach SVC, $(START_BASIC), $(shell docker-compose -f services/$(SVC)/docker-compose.yml up -d))
|
@$(foreach SVC, $(START_BASIC), $(shell docker-compose -f services/$(SVC)/docker-compose.yml up -d))
|
||||||
@./bin/tick.sh
|
@./vendor/frostfs-adm -c ./frostfs-adm.yml morph force-new-epoch
|
||||||
@./bin/config.sh string SystemDNS container
|
@./vendor/frostfs-adm -c ./frostfs-adm.yml morph set-config SystemDNS=container --force
|
||||||
@echo "Basic FrostFS Developer Environment is ready"
|
@echo "Basic FrostFS Developer Environment is ready"
|
||||||
|
|
||||||
# Start bootstrap services
|
# Start bootstrap services
|
||||||
|
@ -75,7 +75,7 @@ up/basic: up/bootstrap
|
||||||
up/bootstrap: get vendor/hosts
|
up/bootstrap: get vendor/hosts
|
||||||
@$(foreach SVC, $(START_BOOTSTRAP), $(shell docker-compose -f services/$(SVC)/docker-compose.yml up -d))
|
@$(foreach SVC, $(START_BOOTSTRAP), $(shell docker-compose -f services/$(SVC)/docker-compose.yml up -d))
|
||||||
@source ./bin/helper.sh
|
@source ./bin/helper.sh
|
||||||
@./vendor/frostfs-adm --config frostfs-adm.yml morph init --contracts vendor/contracts || die "Failed to initialize Alphabet wallets"
|
@./vendor/frostfs-adm --config frostfs-adm.yml morph init --contracts vendor/contracts
|
||||||
@for f in ./services/storage/wallet*.json; do \
|
@for f in ./services/storage/wallet*.json; do \
|
||||||
echo "Transfer GAS to wallet $${f}" \
|
echo "Transfer GAS to wallet $${f}" \
|
||||||
&& ./vendor/frostfs-adm -c frostfs-adm.yml morph refill-gas --storage-wallet $${f} --gas 10.0 \
|
&& ./vendor/frostfs-adm -c frostfs-adm.yml morph refill-gas --storage-wallet $${f} --gas 10.0 \
|
||||||
|
|
|
@ -1,50 +0,0 @@
|
||||||
#!/usr/bin/env bash
|
|
||||||
|
|
||||||
echo "Running bin/config.sh"
|
|
||||||
|
|
||||||
# Source env settings
|
|
||||||
. .env
|
|
||||||
. services/ir/.ir.env
|
|
||||||
source bin/helper.sh
|
|
||||||
|
|
||||||
# NeoGo binary path.
|
|
||||||
NEOGO="${NEOGO:-docker exec morph_chain neo-go}"
|
|
||||||
|
|
||||||
# Wallet files to change config value
|
|
||||||
WALLET="${WALLET:-services/morph_chain/node-wallet.json}"
|
|
||||||
CONFIG_IMG="${CONFIG_IMG:-/wallets/config.yml}"
|
|
||||||
|
|
||||||
NETMAP_ADDR=$(bin/resolve.sh netmap.frostfs) || die "Failed to resolve 'netmap.frostfs' domain name"
|
|
||||||
|
|
||||||
# FrostFS configuration record: variable type [string|int|etc],
|
|
||||||
# key is a string and value is a constant of given type
|
|
||||||
TYPE=${1}
|
|
||||||
KEY=${2}
|
|
||||||
VALUE="${3}"
|
|
||||||
|
|
||||||
[ -z "$TYPE" ] && echo "Empty config value type" && exit 1
|
|
||||||
[ -z "$KEY" ] && echo "Empty config key" && exit 1
|
|
||||||
[ -z "$VALUE" ] && echo "Empty config value" && exit 1
|
|
||||||
|
|
||||||
# Internal variables
|
|
||||||
if [[ -z "${FROSTFS_NOTARY_DISABLED}" ]]; then
|
|
||||||
ADDR=$(jq -r .accounts[2].address < "${WALLET}" || die "Cannot get address from ${WALLET}")
|
|
||||||
else
|
|
||||||
ADDR=$(jq -r .accounts[0].address < "${WALLET}" || die "Cannot get address from ${WALLET}")
|
|
||||||
fi
|
|
||||||
|
|
||||||
# Change config value in side chain
|
|
||||||
echo "Changing ${KEY} configration value to ${VALUE}"
|
|
||||||
|
|
||||||
# shellcheck disable=SC2086
|
|
||||||
${NEOGO} contract invokefunction \
|
|
||||||
--wallet-config ${CONFIG_IMG} \
|
|
||||||
-a ${ADDR} --force \
|
|
||||||
-r http://morph-chain.${LOCAL_DOMAIN}:30333 \
|
|
||||||
${NETMAP_ADDR} \
|
|
||||||
setConfig bytes:beefcafe \
|
|
||||||
string:${KEY} \
|
|
||||||
${TYPE}:${VALUE} -- ${ADDR} || exit 1
|
|
||||||
|
|
||||||
# Update epoch to apply new configuration value
|
|
||||||
./bin/tick.sh
|
|
|
@ -1,22 +0,0 @@
|
||||||
#!/usr/bin/env bash
|
|
||||||
|
|
||||||
# Source env settings
|
|
||||||
. .env
|
|
||||||
source bin/helper.sh
|
|
||||||
|
|
||||||
# NeoGo binary path.
|
|
||||||
NEOGO="${NEOGO:-docker exec morph_chain neo-go}"
|
|
||||||
# NNS contract script hash
|
|
||||||
output=$(curl -s --data '{ "id": 1, "jsonrpc": "2.0", "method": "getcontractstate", "params": [1] }' \
|
|
||||||
"http://morph-chain.${LOCAL_DOMAIN}:30333/") \
|
|
||||||
|| die "Cannot fetch NNS contract state"
|
|
||||||
|
|
||||||
NNS_ADDR=$(jq -r '.result.hash' <<< "$output") \
|
|
||||||
|| die "Cannot parse NNS contract hash: $NNS_ADDR"
|
|
||||||
|
|
||||||
${NEOGO} contract testinvokefunction \
|
|
||||||
-r "http://morph-chain.${LOCAL_DOMAIN}:30333" \
|
|
||||||
"${NNS_ADDR}" resolve string:"${1}" int:16 \
|
|
||||||
| jq -r '.stack[0].value | if type=="array" then .[0].value else . end' \
|
|
||||||
| base64 -d \
|
|
||||||
|| die "Cannot invoke 'NNS.resolve' $output"
|
|
49
bin/tick.sh
49
bin/tick.sh
|
@ -1,49 +0,0 @@
|
||||||
#!/usr/bin/env bash
|
|
||||||
|
|
||||||
echo "Running bin/tick.sh"
|
|
||||||
|
|
||||||
# Source env settings
|
|
||||||
. .env
|
|
||||||
. services/ir/.ir.env
|
|
||||||
source bin/helper.sh
|
|
||||||
|
|
||||||
# NeoGo binary path.
|
|
||||||
NEOGO="${NEOGO:-docker exec morph_chain neo-go}"
|
|
||||||
|
|
||||||
# Wallet files to change config value
|
|
||||||
WALLET="${WALLET:-services/morph_chain/node-wallet.json}"
|
|
||||||
CONFIG_IMG="${CONFIG_IMG:-/wallets/config.yml}"
|
|
||||||
|
|
||||||
# Internal variables
|
|
||||||
if [[ -z "${FROSTFS_NOTARY_DISABLED}" ]]; then
|
|
||||||
ADDR=$(jq -r .accounts[2].address < "${WALLET}" || die "Cannot get address from ${WALLET}")
|
|
||||||
else
|
|
||||||
ADDR=$(jq -r .accounts[0].address < "${WALLET}" || die "Cannot get address from ${WALLET}")
|
|
||||||
fi
|
|
||||||
|
|
||||||
# Grep Morph block time
|
|
||||||
SIDECHAIN_PROTO="${SIDECHAIN_PROTO:-services/morph_chain/protocol.privnet.yml}"
|
|
||||||
BLOCK_DURATION=$(grep SecondsPerBlock < "$SIDECHAIN_PROTO" | awk '{print $2}') \
|
|
||||||
|| die "Cannot fetch block duration"
|
|
||||||
NETMAP_ADDR=$(bin/resolve.sh netmap.frostfs) || die "Cannot resolve netmap.frostfs"
|
|
||||||
|
|
||||||
# Fetch current epoch value
|
|
||||||
EPOCH=$(${NEOGO} contract testinvokefunction \
|
|
||||||
-r "http://morph-chain.${LOCAL_DOMAIN}:30333" "${NETMAP_ADDR}" epoch \
|
|
||||||
| grep 'value' | awk -F'"' '{ print $4 }') \
|
|
||||||
|| die "Cannot fetch epoch from netmap contract"
|
|
||||||
|
|
||||||
echo "Updating FrostFS epoch to $((EPOCH+1))"
|
|
||||||
|
|
||||||
# shellcheck disable=SC2086
|
|
||||||
${NEOGO} contract invokefunction \
|
|
||||||
--wallet-config ${CONFIG_IMG} \
|
|
||||||
-a ${ADDR} --force \
|
|
||||||
-r http://morph-chain.${LOCAL_DOMAIN}:30333 \
|
|
||||||
${NETMAP_ADDR} \
|
|
||||||
newEpoch int:$((EPOCH+1)) -- ${ADDR}:Global \
|
|
||||||
|| die "Cannot increment an epoch"
|
|
||||||
|
|
||||||
# Wait one Morph block to ensure the transaction broadcasted
|
|
||||||
# shellcheck disable=SC2086
|
|
||||||
sleep $BLOCK_DURATION
|
|
|
@ -1,44 +1,40 @@
|
||||||
# Update epoch duration in side chain blocks (make update.epoch_duration val=30)
|
# Update epoch duration in side chain blocks (make update.epoch_duration val=30)
|
||||||
update.epoch_duration:
|
update.epoch_duration:
|
||||||
@./bin/config.sh int EpochDuration $(val)
|
@./vendor/frostfs-adm -c ./frostfs-adm.yml morph set-config EpochDuration=$(val)
|
||||||
|
|
||||||
# Update max object size in bytes (make update.max_object_size val=1000)
|
# Update max object size in bytes (make update.max_object_size val=1000)
|
||||||
update.max_object_size:
|
update.max_object_size:
|
||||||
@./bin/config.sh int MaxObjectSize $(val)
|
@./vendor/frostfs-adm -c ./frostfs-adm.yml morph set-config MaxObjectSize=$(val)
|
||||||
|
|
||||||
# Update audit fee per result in fixed 12 (make update.audit_fee val=100)
|
# Update audit fee per result in fixed 12 (make update.audit_fee val=100)
|
||||||
update.audit_fee:
|
update.audit_fee:
|
||||||
@./bin/config.sh int AuditFee $(val)
|
@./vendor/frostfs-adm -c ./frostfs-adm.yml morph set-config AuditFee=$(val)
|
||||||
|
|
||||||
# Update container fee per alphabet node in fixed 12 (make update.container_fee val=500)
|
# Update container fee per alphabet node in fixed 12 (make update.container_fee val=500)
|
||||||
update.container_fee:
|
update.container_fee:
|
||||||
@./bin/config.sh int ContainerFee $(val)
|
@./vendor/frostfs-adm -c ./frostfs-adm.yml morph set-config ContainerFee=$(val)
|
||||||
|
|
||||||
# Update container alias fee per alphabet node in fixed 12 (make update.container_alias_fee val=100)
|
# Update container alias fee per alphabet node in fixed 12 (make update.container_alias_fee val=100)
|
||||||
update.container_alias_fee:
|
update.container_alias_fee:
|
||||||
@./bin/config.sh int ContainerAliasFee $(val)
|
@./vendor/frostfs-adm -c ./frostfs-adm.yml morph set-config ContainerAliasFee=$(val)
|
||||||
|
|
||||||
# Update amount of EigenTrust iterations (make update.eigen_trust_iterations val=2)
|
# Update amount of EigenTrust iterations (make update.eigen_trust_iterations val=2)
|
||||||
update.eigen_trust_iterations:
|
update.eigen_trust_iterations:
|
||||||
@./bin/config.sh int EigenTrustIterations $(val)
|
@./vendor/frostfs-adm -c ./frostfs-adm.yml morph set-config EigenTrustIterations=$(val)
|
||||||
|
|
||||||
|
|
||||||
# Update system dns to resolve container names (make update.system_dns val=container)
|
# Update system dns to resolve container names (make update.system_dns val=container)
|
||||||
update.system_dns:
|
update.system_dns:
|
||||||
@./bin/config.sh string SystemDNS $(val)
|
@./vendor/frostfs-adm -c ./frostfs-adm.yml morph set-config SystemDNS=$(val) --force
|
||||||
|
|
||||||
# Update alpha parameter of EigenTrust algorithm in 0 <= f <= 1.0 (make update.eigen_trust_alpha val=0.2)
|
# Update alpha parameter of EigenTrust algorithm in 0 <= f <= 1.0 (make update.eigen_trust_alpha val=0.2)
|
||||||
update.eigen_trust_alpha:
|
update.eigen_trust_alpha:
|
||||||
@./bin/config.sh string EigenTrustAlpha $(val)
|
@./vendor/frostfs-adm -c ./frostfs-adm.yml morph set-config EigenTrustAlpha=$(val)
|
||||||
|
|
||||||
# Update basic income rate in fixed 12 (make update.basic_income_rate val=1000)
|
# Update basic income rate in fixed 12 (make update.basic_income_rate val=1000)
|
||||||
update.basic_income_rate:
|
update.basic_income_rate:
|
||||||
@./bin/config.sh int BasicIncomeRate $(val)
|
@./vendor/frostfs-adm -c ./frostfs-adm.yml morph set-config BasicIncomeRate=$(val)
|
||||||
|
|
||||||
# Update homomorphic hashing disabled flag (make update.homomorphic_hashing_disable val=true)
|
# Update homomorphic hashing disabled flag (make update.homomorphic_hashing_disable val=true)
|
||||||
update.homomorphic_hashing_disable:
|
update.homomorphic_hashing_disable:
|
||||||
@./bin/config.sh bool HomomorphicHashingDisabled $(val)
|
@./vendor/frostfs-adm -c ./frostfs-adm.yml morph set-config HomomorphicHashingDisabled=$(val)
|
||||||
|
|
||||||
# Tick new epoch in side chain
|
|
||||||
tick.epoch:
|
|
||||||
@./bin/tick.sh
|
|
||||||
|
|
|
@ -1,4 +1,3 @@
|
||||||
# Deposit GAS from default wallet to FrostFS privnet contract
|
# Deposit GAS from default wallet to FrostFS privnet contract
|
||||||
prepare.ir:
|
prepare.ir:
|
||||||
@./bin/config.sh int ContainerFee 0
|
@./vendor/frostfs-adm -c ./frostfs-adm.yml ContainerFee=0 ContainerAliasFee=0
|
||||||
@./bin/config.sh int ContainerAliasFee 0
|
|
||||||
|
|
Loading…
Reference in a new issue