Skip to content

Commit 4339e2e

Browse files
committed
Updating deployment instructions
1 parent df71041 commit 4339e2e

File tree

1 file changed

+108
-12
lines changed

1 file changed

+108
-12
lines changed

lib/sui/README.md

Lines changed: 108 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ This blueprint has step by step guides to set up a single Sui Full Node.
1010

1111

1212
### Sui Full Node setup
13-
![SingleNodeSetup](./doc/assets/Architecture-SingleNode.png)
13+
![SingleNodeSetup](./doc/assets/Architecture-Single.png)
1414

1515
This setup is for PoC or development environments and it supports Devnet, Testnet and Mainnet. It deploys a single EC2 instance with Sui client. The RPC port is exposed only to internal IP range of the VPC, while P2P ports allow external access to keep the client synced.
1616

@@ -54,6 +54,8 @@ Create your own copy of `.env` file and edit it:
5454
cp ./sample-configs/.env-sample-full .env
5555
nano .env
5656
```
57+
**NOTE:** You can find more examples inside the `sample-configs` directory.
58+
5759

5860
4. Deploy common components such as IAM role, and Amazon S3 bucket to store data snapshots
5961

@@ -65,15 +67,16 @@ Create your own copy of `.env` file and edit it:
6567

6668
### Deploy Sui Full-Node
6769

68-
1. Deploy JSON_RPC Full Node
70+
1. Deploy Full Node
6971

7072
```bash
7173
pwd
7274
# Make sure you are in aws-blockchain-node-runners/lib/sui
7375
npx cdk deploy sui-single-node --json --outputs-file single-node-deploy.json
7476
```
77+
**NOTE:** The default VPC must have at least two public subnets in different Availability Zones, and public subnet must set `Auto-assign public IPv4 address` to `YES`.
7578

76-
The EC2 instance will deploy, initialize the node and start the first sync. In Cloudformation the instance will show as successful once the node is running. From that point it still takes a while until the node is synced to the blockchain. You can check the sync status with the REST call below in step 4. If the `curl cannot connect to the node on port 8732, then the node is still importing. Once that's done, the curl command works.
79+
The EC2 instance will deploy, initialize the node and start the first sync. In Cloudformation the instance will show as successful once the node is running. From that point it still takes a while until the node is synced to the blockchain. You can check the sync status with the REST call below in step 4. If the `curl cannot connect to the node on port 9000, then the node is still importing. Once that's done, the curl command works.
7780

7881
2. After starting the node you need to wait for the inital syncronization process to finish. It may take from an hour to half a day depending on the the state of the network. You can use Amazon CloudWatch to track the progress. To see them:
7982

@@ -82,11 +85,7 @@ Create your own copy of `.env` file and edit it:
8285

8386
4. Once the initial synchronization is done, you should be able to access the RPC API of that node from within the same VPC. The RPC port is not exposed to the Internet. Check if the JSON-RPC port is open and working — run the following command from a terminal:
8487

85-
```bash
86-
INSTANCE_ID=$(cat single-node-deploy.json | jq -r '..|.singleinstanceid? | select(. != null)')
87-
NODE_INTERNAL_IP=$(aws ec2 describe-instances --instance-ids $INSTANCE_ID --query 'Reservations[*].Instances[*].PrivateIpAddress' --output text)
88-
89-
# We query if the node is synced to main
88+
``` We query if the node is synced to main
9089
## replace <your IP address> with your server IP address
9190
curl --location --request POST <your IP address>:9000 \
9291
--header 'Content-Type: application/json' \
@@ -95,8 +94,15 @@ curl --location --request POST <your IP address>:9000 \
9594

9695
The result should start like like this (the actual balance might change):
9796

98-
```{"jsonrpc":"2.0","result":{"openrpc":"1.2.6","info":{"title":"Sui JSON-RPC","description":"Sui JSON-RPC API for interaction with Sui Full node. Make RPC calls using https://fullnode.NETWORK.sui.io:443, where NETWORK is the network you want to use (testnet, devnet, mainnet). By default, local networks use port 9000.","contact":{"name":"Mysten Labs","url":"https://mystenlabs.com","email":"[email protected]"},"license":{"name":"Apache-2.0","url":"https://raw.githubusercontent.com/MystenLabs/sui/main/LICENSE"},"version":"1.28.2"},"methods
9997
```
98+
{"jsonrpc":"2.0","result":{"openrpc":"1.2.6","info":{"title":"Sui JSON-RPC","description":"Sui JSON-RPC API for interaction with Sui Full node. Make RPC calls using https://fullnode.NETWORK.sui.io:443, where NETWORK is the network you want to use (testnet, devnet, mainnet). By default, local networks use port 9000.","contact":{"name":"Mysten Labs","url":"https://mystenlabs.com","email":"[email protected]"},"license":{"name":"Apache-2.0","url":"https://raw.githubusercontent.com/MystenLabs/sui/main/LICENSE"},"version":"1.28.2"},"methods
99+
```
100+
101+
102+
103+
104+
105+
100106

101107

102108
### Clearing up and undeploying everything
@@ -117,7 +123,7 @@ The result should start like like this (the actual balance might change):
117123

118124
# You need to manually delete an s3 bucket with a name similar to 'sui-snapshots-$accountid-tz-nodes-common' on the console,firstly empty the bucket,secondly delete the bucket,and then execute
119125
# Delete all common components like IAM role and Security Group
120-
cdk destroy dui-common
126+
cdk destroy sui-common
121127
```
122128

123129
2. Follow steps to delete the Cloud9 instance in [Cloud9 Setup](../../doc/setup-cloud9.md)
@@ -132,8 +138,98 @@ The result should start like like this (the actual balance might change):
132138
pwd
133139
# Make sure you are in aws-blockchain-node-runners/lib/Sui
134140

135-
export INSTANCE_ID=$(cat single-node-deploy.json | jq -r '..|.single-node-instance-id? | select(. != null)')
141+
export INSTANCE_ID=$(jq -r '.["sui-single-node-testnet"].nodeinstanceid' single-node-deploy.json)
136142
echo "INSTANCE_ID=" $INSTANCE_ID
137-
aws ssm start-session --target $INSTANCE_ID --region $AWS_REGION
143+
aws ssm start-session --target $INSTANCE_ID
138144
sudo cat /var/log/cloud-init-output.log
139145
```
146+
147+
2. If SSH is disabled, how to login to fullnode instance?
148+
149+
```bash
150+
NODE_INTERNAL_IP=$(aws ec2 describe-instances --instance-ids $INSTANCE_ID --query 'Reservations[*].Instances[*].PrivateIpAddress' --output text)
151+
echo "NODE_INTERNAL_IP="$NODE_INTERNAL_IP
152+
pwd
153+
# Make sure you are in aws-blockchain-node-runners/lib/Sui
154+
aws ssm start-session --target $INSTANCE_ID
155+
156+
```
157+
158+
3. Service Tools
159+
160+
```
161+
#Check Sui version
162+
sui -V
163+
# Check node logs
164+
sudo journalctl -fu suid -o cat
165+
# Check node status
166+
sudo service suid status
167+
# Restart node
168+
sudo systemctl restart suid
169+
# Stop Node
170+
sudo systemctl stop suid
171+
# Start Node
172+
sudo systemctl start suid
173+
```
174+
175+
4. Journalctl and Node Status throws errors:
176+
177+
Set up archival fallback to enable your node to fallback to an archive in case of lag, add this block to your fullnode.yaml file as described here https://docs.sui.io/guides/operator/archives#set-up-archival-fallback. Restart Node
178+
179+
```
180+
Example:
181+
182+
state-archive-read-config:
183+
- object-store-config:
184+
object-store: "S3"
185+
# Use mysten-testnet-archives for testnet
186+
# Use mysten-mainnet-archives for mainnet
187+
bucket: "mysten-testnet-archives"
188+
# Use your AWS account access key id
189+
aws-access-key-id: ""
190+
# Use your AWS account secret access key
191+
aws-secret-access-key: ""
192+
aws-region: "us-west-2"
193+
object-store-connection-limit: 20
194+
# How many objects to read ahead when catching up
195+
concurrency: 5
196+
# Whether to prune local state based on latest checkpoint in archive.
197+
# This should stay false for most use cases
198+
use-for-pruning-watermark: false
199+
200+
```
201+
202+
5. Restoring a Full node using snapshots: Restoring using RocksDB snapshots to restore from a RocksDB snapshot, follow these steps (https://docs.sui.io/guides/operator/snapshots):
203+
```
204+
Syntax:
205+
sui-tool download-db-snapshot --latest \
206+
--network <NETWORK> --snapshot-bucket <BUCKET-NAME> \
207+
--snapshot-bucket-type <TYPE> --path <PATH-TO-NODE-DB> \
208+
--num-parallel-downloads 25 \
209+
--skip-indexes \
210+
--no-sign-request
211+
212+
213+
Example:
214+
sudo sui-tool download-db-snapshot --latest --network testnet --path /data/sui/db/live --num-parallel-downloads 50 --skip-indexes --no-sign-request
215+
216+
```
217+
218+
6. Compare the number of checkpoints on your node and on chain
219+
220+
```bash
221+
## replace <your IP address> with your server IP address
222+
curl -q <your IP address>:9184/metrics 2>/dev/null |grep '^highest_synced_checkpoint'; echo
223+
```
224+
```bash
225+
## replace <Network_ID> with devnet| testnet | mainnet
226+
curl --location --request POST 'https://fullnode.<Network_ID>.sui.io:443/' --header 'Content-Type: application/json' --data-raw '{"jsonrpc":"2.0", "id":1,"method":"sui_getLatestCheckpointSequenceNumber"}'; echo
227+
```
228+
229+
7. Monitoring Sui node metrics over port TCP/9184
230+
231+
```
232+
Enter your node's external IP at https://node.sui.zvalid.com/
233+
```
234+
235+

0 commit comments

Comments
 (0)