-
Notifications
You must be signed in to change notification settings - Fork 2
/
run_agent.sh
executable file
·56 lines (45 loc) · 1.56 KB
/
run_agent.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
cleanup() {
echo "Terminating tendermint..."
if kill -0 "$tm_subprocess_pid" 2>/dev/null; then
kill "$tm_subprocess_pid"
wait "$tm_subprocess_pid" 2>/dev/null
fi
echo "Tendermint terminated"
}
# Load env vars
source .env
repo_path=$PWD
# Link cleanup to the exit signal
trap cleanup EXIT
# Remove previous agent if exists
if test -d impact_evaluator; then
echo "Removing previous agent build"
rm -r impact_evaluator
fi
# Remove empty directories to avoid wrong hashes
find . -empty -type d -delete
# Ensure that third party packages are correctly synced
make clean
AUTONOMY_VERSION=v$(autonomy --version | grep -oP '(?<=version\s)\S+')
AEA_VERSION=v$(aea --version | grep -oP '(?<=version\s)\S+')
autonomy packages sync --source valory-xyz/open-aea:$AEA_VERSION --source valory-xyz/open-autonomy:$AUTONOMY_VERSION --update-packages
# Ensure hashes are updated
autonomy packages lock
# Fetch the agent
autonomy fetch --local --agent valory/impact_evaluator
# Replace params with env vars
source .env
python scripts/aea-config-replace.py
# Copy and add the keys and issue certificates
cd impact_evaluator
cp $PWD/../ethereum_private_key.txt .
autonomy add-key ethereum ethereum_private_key.txt
autonomy issue-certificates
# Run tendermint
rm -r ~/.tendermint
tendermint init > /dev/null 2>&1
echo "Starting Tendermint..."
tendermint node --proxy_app=tcp://127.0.0.1:26658 --rpc.laddr=tcp://127.0.0.1:26657 --p2p.laddr=tcp://0.0.0.0:26656 --p2p.seeds= --consensus.create_empty_blocks=true > /dev/null 2>&1 &
tm_subprocess_pid=$!
# Run the agent
aea -s run