-
Notifications
You must be signed in to change notification settings - Fork 28
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
102 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
[osmosis] | ||
network = "net6" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
# usage: ./docker_service_create.sh subnode_name | ||
# eg., ./docker_service_create.sh osmosis | ||
|
||
subnode_name="$1" | ||
|
||
if [[ -z $subnode_name ]] | ||
then | ||
echo "No subnode_name. usage eg., ./docker_service_create.sh osmosis" | ||
exit | ||
fi | ||
|
||
eval "$(awk -v TARGET=$subnode_name -F ' = ' ' | ||
{ | ||
if ($0 ~ /^\[.*\]$/) { | ||
gsub(/^\[|\]$/, "", $0) | ||
SECTION=$0 | ||
} else if (($2 != "") && (SECTION==TARGET)) { | ||
print $1 "=" $2 | ||
} | ||
} | ||
' ../data/subnode_registry.ini )" | ||
|
||
echo "network=$network" | ||
|
||
subnode_service_name="sub_${subnode_name}" | ||
|
||
|
||
# delete existing service | ||
docker service rm $subnode_service_name | ||
|
||
# create new service | ||
docker service create \ | ||
--name $subnode_service_name \ | ||
--replicas 1 \ | ||
--network $network \ | ||
--network cosmosia \ | ||
--endpoint-mode dnsrr \ | ||
--constraint 'node.hostname==cosmosia32' \ | ||
--sysctl 'net.ipv4.tcp_tw_reuse=1' \ | ||
--restart-condition none \ | ||
archlinux:latest \ | ||
/bin/bash -c \ | ||
"curl -s https://raw.githubusercontent.com/notional-labs/cosmosia/main/subnode/run.sh > ~/run.sh && \ | ||
/bin/bash ~/run.sh $subnode_name" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
upstream: | ||
- rpc: "http://tasks.lb_osmosis:8000" | ||
api: "http://tasks.lb_osmosis:8001" | ||
grpc: "tasks.lb_osmosis:8003" | ||
blocks: [362880] | ||
- rpc: "http://tasks.lb_osmosis-archive-sub:8000" | ||
api: "http://tasks.lb_osmosis-archive-sub:8001" | ||
grpc: "tasks.lb_osmosis-archive-sub:8003" | ||
blocks: [5599641,0] | ||
- rpc: "http://tasks.lb_osmosis-archive-sub1:8000" | ||
api: "http://tasks.lb_osmosis-archive-sub1:8001" | ||
grpc: "tasks.lb_osmosis-archive-sub1:8003" | ||
blocks: [0,5599640] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
# usage: ./run.sh subnode_name | ||
# eg., ./run.sh osmosis | ||
|
||
subnode_name="$1" | ||
|
||
if [[ -z $subnode_name ]]; then | ||
echo "No subnode_name. usage eg., ./run.sh osmosis" | ||
exit | ||
fi | ||
|
||
pacman -Syu --noconfirm | ||
pacman -Sy --noconfirm go git base-devel wget jq inetutils screen | ||
|
||
echo "#################################################################################################################" | ||
echo "install go..." | ||
|
||
export GOPATH="$HOME/go" | ||
export GOROOT="/usr/lib/go" | ||
export GOBIN="${GOPATH}/bin" | ||
export PATH="${PATH}:${GOROOT}/bin:${GOBIN}" | ||
|
||
cd $HOME | ||
|
||
echo "#################################################################################################################" | ||
echo "install subnode" | ||
|
||
cd $HOME | ||
git clone --single-branch --branch main https://github.com/notional-labs/subnode | ||
cd subnode | ||
make install | ||
|
||
|
||
# get config | ||
curl -s https://raw.githubusercontent.com/notional-labs/cosmosia/main/subnode/${subnode_name}_subnode.yaml > ~/subnode.yaml | ||
|
||
# run subnode with screen to avoid log to docker | ||
cd $HOME | ||
screen -S subnode -dm /root/go/bin/subnode start --conf=/root/subnode.yaml | ||
|
||
######################################################################################################################## | ||
echo "Done!" | ||
# loop forever for debugging only | ||
while true; do sleep 5; done |