-
Notifications
You must be signed in to change notification settings - Fork 98
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Web deploy prerequisites #1851
Web deploy prerequisites #1851
Changes from all commits
016018e
d3848ed
7b2b801
46f4f20
64c81d8
d64e66e
967ffb1
1edf21d
ac5e061
36f4120
27b8aa7
1b67222
95c9c0b
f5ce8e7
1026a0c
0a7feb4
05a2cd1
56bc3fd
753fd41
7cc72f8
feaaca6
6c0cba7
4a2bbcc
350162d
5ddd0de
7afb09d
f8e549c
3add0a3
ad0e32d
f4a7d6e
6de0f30
66cf411
f81241e
ce35078
db13411
15245af
c5cf5d5
2177370
08e998e
08496c8
a72e9cb
8023c9e
fb97647
a474d0d
f01e1b9
65364ee
ef6904c
303282a
7ffa670
ffa9e31
3925acc
a41e20d
e4215d4
82d34dc
5a99626
9a0d2a6
be42509
09c8d76
d45f655
163bbcf
0b87b33
081e394
70feb28
32d91e2
200f406
ea4d09e
88f6b4a
5bb6b87
bb6bd6c
24ff2c4
386e076
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,67 @@ | ||
#!/bin/bash | ||
|
||
PASSWORD=1234567890 | ||
ACCOUNT=main_account | ||
PORT=26657 | ||
API_PORT=8080 | ||
NETWORK=testnet | ||
AMOUNT=100stake | ||
|
||
# first of all remove old genesis, we do not want other node to boot with the wrong stuff | ||
aws s3 rm s3://cosmos-gaia/genesis.json | ||
|
||
# Initialize local node with an account name and a chain | ||
./gaiad init --home . --moniker ${ACCOUNT} --chain-id ${NETWORK} | ||
sabau marked this conversation as resolved.
Show resolved
Hide resolved
|
||
NODEID=$(./gaiad tendermint show-node-id --home .) | ||
|
||
# Create our main account and add it to the genesis with a lot of money | ||
echo ${PASSWORD} | ./gaiacli keys add ${ACCOUNT} --home . > main_node.log | ||
./gaiad add-genesis-account $(./gaiacli keys show ${ACCOUNT} --home . --address) 150000stake,100000photino,123cococoin --home . | ||
|
||
echo ${PASSWORD} | ./gaiad gentx --name ${ACCOUNT} --home . --home-client . | ||
./gaiad collect-gentxs --home . | ||
|
||
# Make our genesis avaialable to the secondary nodes | ||
aws s3 cp config/genesis.json s3://cosmos-gaia/genesis.json | ||
|
||
# boot proper nodes in reachable detached sessions | ||
screen -dmS gaia ./gaiad start --home . | ||
screen -dmS rest ./gaiacli rest-server --laddr tcp://0.0.0.0:${API_PORT} --home . --node http://localhost:${PORT} --chain-id ${NETWORK} --trust-node true | ||
|
||
# get my address to use it as source of richness for others | ||
ADDRESS=$(./gaiacli keys show ${ACCOUNT} --home . --address) | ||
|
||
while true | ||
do | ||
# Is anyone asking for money | ||
LIST=$(aws s3 ls s3://cosmos-gaia/addresses/) | ||
sabau marked this conversation as resolved.
Show resolved
Hide resolved
|
||
if [[ -n "${LIST}" ]]; | ||
then | ||
# TODO: SRE team is working on a clean solution. | ||
# This hacky version is temporary and will be replaced by a stargate running on a separate machine | ||
# Remove this logic as soon as we put back the deploy-gaia automation | ||
|
||
# Check if a stargate is locally running | ||
PID=$(lsof -ti tcp:${API_PORT}) | ||
jbibla marked this conversation as resolved.
Show resolved
Hide resolved
|
||
if [[ -n "${PID}" ]]; | ||
then | ||
# we cannot use gaiacli while the rest server is running, it locks the resources | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. in theory we could have a second gaiacli instance where we import the main key which performs the action There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. correct! @mircea-c told me something like this will become true in their infrastructure + stargate will be on a separate machine, so for now I left the hacky solution, but I'll add a TODO to remember that when we'll adopt the real network deployment this PID stuff has to be removed, sounds ok? |
||
kill -9 ${PID} | ||
fi | ||
|
||
echo ${LIST} | while IFS= read -r row || [[ -n "$row" ]]; do | ||
# for every file in the list pick the address and give money to it, then delete the file | ||
DESTINATION=$(echo $row | awk '{print $4}') | ||
|
||
# Just in case we were running this command with rest-server switched on, get again the address | ||
ADDRESS=$(./gaiacli keys show ${ACCOUNT} --home . --address) | ||
echo ${PASSWORD} | ./gaiacli tx send --home . --from ${ADDRESS} --amount=${AMOUNT} --to=${DESTINATION} --chain-id=${NETWORK} | ||
|
||
# Remove this address from the ones that needs money | ||
aws s3 rm s3://cosmos-gaia/addresses/${DESTINATION} | ||
done | ||
|
||
#restore the rest server | ||
screen -dmS rest ./gaiacli rest-server --laddr tcp://0.0.0.0:${API_PORT} --home . --node http://localhost:${PORT} --chain-id ${NETWORK} --trust-node true | ||
fi | ||
done |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
#!/bin/bash | ||
|
||
PASSWORD=1234567890 | ||
ACCOUNT=operator_account | ||
PORT=26656 | ||
# TODO: hardcoded temporary, this will become a parameter coming from the first ECS instance | ||
MAINNODEID=d08c69fa85969f3d0173f23aadc40268559d0f66 | ||
MAINNODEIP=172.31.35.89 | ||
MAINACCOUNT=main_account | ||
NETWORK=testnet | ||
VALIDATOR_AMOUNT=10stake | ||
|
||
# Initialize local node with a secondary account | ||
./gaiad init --home . --moniker ${ACCOUNT} --chain-id ${NETWORK} | ||
|
||
GENESIS=`aws s3 ls s3://cosmos-gaia/genesis.json | grep genesis.json` | ||
while [[ -z "$GENESIS" ]]; do | ||
sleep 3s | ||
ISTHERE=`aws s3 ls s3://cosmos-gaia/genesis.json | grep genesis.json` | ||
done | ||
aws s3 cp s3://cosmos-gaia/genesis.json config/genesis.json | ||
|
||
# GET Genesis file into config/genesis.json | ||
NODEID=$(./gaiad tendermint show-node-id --home .) | ||
|
||
# boot referring to the remote node | ||
screen -dmS gaia ./gaiad start --home . --p2p.laddr=tcp://0.0.0.0:$((PORT)) --address=tcp://0.0.0.0:$((PORT+1)) --rpc.laddr=tcp://0.0.0.0:$((PORT+2)) --p2p.persistent_peers="$MAINNODEID@$MAINNODEIP:$((PORT))" | ||
|
||
# get the key to make my node validator | ||
PUBKEY=$(./gaiad tendermint show-validator --home .) | ||
echo ${PASSWORD} | ./gaiacli keys add ${ACCOUNT} --home . > secondary_node.log | ||
ADDRESS=$(./gaiacli keys show ${ACCOUNT} --home . --address) | ||
echo ${PUBKEY} > ./${ADDRESS} | ||
|
||
# ask money by declaring my node | ||
aws s3 cp ${ADDRESS} s3://cosmos-gaia/addresses/${ADDRESS} | ||
|
||
poor=true | ||
sabau marked this conversation as resolved.
Show resolved
Hide resolved
|
||
while ${poor} | ||
do | ||
# query my account to check if I'm still poor | ||
ACCOUNT_INFO=$(./gaiacli query account ${ADDRESS} --chain-id ${NETWORK} --trust-node --home .) | ||
if [[ ${ACCOUNT_INFO} == *"auth/Account"* ]]; then | ||
echo "Address funded, thanks main node!" | ||
poor=false | ||
fi | ||
sleep 3s | ||
done | ||
|
||
echo ${PASSWORD} | ./gaiacli tx staking create-validator --home . --from ${ACCOUNT} --amount=${VALIDATOR_AMOUNT} --pubkey=${PUBKEY} --address-delegator=${ADDRESS} --moniker=${ACCOUNT} --chain-id=${NETWORK} --commission-max-change-rate=0 --commission-max-rate=0 --commission-rate=0 --min-self-delegation=1 -json |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
do we need to include
.aws
files? @cosmos/sre ?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
those are used by the current (temporary) node setup on EC2, until the real network boot on merge is ready