Skip to content

Commit 15878cb

Browse files
committed
update spec file usage
1 parent bff0750 commit 15878cb

File tree

3 files changed

+97
-98
lines changed

3 files changed

+97
-98
lines changed

docker-compose.yml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
version: '3.8'
1+
version: "3.8"
22

33
volumes:
44
mainnet-lite-volume:
@@ -38,7 +38,7 @@ services:
3838
- |
3939
node-subtensor \
4040
--base-path /tmp/blockchain \
41-
--chain raw_spec.json \
41+
--chain raw_spec_finney.json \
4242
--rpc-external --rpc-cors all \
4343
--no-mdns \
4444
--in-peers 500 --out-peers 500 \
@@ -56,7 +56,7 @@ services:
5656
- |
5757
node-subtensor \
5858
--base-path /tmp/blockchain \
59-
--chain raw_spec.json \
59+
--chain raw_spec_finney.json \
6060
--rpc-external --rpc-cors all \
6161
--no-mdns \
6262
--in-peers 500 --out-peers 500 \
@@ -74,7 +74,7 @@ services:
7474
- |
7575
node-subtensor \
7676
--base-path /tmp/blockchain \
77-
--chain raw_testspec.json \
77+
--chain raw_spec_testfinney.json \
7878
--rpc-external --rpc-cors all \
7979
--no-mdns \
8080
--in-peers 500 --out-peers 500 \
@@ -94,7 +94,7 @@ services:
9494
- |
9595
node-subtensor \
9696
--base-path /tmp/blockchain \
97-
--chain raw_testspec.json \
97+
--chain raw_spec_testfinney.json \
9898
--rpc-external --rpc-cors all \
9999
--no-mdns \
100100
--in-peers 500 --out-peers 500 \

docs/running-subtensor-locally.md

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -174,32 +174,33 @@ You can now run the public subtensor node either as a lite node or as an archive
174174
To run a lite node connected to the mainchain, execute the below command (note the `--sync=warp` flag which runs the subtensor node in lite mode):
175175

176176
```bash title="With --sync=warp setting, for lite node"
177-
./target/release/node-subtensor --chain raw_spec.json --base-path /tmp/blockchain --sync=warp --execution wasm --wasm-execution compiled --port 30333 --max-runtime-instances 32 --rpc-max-response-size 2048 --rpc-cors all --rpc-port 9944 --bootnodes /ip4/13.58.175.193/tcp/30333/p2p/12D3KooWDe7g2JbNETiKypcKT1KsCEZJbTzEHCn8hpd4PHZ6pdz5 --no-mdns --in-peers 8000 --out-peers 8000 --prometheus-external --rpc-external
177+
./target/release/node-subtensor --chain raw_spec_finney.json --base-path /tmp/blockchain --sync=warp --execution wasm --wasm-execution compiled --port 30333 --max-runtime-instances 32 --rpc-max-response-size 2048 --rpc-cors all --rpc-port 9944 --bootnodes /ip4/13.58.175.193/tcp/30333/p2p/12D3KooWDe7g2JbNETiKypcKT1KsCEZJbTzEHCn8hpd4PHZ6pdz5 --no-mdns --in-peers 8000 --out-peers 8000 --prometheus-external --rpc-external
178178
```
179179

180180
### Archive node on mainchain
181181

182182
To run an archive node connected to the mainchain, execute the below command (note the `--sync=full` which syncs the node to the full chain and `--pruning archive` flags, which disables the node's automatic pruning of older historical data):
183183

184184
```bash title="With --sync=full and --pruning archive setting, for archive node"
185-
./target/release/node-subtensor --chain raw_spec.json --base-path /tmp/blockchain --sync=full --pruning archive --execution wasm --wasm-execution compiled --port 30333 --max-runtime-instances 32 --rpc-max-response-size 2048 --rpc-cors all --rpc-port 9944 --bootnodes /ip4/13.58.175.193/tcp/30333/p2p/12D3KooWDe7g2JbNETiKypcKT1KsCEZJbTzEHCn8hpd4PHZ6pdz5 --no-mdns --in-peers 8000 --out-peers 8000 --prometheus-external --rpc-external
185+
./target/release/node-subtensor --chain raw_spec_finney.json --base-path /tmp/blockchain --sync=full --pruning archive --execution wasm --wasm-execution compiled --port 30333 --max-runtime-instances 32 --rpc-max-response-size 2048 --rpc-cors all --rpc-port 9944 --bootnodes /ip4/13.58.175.193/tcp/30333/p2p/12D3KooWDe7g2JbNETiKypcKT1KsCEZJbTzEHCn8hpd4PHZ6pdz5 --no-mdns --in-peers 8000 --out-peers 8000 --prometheus-external --rpc-external
186186
```
187187

188188
### Lite node on testchain
189189

190190
To run a lite node connected to the testchain, execute the below command:
191191

192192
```bash title="With bootnodes set to testnet and --sync=warp setting, for lite node."
193-
./target/release/node-subtensor --chain raw_testspec.json --base-path /tmp/blockchain --sync=warp --execution wasm --wasm-execution compiled --port 30333 --max-runtime-instances 32 --rpc-max-response-size 2048 --rpc-cors all --rpc-port 9944 --bootnodes /dns/bootnode.test.finney.opentensor.ai/tcp/30333/p2p/12D3KooWPM4mLcKJGtyVtkggqdG84zWrd7Rij6PGQDoijh1X86Vr --no-mdns --in-peers 8000 --out-peers 8000 --prometheus-external --rpc-external
193+
./target/release/node-subtensor --chain raw_spec_testfinney.json --base-path /tmp/blockchain --sync=warp --execution wasm --wasm-execution compiled --port 30333 --max-runtime-instances 32 --rpc-max-response-size 2048 --rpc-cors all --rpc-port 9944 --bootnodes /dns/bootnode.test.finney.opentensor.ai/tcp/30333/p2p/12D3KooWPM4mLcKJGtyVtkggqdG84zWrd7Rij6PGQDoijh1X86Vr --no-mdns --in-peers 8000 --out-peers 8000 --prometheus-external --rpc-external
194194
```
195195

196196
### Archive node on testchain
197197

198198
To run an archive node connected to the testchain, execute the below command:
199199

200200
```bash title="With bootnodes set to testnet and --sync=full and --pruning archive setting, for archive node"
201-
./target/release/node-subtensor --chain raw_testspec.json --base-path /tmp/blockchain --sync=full --pruning archive --execution wasm --wasm-execution compiled --port 30333 --max-runtime-instances 32 --rpc-max-response-size 2048 --rpc-cors all --rpc-port 9944 --bootnodes /dns/bootnode.test.finney.opentensor.ai/tcp/30333/p2p/12D3KooWPM4mLcKJGtyVtkggqdG84zWrd7Rij6PGQDoijh1X86Vr --no-mdns --in-peers 8000 --out-peers 8000 --prometheus-external --rpc-external
201+
./target/release/node-subtensor --chain raw_spec_testfinney.json --base-path /tmp/blockchain --sync=full --pruning archive --execution wasm --wasm-execution compiled --port 30333 --max-runtime-instances 32 --rpc-max-response-size 2048 --rpc-cors all --rpc-port 9944 --bootnodes /dns/bootnode.test.finney.opentensor.ai/tcp/30333/p2p/12D3KooWPM4mLcKJGtyVtkggqdG84zWrd7Rij6PGQDoijh1X86Vr --no-mdns --in-peers 8000 --out-peers 8000 --prometheus-external --rpc-external
202202
```
203203

204204
## Running on cloud
205+
205206
We have not tested these installation scripts on any cloud service. In addition, if you are using Runpod cloud service, then note that this service is already [containerized](https://docs.runpod.io/pods/overview). Hence, the only option available to you is to compile from the source, as described in the above [Method 2: Using Source Code](#method-2-using-source-code) section. Note that these scripts have not been tested on Runpod.

scripts/run/subtensor.sh

Lines changed: 87 additions & 89 deletions
Original file line numberDiff line numberDiff line change
@@ -4,52 +4,50 @@
44
# Helper functions
55
#
66

7-
function run_command()
8-
{
9-
F_NETWORK=$1
10-
F_NODE_TYPE=$2
11-
F_BIN_PATH=$3
7+
function run_command() {
8+
F_NETWORK=$1
9+
F_NODE_TYPE=$2
10+
F_BIN_PATH=$3
1211

13-
# Different command options by network and node type
14-
MAINNET_BOOTNODE='--bootnodes /dns/bootnode.finney.chain.opentensor.ai/tcp/30333/ws/p2p/12D3KooWRwbMb85RWnT8DSXSYMWQtuDwh4LJzndoRrTDotTR5gDC'
15-
TESTNET_BOOTNODE='--bootnodes /dns/bootnode.test.finney.opentensor.ai/tcp/30333/ws/p2p/12D3KooWPM4mLcKJGtyVtkggqdG84zWrd7Rij6PGQDoijh1X86Vr'
16-
NODE_TYPE_ARCHIVE='--pruning=archive'
17-
NODE_TYPE_LITE='--sync warp'
12+
# Different command options by network and node type
13+
MAINNET_BOOTNODE='--bootnodes /dns/bootnode.finney.chain.opentensor.ai/tcp/30333/ws/p2p/12D3KooWRwbMb85RWnT8DSXSYMWQtuDwh4LJzndoRrTDotTR5gDC'
14+
TESTNET_BOOTNODE='--bootnodes /dns/bootnode.test.finney.opentensor.ai/tcp/30333/ws/p2p/12D3KooWPM4mLcKJGtyVtkggqdG84zWrd7Rij6PGQDoijh1X86Vr'
15+
NODE_TYPE_ARCHIVE='--pruning=archive'
16+
NODE_TYPE_LITE='--sync warp'
1817

19-
# Options by the type of node we offer
20-
MAINNET_ARCHIVE_OPTIONS="$MAINNET_BOOTNODE $NODE_TYPE_ARCHIVE"
21-
MAINNET_LITE_OPTIONS="$MAINNET_BOOTNODE $NODE_TYPE_LITE"
22-
TESTNET_ARCHIVE_OPTIONS="$TESTNET_BOOTNODE $NODE_TYPE_ARCHIVE"
23-
TESTNET_LITE_OPTIONS="$TESTNET_BOOTNODE $NODE_TYPE_LITE"
18+
# Options by the type of node we offer
19+
MAINNET_ARCHIVE_OPTIONS="$MAINNET_BOOTNODE $NODE_TYPE_ARCHIVE"
20+
MAINNET_LITE_OPTIONS="$MAINNET_BOOTNODE $NODE_TYPE_LITE"
21+
TESTNET_ARCHIVE_OPTIONS="$TESTNET_BOOTNODE $NODE_TYPE_ARCHIVE"
22+
TESTNET_LITE_OPTIONS="$TESTNET_BOOTNODE $NODE_TYPE_LITE"
2423

25-
# Checking options to use
26-
if [[ "$F_NETWORK" == "mainnet" ]] && [[ "$F_NODE_TYPE" == "archive" ]]; then
27-
SPECIFIC_OPTIONS=$MAINNET_ARCHIVE_OPTIONS
28-
elif [[ "$F_NETWORK" == "mainnet" ]] && [[ "$F_NODE_TYPE" == "lite" ]]; then
29-
SPECIFIC_OPTIONS=$MAINNET_LITE_OPTIONS
30-
elif [[ "$F_NETWORK" == "testnet" ]] && [[ "$F_NODE_TYPE" == "archive" ]]; then
31-
SPECIFIC_OPTIONS=$TESTNET_ARCHIVE_OPTIONS
32-
elif [[ "$F_NETWORK" == "testnet" ]] && [[ "$F_NODE_TYPE" == "lite" ]]; then
33-
SPECIFIC_OPTIONS=$TESTNET_LITE_OPTIONS
34-
fi
24+
# Checking options to use
25+
if [[ "$F_NETWORK" == "mainnet" ]] && [[ "$F_NODE_TYPE" == "archive" ]]; then
26+
SPECIFIC_OPTIONS=$MAINNET_ARCHIVE_OPTIONS
27+
elif [[ "$F_NETWORK" == "mainnet" ]] && [[ "$F_NODE_TYPE" == "lite" ]]; then
28+
SPECIFIC_OPTIONS=$MAINNET_LITE_OPTIONS
29+
elif [[ "$F_NETWORK" == "testnet" ]] && [[ "$F_NODE_TYPE" == "archive" ]]; then
30+
SPECIFIC_OPTIONS=$TESTNET_ARCHIVE_OPTIONS
31+
elif [[ "$F_NETWORK" == "testnet" ]] && [[ "$F_NODE_TYPE" == "lite" ]]; then
32+
SPECIFIC_OPTIONS=$TESTNET_LITE_OPTIONS
33+
fi
3534

36-
if [ ! -f $F_BIN_PATH ]; then
37-
echo "Binary '$F_BIN_PATH' does not exist. You can use -p or --bin-path to specify a different location."
38-
echo "Please ensure you have compiled the binary first."
39-
exit 1
40-
fi
35+
if [ ! -f $F_BIN_PATH ]; then
36+
echo "Binary '$F_BIN_PATH' does not exist. You can use -p or --bin-path to specify a different location."
37+
echo "Please ensure you have compiled the binary first."
38+
exit 1
39+
fi
4140

42-
# Command to run subtensor
43-
$F_BIN_PATH \
44-
--base-path /tmp/blockchain \
45-
--chain ./raw_spec.json \
46-
--rpc-external --rpc-cors all \
47-
--no-mdns \
48-
--rpc-max-connections 10000 --in-peers 500 --out-peers 500 \
49-
$SPECIFIC_OPTIONS
41+
# Command to run subtensor
42+
$F_BIN_PATH \
43+
--base-path /tmp/blockchain \
44+
--chain ./raw_spec_finney.json \
45+
--rpc-external --rpc-cors all \
46+
--no-mdns \
47+
--rpc-max-connections 10000 --in-peers 500 --out-peers 500 \
48+
$SPECIFIC_OPTIONS
5049
}
5150

52-
5351
# Default values
5452
EXEC_TYPE="docker"
5553
NETWORK="mainnet"
@@ -60,69 +58,69 @@ BIN_PATH="./target/release/node-subtensor"
6058
# Getting arguments from user
6159
while [[ $# -gt 0 ]]; do
6260
case $1 in
63-
-h|--help)
64-
help
65-
exit 0
66-
;;
67-
-e|--execution)
68-
EXEC_TYPE="$2"
69-
shift # past argument
70-
shift # past value
71-
;;
72-
-b|--build)
73-
BUILD="--build"
74-
shift # past argument
75-
;;
76-
-n|--network)
77-
NETWORK="$2"
78-
shift
79-
shift
80-
;;
81-
-t|--node-type)
82-
NODE_TYPE="$2"
83-
shift
84-
shift
85-
;;
86-
-p|--bin-path)
87-
BIN_PATH="$2"
88-
shift
89-
shift
90-
;;
91-
-*|--*)
92-
echo "Unknown option $1"
93-
exit 1
94-
;;
95-
*)
96-
POSITIONAL_ARGS+=("$1")
97-
shift
98-
;;
61+
-h | --help)
62+
help
63+
exit 0
64+
;;
65+
-e | --execution)
66+
EXEC_TYPE="$2"
67+
shift # past argument
68+
shift # past value
69+
;;
70+
-b | --build)
71+
BUILD="--build"
72+
shift # past argument
73+
;;
74+
-n | --network)
75+
NETWORK="$2"
76+
shift
77+
shift
78+
;;
79+
-t | --node-type)
80+
NODE_TYPE="$2"
81+
shift
82+
shift
83+
;;
84+
-p | --bin-path)
85+
BIN_PATH="$2"
86+
shift
87+
shift
88+
;;
89+
-* | --*)
90+
echo "Unknown option $1"
91+
exit 1
92+
;;
93+
*)
94+
POSITIONAL_ARGS+=("$1")
95+
shift
96+
;;
9997
esac
10098
done
10199

102100
# Verifying arguments values
103101
if ! [[ "$EXEC_TYPE" =~ ^(docker|binary)$ ]]; then
104-
echo "Exec type not expected: $EXEC_TYPE"
105-
exit 1
102+
echo "Exec type not expected: $EXEC_TYPE"
103+
exit 1
106104
fi
107105

108106
if ! [[ "$NETWORK" =~ ^(mainnet|testnet)$ ]]; then
109-
echo "Network not expected: $NETWORK"
110-
exit 1
107+
echo "Network not expected: $NETWORK"
108+
exit 1
111109
fi
112110

113111
if ! [[ "$NODE_TYPE" =~ ^(lite|archive)$ ]]; then
114-
echo "Node type not expected: $NODE_TYPE"
115-
exit 1
112+
echo "Node type not expected: $NODE_TYPE"
113+
exit 1
116114
fi
117115

118116
# Running subtensor
119117
case $EXEC_TYPE in
120-
docker)
121-
docker compose down --remove-orphans
122-
echo "Running docker compose up $BUILD --detach $NETWORK-$NODE_TYPE"
123-
docker compose up $BUILD --detach $NETWORK-$NODE_TYPE
124-
;;
125-
binary)
126-
run_command $NETWORK $NODE_TYPE $BIN_PATH
127-
;;
118+
docker)
119+
docker compose down --remove-orphans
120+
echo "Running docker compose up $BUILD --detach $NETWORK-$NODE_TYPE"
121+
docker compose up $BUILD --detach $NETWORK-$NODE_TYPE
122+
;;
123+
binary)
124+
run_command $NETWORK $NODE_TYPE $BIN_PATH
125+
;;
128126
esac

0 commit comments

Comments
 (0)