Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
M
metadeploy
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Nebula
metadeploy
Commits
5d3a014c
Commit
5d3a014c
authored
Nov 20, 2023
by
Your Name
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
update host
parent
6f8bbf23
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
204 additions
and
36 deletions
+204
-36
host.sh
host/host.sh
+204
-36
No files found.
host/host.sh
View file @
5d3a014c
#!/bin/bash
set
-e
N
=
${
1
:-
2
}
isSeed
=
0
withParam
=
0
input_string_ip
=
""
input_string_enr
=
""
if
[
$#
-eq
2
]
;
then
withParam
=
1
isSeed
=
1
datadir
=
${
1
:-
./data/
}
input_string_ip
=
${
2
}
regex
=
'^([0-9]{1,3}\.){3}[0-9]{1,3}$'
while
true
do
if
[[
$input_string_ip
=
~
$regex
]]
;
then
break
fi
echo
${
input_string_ip
}
" is not a valid ip"
echo
"please input your p2p public ip address as seed: "
read
input_string_ip
done
fi
if
[
$#
-eq
3
]
;
then
withParam
=
1
datadir
=
${
1
:-
./data/
}
input_string_ip
=
${
2
}
input_string_enr
=
${
3
}
regex
=
'^([0-9]{1,3}\.){3}[0-9]{1,3}$'
while
true
do
if
[[
$input_string_ip
=
~
$regex
]]
;
then
break
fi
echo
${
input_string_ip
}
" is not a valid ip"
echo
"please input your p2p public ip address as seed: "
read
input_string_ip
done
while
true
do
if
[
$(
echo
${
input_string_enr
}
|
wc
-L
)
-eq
199
]
;
then
break
fi
echo
${
input_string_enr
}
" is not a valid seed enr"
echo
"please input your p2p seed enr: "
read
input_string_enr
done
fi
if
[
$withParam
-eq
0
]
;
then
read
-p
"please input your data dir:"
-t
100 datadir
datadir
=
${
datadir
:-
./data/
}
while
true
do
echo
"please input your p2p public ip address as seed: "
read
input_string_ip
if
[[
$input_string_ip
=
~
$regex
]]
;
then
break
fi
echo
${
input_string_ip
}
" is not a valid ip"
echo
"please input your p2p public ip address as seed: "
read
input_string_ip
done
while
true
do
echo
"please input your p2p seed enr, or cancel with no: "
read
input_string_enr
if
[
$(
echo
${
input_string_enr
}
|
wc
-L
)
-eq
199
]
;
then
break
fi
if
[
${
input_string_enr
}
==
"no"
]
;
then
isSeed
=
1
break
fi
echo
${
input_string_enr
}
" is not a valid seed enr"
echo
"please input your p2p seed enr: "
read
input_string_enr
done
fi
echo
"isSeed "
$isSeed
echo
"withParam "
$withParam
echo
"input_string_ip "
$input_string_ip
echo
"input_string_enr "
$input_string_enr
seedEnr
=
$input_string_enr
ipAddr
=
$input_string_ip
host_ip
=
${
2
:-
$host_ip
}
cd
../mainchain/
rm
-rf
conf/deploy
||
true
echo
"./mainchain/scripts/run-testnet.sh "
cp
-r
conf/back0712-1439 conf/deploy
cd
../host/
rm
-rfv
./data/nebula/
rm
-rfv
./data/net/
*
rm
-rfv
./data/ring/
*
rm
-rfv
./data/prometheus/
*
mkdir
-p
./data/prometheus/
chmod
777 ./data/prometheus/
config_dir
=
$PWD
/data/nebula/
N
=
2
rm
-rf
$datadir
mkdir
-p
$datadir
cp
-r
../mainchain/
$datadir
# cd ../mainchain/
# rm -rf conf/deploy || true
# echo "./mainchain/scripts/run-testnet.sh "
# cp -r conf/back0712-1439 conf/deploy
# cd ../host/
# rm -rfv ./data/nebula/
# rm -rfv ./data/net/*
# rm -rfv ./data/ring/*
# rm -rfv ./data/prometheus/*
prometheusDir
=
$datadir
/prometheus
echo
$prometheusDir
mkdir
-p
$prometheusDir
chmod
777
$prometheusDir
config_dir
=
$datadir
/nebula
mkdir
-p
$config_dir
data_dir
=
$config_dir
/data
echo
$config_dir
$data_dir
rm
-rfv
$data_dir
mkdir
-p
$data_dir
mkdir
$data_dir
cp
nebula/genesis.json
$config_dir
/
configFile
=
$config_dir
/config.toml
rm
-fv
$configFile
echo
"p2p_server =
\"
net
${
i
}
:38010
\"
"
>
$configFile
echo
"sentry_server =
\"
sentry
${
i
}
:38003
\"
"
>>
$configFile
echo
'grpc_addr = ":38004"'
>>
$configFile
...
...
@@ -43,7 +154,8 @@ echo 'gs_block_count = 100' >> $configFile
for
i
in
$(
seq
1
$N
)
do
echo
"generate metanet config at
$i
"
configPath
=
$PWD
/data/net/
$i
configPath
=
$datadir
/net/
$i
echo
$configPath
mkdir
-p
$configPath
configFile
=
$configPath
/config.yaml
rm
-fv
$configFile
...
...
@@ -53,18 +165,68 @@ do
echo
"use-discovery: true"
>>
$configFile
echo
"grpc-host:
\"
0.0.0.0
\"
"
>>
$configFile
echo
"grpc-port: 38010"
>>
$configFile
echo
"p2p-host-ip:
\"
$
host_ip
\"
"
>>
$configFile
echo
"p2p-host-ip:
\"
$
ipAddr
\"
"
>>
$configFile
if
[
$i
-eq
1
]
;
then
echo
"p2p-priv-key:
\"
/etc/MetaNet/default-priv-key
\"
"
>>
$configFile
else
echo
"bootstrap-node: [
\"
enr:-JG4QEOwrARSiElnvYO0oWjgOrt9-faERbU0O_pYM2Cuh_s9K__lZ2Lco569gWZFfOrqI7pEwKBxG3RYqZRvhJCHwMGGAYvHpaQegmlkgnY0gmlwhBJmI8iJc2VjcDI1NmsxoQJ81pyuyqa2QoPztOPsCqpkcW1gJwUxOcSJuWr9VUNavIN0Y3CCdn2DdWRwgnZ-
\"
]"
>>
$configFile
#
decoded enr: /ip4/192.168.1.220/tcp/30334/p2p/16Uiu2HAm3pzLayNahJtkYHaxWFMibZ7RuyG8BRsdj1YQRvwWYKM5
echo
"bootstrap-node: [
${
seedEnr
}
]"
>>
$configFile
#
echo "bootstrap-node: [\"enr:-JG4QEOwrARSiElnvYO0oWjgOrt9-faERbU0O_pYM2Cuh_s9K__lZ2Lco569gWZFfOrqI7pEwKBxG3RYqZRvhJCHwMGGAYvHpaQegmlkgnY0gmlwhBJmI8iJc2VjcDI1NmsxoQJ81pyuyqa2QoPztOPsCqpkcW1gJwUxOcSJuWr9VUNavIN0Y3CCdn2DdWRwgnZ-\"]" >> $configFile
fi
done
# net config end
# config_dir=$PWD/data/nebula/
# data_dir=$config_dir/data
# echo $config_dir $data_dir
# rm -rfv $data_dir
# mkdir -p $data_dir
# cp nebula/genesis.json $config_dir/
# configFile=$config_dir/config.toml
# rm -fv $configFile
# echo "p2p_server = \"net${i}:38010\"" > $configFile
# echo "sentry_server = \"sentry${i}:38003\"" >> $configFile
# echo 'grpc_addr = ":38004"' >> $configFile
# echo 'chain_id = 100' >> $configFile
# echo 'metrics_port = 18020' >> $configFile
# echo 'max_gs_count = 50000000' >> $configFile
# echo 'gs_block_count = 100' >> $configFile
# # net config
# for i in $(seq 1 $N)
# do
# echo "generate metanet config at $i"
# configPath=$PWD/data/net/$i
# mkdir -p $configPath
# configFile=$configPath/config.yaml
# rm -fv $configFile
# echo "single-node: true" >> $configFile
# echo "log-level: \"debug\"" >> $configFile
# echo "enable-prom: true" >> $configFile
# echo "use-discovery: true" >> $configFile
# echo "grpc-host: \"0.0.0.0\"" >> $configFile
# echo "grpc-port: 38010" >> $configFile
# echo "p2p-host-ip: \"$ipAddr\"" >> $configFile
# if [ $i -eq 1 ]; then
# echo "p2p-priv-key: \"/etc/MetaNet/default-priv-key\"" >> $configFile
# else
# # enr:-JG4QEDELCRO3beGW0Ob5xRCDDdfFhetKzl9h5m0q9BodprjcRI2ibkRk-5jHmCRdxYC7Cs2PSgQNIhgL8IarvwxM-OGAYvrepBcgmlkgnY0gmlwhMCoAdyJc2VjcDI1NmsxoQJ81pyuyqa2QoPztOPsCqpkcW1gJwUxOcSJuWr9VUNavIN0Y3CCdn2DdWRwgnZ
# # enr:-JG4QEOwrARSiElnvYO0oWjgOrt9-faERbU0O_pYM2Cuh_s9K__lZ2Lco569gWZFfOrqI7pEwKBxG3RYqZRvhJCHwMGGAYvHpaQegmlkgnY0gmlwhBJmI8iJc2VjcDI1NmsxoQJ81pyuyqa2QoPztOPsCqpkcW1gJwUxOcSJuWr9VUNavIN0Y3CCdn2DdWRwgnZ
# echo "bootstrap-node: [${seedEnr}]" >> $configFile
# #echo "bootstrap-node: [\"enr:-JG4QEOwrARSiElnvYO0oWjgOrt9-faERbU0O_pYM2Cuh_s9K__lZ2Lco569gWZFfOrqI7pEwKBxG3RYqZRvhJCHwMGGAYvHpaQegmlkgnY0gmlwhBJmI8iJc2VjcDI1NmsxoQJ81pyuyqa2QoPztOPsCqpkcW1gJwUxOcSJuWr9VUNavIN0Y3CCdn2DdWRwgnZ-\"]" >> $configFile
# # decoded enr: /ip4/192.168.1.220/tcp/30334/p2p/16Uiu2HAm3pzLayNahJtkYHaxWFMibZ7RuyG8BRsdj1YQRvwWYKM5
# fi
# done
# # net config end
resourcering
=
"
deploy:
resources:
...
...
@@ -109,13 +271,14 @@ sentryConfig="app.json"
echo
"{"
>
$sentryConfig
echo
"
\"
contract
\"
:
\"
0x054795542cA35Fb055b219ed647628935e5dDf96
\"
,"
>>
$sentryConfig
echo
"
\"
rpc_node
\"
:
\"
http://
$
host_ip
:8545
\"
,"
>>
$sentryConfig
echo
"
\"
rpc_node
\"
:
\"
http://
$
ipAddr
:8545
\"
,"
>>
$sentryConfig
echo
"
\"
chain_id
\"
: 1024,"
>>
$sentryConfig
echo
"
\"
main_account_priv
\"
:
\"
F53D987FB2E98107A6AD7916AA8C6FF65F9C19D3F703AF7540002357ECAB69A1
\"
"
>>
$sentryConfig
echo
"}"
>>
$sentryConfig
mv
$sentryConfig
./sentry/
mkdir
-p
$datadir
/sentry/
mv
$sentryConfig
$datadir
/sentry/
for
i
in
$(
seq
1
$N
)
do
...
...
@@ -129,9 +292,10 @@ echo "#!/bin/bash" > $startfile
echo
"set -e"
>>
$startfile
if
[
$i
-eq
1
]
;
then
echo
"cd ../mainchain"
>>
$startfile
#echo "pwd=$PWD" >> $startfile
echo
"cd
$datadir
/mainchain"
>>
$startfile
echo
"./scripts/run-testnet.sh"
>>
$startfile
echo
"cd
../host"
>>
$startfile
echo
"cd
$PWD
"
>>
$startfile
echo
"sleep 10"
>>
$startfile
fi
echo
"docker compose -f "
$composefile
" up -d"
>>
$startfile
...
...
@@ -142,9 +306,9 @@ chmod +x $startfile
echo
"#!/bin/bash"
>
$stopfile
echo
"set -e"
>>
$stopfile
if
[
$i
-eq
1
]
;
then
echo
"cd
..
/mainchain"
>>
$stopfile
echo
"cd
$datadir
/mainchain"
>>
$stopfile
echo
"./scripts/stop-testnet.sh || true"
>>
$stopfile
echo
"cd
../host"
>>
$stopfile
echo
"cd
$PWD
"
>>
$stopfile
fi
echo
"docker compose -f "
$composefile
" down"
>>
$stopfile
...
...
@@ -184,7 +348,7 @@ echo ' delay: 15s' >> $compose
echo
' max_attempts: 100'
>>
$composefile
echo
' window: 120s'
>>
$composefile
echo
' volumes:'
>>
$composefile
echo
' -
./sentry/app.json:/root/app.json'
>>
$composefile
echo
' -
'
$datadir
'/sentry/app.json:/root/app.json'
>>
$composefile
echo
' networks:'
>>
$composefile
echo
' - meta'
>>
$composefile
echo
""
>>
$composefile
...
...
@@ -199,7 +363,7 @@ echo " - \"$((38010)):38010\"" >> $composefile
echo
" -
\"
$((
30333
))
:30333
\"
"
>>
$composefile
echo
" -
\"
$((
30334
))
:30334/udp
\"
"
>>
$composefile
echo
" volumes:"
>>
$composefile
echo
" -
./data
/net/
$i
:/root"
>>
$composefile
echo
" -
"
$datadir
"
/net/
$i
:/root"
>>
$composefile
echo
" networks:"
>>
$composefile
echo
" meta:"
>>
$composefile
echo
" ipv4_address: 172.99.1.
$i
"
>>
$composefile
...
...
@@ -213,10 +377,10 @@ echo "" >> $composefile
echo
" nebula:"
>>
$composefile
echo
" image: 192.168.1.220:5000/nebula:v0.0.
8
"
>>
$composefile
echo
" image: 192.168.1.220:5000/nebula:v0.0.
9
"
>>
$composefile
echo
" container_name: nebula"
>>
$composefile
echo
" volumes:"
>>
$composefile
echo
" -
./data/nebula/:/root"
>>
$composefile
echo
" -
"
$datadir
"/nebula/:/root"
>>
$composefile
echo
" depends_on:"
>>
$composefile
echo
" - net"
>>
$composefile
echo
" - sentry"
>>
$composefile
...
...
@@ -239,7 +403,7 @@ echo " container_name: ring" >> $composefile
#echo " entrypoint: sh -c 'echo "+"ring"+" && sleep 10 && ringd start --ethconfig.httphost 0.0.0.0 --mempool.sentryurl sentry:38003 --mempool.nebulaurl nebula:38004 --mempool.p2purl net:38010 --mempool.cryptourl cryptor:38001 --mempool.checkerurl txchecker:38002 --mempool.writeunreadytxs=false --mempool.writerepeatedmsg=false --mempool.batchconfirminittimeout=60 --mempool.batchconfirmtimeouti=1.5 --mempool.batchrepeatedqueuesize=0' " >> $composefile
echo
" entrypoint: sh -c 'echo "
+
"ring"
+
" && sleep 10 && ringd start --ethconfig.httphost 0.0.0.0 --mempool.sentryurl sentry:38003 --mempool.nebulaurl nebula:38004 --mempool.p2purl net:38010 --mempool.cryptourl cryptor:38001 --mempool.checkerurl txchecker:38002 --mempool.writeunreadytxs=false --mempool.writerepeatedmsg=false --mempool.batchconfirminittimeout=600 --mempool.batchconfirmtimeouti=1.5 --mempool.batchrepeatedqueuesize=0 --mempool.batchconfirmenable=false --rpconfig.async=false >>/data/log' "
>>
$composefile
echo
" volumes:"
>>
$composefile
echo
" -
./data
/ring/:/data"
>>
$composefile
echo
" -
"
$datadir
"
/ring/:/data"
>>
$composefile
echo
" depends_on:"
>>
$composefile
echo
" - cryptor"
>>
$composefile
echo
" - net"
>>
$composefile
...
...
@@ -289,7 +453,7 @@ echo " - --config.file=/etc/prometheus/prometheus.yml" >> $composefile
echo
" - --storage.tsdb.path=/prometheus"
>>
$composefile
echo
" volumes:"
>>
$composefile
echo
" - ./prometheus/prometheus.yml:/etc/prometheus/prometheus.yml:ro"
>>
$composefile
echo
" -
./data
/prometheus:/prometheus"
>>
$composefile
echo
" -
"
$datadir
"
/prometheus:/prometheus"
>>
$composefile
echo
" depends_on:"
>>
$composefile
echo
" - cadvisor"
>>
$composefile
echo
" networks:"
>>
$composefile
...
...
@@ -302,7 +466,6 @@ echo " config:" >>
echo
" - subnet: 172.99.0.0/16"
>>
$composefile
done
...
...
@@ -310,3 +473,8 @@ done
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment