forked from TrueCloudLab/frostfs-dev-env
[#238]: Remove interactive password input from setup scripts
Signed-off-by: anastasia prasolova <anastasia@nspcc.ru>
This commit is contained in:
parent
79a11641ed
commit
d8e825443e
6 changed files with 34 additions and 28 deletions
|
@ -1,19 +1,20 @@
|
||||||
#!/usr/bin/env bash
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
|
echo "Running bin/config.sh"
|
||||||
|
|
||||||
# Source env settings
|
# Source env settings
|
||||||
. .env
|
. .env
|
||||||
. services/ir/.ir.env
|
. services/ir/.ir.env
|
||||||
source bin/helper.sh
|
source bin/helper.sh
|
||||||
|
|
||||||
# NeoGo binary path.
|
# NeoGo binary path.
|
||||||
NEOGO="${NEOGO:-docker exec -it main_chain neo-go}"
|
NEOGO="${NEOGO:-docker exec main_chain neo-go}"
|
||||||
|
|
||||||
# Wallet files to change config value
|
# Wallet files to change config value
|
||||||
WALLET="${WALLET:-services/chain/node-wallet.json}"
|
WALLET="${WALLET:-services/chain/node-wallet.json}"
|
||||||
WALLET_IMG="${WALLET_IMG:-wallets/node-wallet.json}"
|
CONFIG_IMG="${CONFIG_IMG:-/wallets/config.yml}"
|
||||||
# Wallet password that would be entered automatically; '-' means no password
|
|
||||||
PASSWD="one"
|
NETMAP_ADDR=$(bin/resolve.sh netmap.neofs) || die "Failed to resolve 'netmap.neofs' domain name"
|
||||||
NETMAP_ADDR=$(bin/resolve.sh netmap.neofs)
|
|
||||||
|
|
||||||
# NeoFS configuration record: variable type [string|int|etc],
|
# NeoFS configuration record: variable type [string|int|etc],
|
||||||
# key is a string and value is a constant of given type
|
# key is a string and value is a constant of given type
|
||||||
|
@ -36,9 +37,9 @@ fi
|
||||||
echo "Changing ${KEY} configration value to ${VALUE}"
|
echo "Changing ${KEY} configration value to ${VALUE}"
|
||||||
|
|
||||||
# shellcheck disable=SC2086
|
# shellcheck disable=SC2086
|
||||||
./bin/passwd.exp ${PASSWD} ${NEOGO} contract invokefunction \
|
${NEOGO} contract invokefunction \
|
||||||
-w ${WALLET_IMG} \
|
--wallet-config ${CONFIG_IMG} \
|
||||||
-a ${ADDR} \
|
-a ${ADDR} --force \
|
||||||
-r http://morph-chain.${LOCAL_DOMAIN}:30333 \
|
-r http://morph-chain.${LOCAL_DOMAIN}:30333 \
|
||||||
${NETMAP_ADDR} \
|
${NETMAP_ADDR} \
|
||||||
setConfig bytes:beefcafe \
|
setConfig bytes:beefcafe \
|
||||||
|
|
|
@ -1,16 +1,17 @@
|
||||||
#!/usr/bin/env bash
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
|
echo "Running bin/deposit.sh"
|
||||||
|
|
||||||
# Source env settings
|
# Source env settings
|
||||||
. .env
|
. .env
|
||||||
. services/ir/.ir.env
|
. services/ir/.ir.env
|
||||||
source bin/helper.sh
|
source bin/helper.sh
|
||||||
|
|
||||||
# NeoGo binary path.
|
# NeoGo binary path.
|
||||||
NEOGO="${NEOGO:-docker exec -it main_chain neo-go}"
|
NEOGO="${NEOGO:-docker exec main_chain neo-go}"
|
||||||
# Wallet file to use for deposit GAS from
|
# Wallet file to use for deposit GAS from
|
||||||
WALLET="${WALLET:-wallets/wallet.json}"
|
WALLET="${WALLET:-services/chain/node-wallet.json}"
|
||||||
# Wallet password that would be entered automatically; '-' means no password
|
CONFIG="${CONFIG:-/wallets/config.yml}"
|
||||||
PASSWD="-"
|
|
||||||
# How much GAS to deposit. First cli argument or 50 by default
|
# How much GAS to deposit. First cli argument or 50 by default
|
||||||
DEPOSIT="${1:-50}"
|
DEPOSIT="${1:-50}"
|
||||||
|
|
||||||
|
@ -25,10 +26,10 @@ CONTRACT_ADDR=$(${NEOGO} util convert "${NEOFS_IR_CONTRACTS_NEOFS}" \
|
||||||
|
|
||||||
# Make deposit
|
# Make deposit
|
||||||
# shellcheck disable=SC2086
|
# shellcheck disable=SC2086
|
||||||
./bin/passwd.exp ${PASSWD} ${NEOGO} wallet nep17 transfer \
|
${NEOGO} wallet nep17 transfer \
|
||||||
-w ${WALLET} \
|
--wallet-config ${CONFIG} \
|
||||||
-r http://main-chain.${LOCAL_DOMAIN}:30333 \
|
-r http://main-chain.${LOCAL_DOMAIN}:30333 \
|
||||||
--from ${ADDR} \
|
--from ${ADDR} --force \
|
||||||
--to ${CONTRACT_ADDR} \
|
--to ${CONTRACT_ADDR} \
|
||||||
--token GAS \
|
--token GAS \
|
||||||
--amount ${DEPOSIT}
|
--amount ${DEPOSIT} || die "Cannot transfer GAS to NeoFS contract"
|
||||||
|
|
|
@ -5,7 +5,7 @@
|
||||||
source bin/helper.sh
|
source bin/helper.sh
|
||||||
|
|
||||||
# NeoGo binary path.
|
# NeoGo binary path.
|
||||||
NEOGO="${NEOGO:-docker exec -t morph_chain neo-go}"
|
NEOGO="${NEOGO:-docker exec morph_chain neo-go}"
|
||||||
# NNS contract script hash
|
# NNS contract script hash
|
||||||
output=$(curl -s --data '{ "id": 1, "jsonrpc": "2.0", "method": "getcontractstate", "params": [1] }' \
|
output=$(curl -s --data '{ "id": 1, "jsonrpc": "2.0", "method": "getcontractstate", "params": [1] }' \
|
||||||
"http://morph-chain.${LOCAL_DOMAIN}:30333/") \
|
"http://morph-chain.${LOCAL_DOMAIN}:30333/") \
|
||||||
|
|
21
bin/tick.sh
21
bin/tick.sh
|
@ -1,20 +1,18 @@
|
||||||
#!/usr/bin/env bash
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
|
echo "Running bin/tick.sh"
|
||||||
|
|
||||||
# Source env settings
|
# Source env settings
|
||||||
. .env
|
. .env
|
||||||
. services/ir/.ir.env
|
. services/ir/.ir.env
|
||||||
source bin/helper.sh
|
source bin/helper.sh
|
||||||
|
|
||||||
# NeoGo binary path.
|
# NeoGo binary path.
|
||||||
NEOGO="${NEOGO:-docker exec -it main_chain neo-go}"
|
NEOGO="${NEOGO:-docker exec main_chain neo-go}"
|
||||||
NEOGO_NONINTERACTIVE="${NEOGO_NONINTERACTIVE:-docker exec -t main_chain neo-go}"
|
|
||||||
|
|
||||||
# Wallet files to change config value
|
# Wallet files to change config value
|
||||||
WALLET="${WALLET:-services/chain/node-wallet.json}"
|
WALLET="${WALLET:-services/chain/node-wallet.json}"
|
||||||
WALLET_IMG="${WALLET_IMG:-wallets/node-wallet.json}"
|
CONFIG_IMG="${CONFIG_IMG:-/wallets/config.yml}"
|
||||||
|
|
||||||
# Wallet password that would be entered automatically; '-' means no password
|
|
||||||
PASSWD="one"
|
|
||||||
|
|
||||||
# Internal variables
|
# Internal variables
|
||||||
if [[ -z "${NEOFS_NOTARY_DISABLED}" ]]; then
|
if [[ -z "${NEOFS_NOTARY_DISABLED}" ]]; then
|
||||||
|
@ -30,7 +28,7 @@ BLOCK_DURATION=$(grep SecondsPerBlock < "$SIDECHAIN_PROTO" | awk '{print $2}') \
|
||||||
NETMAP_ADDR=$(bin/resolve.sh netmap.neofs) || die "Cannot resolve netmap.neofs"
|
NETMAP_ADDR=$(bin/resolve.sh netmap.neofs) || die "Cannot resolve netmap.neofs"
|
||||||
|
|
||||||
# Fetch current epoch value
|
# Fetch current epoch value
|
||||||
EPOCH=$(${NEOGO_NONINTERACTIVE} contract testinvokefunction \
|
EPOCH=$(${NEOGO} contract testinvokefunction \
|
||||||
-r "http://morph-chain.${LOCAL_DOMAIN}:30333" "${NETMAP_ADDR}" epoch \
|
-r "http://morph-chain.${LOCAL_DOMAIN}:30333" "${NETMAP_ADDR}" epoch \
|
||||||
| grep 'value' | awk -F'"' '{ print $4 }') \
|
| grep 'value' | awk -F'"' '{ print $4 }') \
|
||||||
|| die "Cannot fetch epoch from netmap contract"
|
|| die "Cannot fetch epoch from netmap contract"
|
||||||
|
@ -38,12 +36,13 @@ EPOCH=$(${NEOGO_NONINTERACTIVE} contract testinvokefunction \
|
||||||
echo "Updating NeoFS epoch to $((EPOCH+1))"
|
echo "Updating NeoFS epoch to $((EPOCH+1))"
|
||||||
|
|
||||||
# shellcheck disable=SC2086
|
# shellcheck disable=SC2086
|
||||||
./bin/passwd.exp ${PASSWD} ${NEOGO} contract invokefunction \
|
${NEOGO} contract invokefunction \
|
||||||
-w ${WALLET_IMG} \
|
--wallet-config ${CONFIG_IMG} \
|
||||||
-a ${ADDR} \
|
-a ${ADDR} --force \
|
||||||
-r http://morph-chain.${LOCAL_DOMAIN}:30333 \
|
-r http://morph-chain.${LOCAL_DOMAIN}:30333 \
|
||||||
${NETMAP_ADDR} \
|
${NETMAP_ADDR} \
|
||||||
newEpoch int:$((EPOCH+1)) -- ${ADDR}:Global
|
newEpoch int:$((EPOCH+1)) -- ${ADDR}:Global \
|
||||||
|
|| die "Cannot increment an epoch"
|
||||||
|
|
||||||
# Wait one Morph block to ensure the transaction broadcasted
|
# Wait one Morph block to ensure the transaction broadcasted
|
||||||
# shellcheck disable=SC2086
|
# shellcheck disable=SC2086
|
||||||
|
|
4
services/chain/config.yml
Normal file
4
services/chain/config.yml
Normal file
|
@ -0,0 +1,4 @@
|
||||||
|
---
|
||||||
|
|
||||||
|
Path: "/wallets/node-wallet.json"
|
||||||
|
Password: "one"
|
|
@ -20,6 +20,7 @@ services:
|
||||||
- ./../../vendor/chain.gz:/chain.gz
|
- ./../../vendor/chain.gz:/chain.gz
|
||||||
- ./protocol.privnet.yml:/config/protocol.privnet.yml
|
- ./protocol.privnet.yml:/config/protocol.privnet.yml
|
||||||
- ./node-wallet.json:/wallets/node-wallet.json
|
- ./node-wallet.json:/wallets/node-wallet.json
|
||||||
|
- ./config.yml:/wallets/config.yml
|
||||||
- ./../../vendor/hosts:/etc/hosts
|
- ./../../vendor/hosts:/etc/hosts
|
||||||
- ./../../wallets/wallet.json:/wallets/wallet.json
|
- ./../../wallets/wallet.json:/wallets/wallet.json
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue