Skip to content

Commit 16f0064

Browse files
committed
BSC. Debugging and changes after end-to-end testing
1 parent b9557a6 commit 16f0064

19 files changed

+286
-1280
lines changed

lib/bsc/README.md

Lines changed: 31 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -8,13 +8,21 @@ This blueprint is designed to assist in deploying a single node or a Highly Avai
88
|:--------------------:|
99
| [@StayHungryStayFoolish](https://github.com/StayHungryStayFoolish), [@frbrkoala](https://github.com/frbrkoala) |
1010

11-
## Overview of Deployment Architectures for HA setups
11+
## Overview of Deployment Architectures
1212

13-
### HA setup
13+
### Single Node setup
14+
![Single Nodes Deployment](./doc/assets/Architecture-Single-BSC-Node-Runners.drawio.png)
15+
16+
1. The AWS Cloud Development Kit (CDK) is used to deploy a single node. An S3 bucket is utilized to store [User data](https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/user-data.html) and othether script and configuration files required when launching EC2 as the BSC Node.
17+
2. A single RPC BSC Full node is deployed within in the [Default VPC](https://docs.aws.amazon.com/vpc/latest/userguide/default-vpc.html) continuously synchronizes with the rest of nodes on BSC Blockchain Network through [Internet Gateway](https://docs.aws.amazon.com/vpc/latest/userguide/VPC_Internet_Gateway.html).
18+
3. The BSC node is accessed by dApps or development tools internally. JSON RPC API is not exposed to the Internet to protect the node from unauthorized access. dApps need to handle user authentication and API protection, like [in this example for dApps on AWS](https://aws.amazon.com/blogs/architecture/dapp-authentication-with-amazon-cognito-and-web3-proxy-with-amazon-api-gateway/).
19+
4. The BSC node send various monitoring metrics for both EC2 and BSC client to Amazon CloudWatch.
20+
21+
### Highly Available setup
1422

1523
![Highly Available Nodes Deployment](./doc/assets/Architecture-HA-BSC-Node-Runners.drawio.png)
1624

17-
1. The AWS Cloud Development Kit (CDK) deploys the highly available (HA) architecture built with stacks, as shown in the diagram above. An S3 bucket is utilized to store the execution scripts required when launching EC2 as the BSC Node and is updated through [User data](https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/user-data.html).
25+
1. The AWS Cloud Development Kit (CDK) is used to deploy highly available (HA) architecture. An S3 bucket is utilized to store [User data](https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/user-data.html) and othether script and configuration files required when launching EC2 as the BSC Node.
1826
2. A set of RPC BSC Fullnodes are deployed within the [Auto Scaling Group](https://docs.aws.amazon.com/autoscaling/ec2/userguide/auto-scaling-groups.html) in the [Default VPC](https://docs.aws.amazon.com/vpc/latest/userguide/default-vpc.html) continuously synchronizes with the rest of nodes on BSC Blockchain Network through [Internet Gateway](https://docs.aws.amazon.com/vpc/latest/userguide/VPC_Internet_Gateway.html).
1927
3. The BSC nodes are accessed by dApps or development tools internally through [Application Load Balancer](https://docs.aws.amazon.com/elasticloadbalancing/latest/application/introduction.html). JSON RPC API is not exposed to the Internet to protect nodes from unauthorized access. dApps need to handle user authentication and API protection, like [in this example for dApps on AWS](https://aws.amazon.com/blogs/architecture/dapp-authentication-with-amazon-cognito-and-web3-proxy-with-amazon-api-gateway/).
2028
4. The BSC nodes send various monitoring metrics for both EC2 and BSC nodes to Amazon CloudWatch.
@@ -58,7 +66,7 @@ This is the Well-Architected checklist for BSC nodes implementation of the AWS B
5866

5967
| Usage pattern | Ideal configuration | Primary option on AWS | Config reference |
6068
|---------------------------------------------------|--------------------------------------------------------------------------------------------------------------------------|------------------------------------------------------------------------|-------------------------------------------------------|
61-
| 1/ Fullnode | 16 vCPU, 64 GB RAM, Accounts volume: 4TB, 10K IOPS, 700 MB/s throughput, Data volume: 3TB, 10K IOPS, 700 MB/s throughput | `m7g.4xlarge`, Data volume: EBS gp3 4TB, 10K IOPS, 700 MB/s throughput | [.env-sample-full](./sample-configs/.env-sample-full) |
69+
| 1/ Fullnode | 16 vCPU, 64 GB RAM, Data volume: EBS gp3 4TB, 10K IOPS, 700 MB/s throughput | [.env-sample-full](./sample-configs/.env-sample-full) |
6270
</details>
6371

6472
## Setup Instructions
@@ -89,21 +97,19 @@ npm install
8997
> You may see the following error if the default VPC already exists: `An error occurred (DefaultVpcAlreadyExists) when calling the CreateDefaultVpc operation: A Default VPC already exists for this account in this region.`. That means you can just continue with the following steps.
9098
9199
92-
3. Configure and deploy multiple HA Nodes
100+
3. Configure the CDK app
93101
94-
Create your own copy of `.env` file and edit it to update with your AWS Account ID, AWS Region, BSC SNAPSHOTS URI:
102+
Create your own copy of `.env` file and edit it to update with your AWS Account ID, AWS Region, and optionally the BSC SNAPSHOTS URI:
95103
96104
```bash
97105
# Make sure you are in aws-blockchain-node-runners/lib/bsc
98106
cd lib/bsc
99-
npm install
100107
pwd
101108
cp ./sample-configs/.env-sample-full .env
102109
vim .env
103110
```
104111
> **IMPORTANT**:
105-
> 1. Example configuration parameters are set in the local `.env-sample` file. You can find more examples inside `sample-configs` directory.
106-
> 2. Please check this GitHub: https://github.com/48Club/bsc-snapshots, use Geth full node link replace the `BSC_SNAPSHOTS_URI`.
112+
> 1. If you want to set your own `BSC_SNAPSHOTS_URI`, check this GitHub: https://github.com/48Club/bsc-snapshots, and use Geth full node link.
107113
108114
4. Deploy common components such as IAM role
109115
@@ -265,6 +271,9 @@ export AWS_REGION=<your_target_AWS_region>
265271
pwd
266272
# Make sure you are in aws-blockchain-node-runners/lib/bsc
267273
274+
# Undeploy Single Node
275+
cdk destroy bsc-single-node
276+
268277
# Undeploy HA Nodes
269278
cdk destroy bsc-ha-nodes
270279
@@ -276,7 +285,9 @@ cdk destroy bsc-common
276285
277286
### FAQ
278287
279-
1. How to check the logs of the clients running on my sync node? Please enter the [AWS Management Console - EC2 Instances](https://us-east-2.console.aws.amazon.com/ec2/home?region=us-east-2#Instances:instanceState=running), choose the correct region, copy the instance ID you need to query.
288+
1. How to check the logs of the clients running on my sync node?
289+
290+
Please enter the [AWS Management Console - EC2 Instances](https://us-east-2.console.aws.amazon.com/ec2/home?region=us-east-2#Instances:instanceState=running), choose the correct region, copy the instance ID you need to query.
280291
281292
**Note:** In this tutorial we chose not to use SSH and use Session Manager instead. That allows you to log all sessions in AWS CloudTrail to see who logged into the server and when. If you receive an error similar to `SessionManagerPlugin is not found`, [install Session Manager plugin for AWS CLI](https://docs.aws.amazon.com/systems-manager/latest/userguide/session-manager-working-with-install-plugin.html)
282293
@@ -290,7 +301,9 @@ aws ssm start-session --target $INSTANCE_ID --region $AWS_REGION
290301
sudo su ec2-user
291302
sudo journalctl -o cat -fu bsc
292303
```
293-
2. How to check the logs from the EC2 user-data script? Please enter the [AWS Management Console - EC2 Instances](https://us-east-2.console.aws.amazon.com/ec2/home?region=us-east-2#Instances:instanceState=running), choose the correct region, copy the instance ID you need to query.
304+
2. How to check the logs from the EC2 user-data script?
305+
306+
Please enter the [AWS Management Console - EC2 Instances](https://us-east-2.console.aws.amazon.com/ec2/home?region=us-east-2#Instances:instanceState=running), choose the correct region, copy the instance ID you need to query.
294307
295308
```bash
296309
pwd
@@ -302,7 +315,9 @@ aws ssm start-session --target $INSTANCE_ID --region $AWS_REGION
302315
sudo cat /var/log/cloud-init-output.log
303316
```
304317
305-
3. How can I check the BSC service log on EC2? Please enter the [AWS Management Console - EC2 Instances](https://us-east-2.console.aws.amazon.com/ec2/home?region=us-east-2#Instances:instanceState=running), choose the correct region, copy the instance ID you need to query.
318+
3. How can I check the BSC service log on EC2?
319+
320+
Please enter the [AWS Management Console - EC2 Instances](https://us-east-2.console.aws.amazon.com/ec2/home?region=us-east-2#Instances:instanceState=running), choose the correct region, copy the instance ID you need to query.
306321
307322
```bash
308323
pwd
@@ -316,7 +331,9 @@ cd /data
316331
cat bsc.log
317332
```
318333
319-
4. How can I restart the BSC service? Please enter the [AWS Management Console - EC2 Instances](https://us-east-2.console.aws.amazon.com/ec2/home?region=us-east-2#Instances:instanceState=running), choose the correct region, copy the instance ID you need to query.
334+
4. How can I restart the BSC service?
335+
336+
Please enter the [AWS Management Console - EC2 Instances](https://us-east-2.console.aws.amazon.com/ec2/home?region=us-east-2#Instances:instanceState=running), choose the correct region, copy the instance ID you need to query.
320337
321338
```bash
322339
pwd
@@ -326,7 +343,7 @@ export INSTANCE_ID="i-**************"
326343
echo "INSTANCE_ID=" $INSTANCE_ID
327344
328345
aws ssm start-session --target $INSTANCE_ID --region $AWS_REGION
329-
sudo systemctl status bsc
346+
sudo systemctl restart bsc
330347
```
331348
**NOTE:** You can also try the following command to obtain more information:
332349
- Check the BSC service status

lib/bsc/app.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ new BscSingleNodeStack(app, "bsc-single-node", {
2525
instanceCpuType: config.baseNodeConfig.instanceCpuType,
2626
bscNetwork: config.baseNodeConfig.bscNetwork,
2727
nodeConfiguration: config.baseNodeConfig.nodeConfiguration,
28+
snapshotsUrl:config.baseNodeConfig.snapshotsUrl,
2829
dataVolume: config.baseNodeConfig.dataVolume,
2930
});
3031

@@ -36,6 +37,7 @@ new BscHANodesStack(app, "bsc-ha-nodes", {
3637
instanceCpuType: config.baseNodeConfig.instanceCpuType,
3738
bscNetwork: config.baseNodeConfig.bscNetwork,
3839
nodeConfiguration: config.baseNodeConfig.nodeConfiguration,
40+
snapshotsUrl:config.baseNodeConfig.snapshotsUrl,
3941
dataVolume: config.baseNodeConfig.dataVolume,
4042

4143
albHealthCheckGracePeriodMin: config.haNodeConfig.albHealthCheckGracePeriodMin,

0 commit comments

Comments
 (0)