diff --git a/.gitallowed b/.gitallowed index 85406aff..7998b212 100644 --- a/.gitallowed +++ b/.gitallowed @@ -1,3 +1,3 @@ account: '\d{12}' account: "\d{12}" -account=\d{12} \ No newline at end of file +account=\d{12} diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md index d3e71a80..78a207bb 100644 --- a/.github/PULL_REQUEST_TEMPLATE.md +++ b/.github/PULL_REQUEST_TEMPLATE.md @@ -12,13 +12,17 @@ Consult the [CONTRIBUTING](https://github.com/aws-samples/aws-blockchain-node-ru ### More - [ ] Yes, I have tested the PR using my local account setup (Provide any test evidence report under Additional Notes) -- [ ] Mandatory for new node blueprints. Yes, I have added a example to support my blueprint PR -- [ ] Mandatory for new node blueprints. Yes, I have updated the `website/docs` or `website/blog` section for this feature -- [ ] Yes, I ran `pre-commit run -a` with this PR. Link for installing [pre-commit](https://pre-commit.com/) locally +- [ ] Mandatory for new node blueprints. Yes, I have added usage example to the `README.md` file in my blueprint folder +- [ ] Mandatory for new node blueprints. Yes, I have implemented automated tests for all stacks in my blueprint and they pass +- [ ] Mandatory for new node blueprints. Yes, I have added a reference to my `README.md` file to `website/docs` section for this feature +- [ ] Yes, I have set up and ran all [pre-merge quality control tools](./docs/pre-merge-tools.md) on my local machine and they don't show warnings. ### For Moderators -- [ ] E2E Test successfully complete before merge? +- [ ] The tests for all current blueprints successfully complete before merge? +- [ ] Mandatory for new node blueprints. All [pre-merge quality control tools](./docs/pre-merge-tools.md) and `cdk-nag` tools don't show warnings? +- [ ] Mandatory for new node blueprints. The deployment test works on blank AWS account according to instructions in the `README.md` before merge? +- [ ] Mandatory for new node blueprints. The website builds without errors? ### Additional Notes diff --git a/.gitignore b/.gitignore index 2c5e59f2..c8047016 100644 --- a/.gitignore +++ b/.gitignore @@ -33,4 +33,4 @@ single-node-deploy*.json ha-nodes-deploy*.json *.OLD -.env \ No newline at end of file +.env diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 5771c530..e64ba280 100755 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -10,3 +10,4 @@ repos: - id: detect-private-key - id: detect-aws-credentials args: ['--allow-missing-credentials'] + - id: forbid-submodules diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 570f1f8e..baf8657d 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -32,10 +32,11 @@ To send us a pull request, please: 1. Fork the repository. 2. Modify the source; please focus on the specific change you are contributing. If you also reformat all the code, it will be hard for us to focus on your change. 3. Ensure local tests pass. -4. If you contribute a new CDK app, make sure you use [cdk-nag](https://aws.amazon.com/blogs/devops/manage-application-security-and-compliance-with-the-aws-cloud-development-kit-and-cdk-nag/) in your applicaiton. -4. Commit to your fork using clear commit messages. -5. Send us a pull request, answering any default questions in the pull request interface. -6. Pay attention to any automated CI failures reported in the pull request, and stay involved in the conversation. +4. If you contribute a new CDK app, make sure you use [cdk-nag](https://aws.amazon.com/blogs/devops/manage-application-security-and-compliance-with-the-aws-cloud-development-kit-and-cdk-nag/) in your application. +4. Set up and run [pre-merge quality control tools](./docs/pre-merge-tools.md) on your local machine. +5. Commit to your fork using clear commit messages. +6. Send us a pull request, answering any default questions in the pull request interface. +7. Pay attention to any automated CI failures reported in the pull request, and stay involved in the conversation. GitHub provides additional document on [forking a repository](https://help.github.com/articles/fork-a-repo/) and [creating a pull request](https://help.github.com/articles/creating-a-pull-request/). diff --git a/LICENSE b/LICENSE index 09951d9f..56a66b6b 100644 --- a/LICENSE +++ b/LICENSE @@ -14,4 +14,3 @@ FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - diff --git a/README.md b/README.md index f35c35ee..a3f8a43e 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,25 @@ # AWS Blockchain Node Runners -This repository contains sample [AWS Cloud Development Kit (CDK)](https://aws.amazon.com/cdk/) applications that help to set up and run self-service blockchain nodes for different protocols on AWS. +This repository contains sample [AWS Cloud Development Kit (CDK)](https://aws.amazon.com/cdk/) applications (Node Runner blueprints) to deploy on AWS self-service blockchain nodes for various protocols. For more information see [Introducing AWS Blockchain Node Runners](https://aws-samples.github.io/aws-blockchain-node-runners/docs/intro). -- [Setup instructions for Ethereum nodes on AWS](./lib/ethereum/README.md) \ No newline at end of file +### Documentation +For deployment instructions see [AWS Blockchain Node Runners Blueprints](https://aws-samples.github.io/aws-blockchain-node-runners/docs/Blueprints/intro) + +### Contributing +See [CONTRIBUTING](./CONTRIBUTING.md) for more information. + +### Directory structure + +- `docs` - General documentation applicable to all Node Runner blueprints (CDK applications within the `./lib` directory) +- `lib` - The place for all Node Runner blueprints and shared re-usable [CDK constructs](https://docs.aws.amazon.com/cdk/v2/guide/constructs.html) +- `lib/constructs` - [CDK constructs](https://docs.aws.amazon.com/cdk/v2/guide/constructs.html) used in Node Runner blueprints +- `lib/your-chain` - Node Runner blueprint for a specific chain +- `lib/your-chain/doc` - Documentation specific to the Node Runner blueprint +- `lib/your-chain/lib` - Place for CDK stacks and other blueprint assets +- `lib/your-chain/sample-configs` - Place for sample configurations to deploy Node Runner blueprint to your environment +- `lib/your-chain/test` - Place for unit tests to verify the Node Runner blueprint creates all necessary infrastructure +- `website` - Content for the project web site built with [Docusaurus](https://docusaurus.io/) +- `website/docs` - Place for the new blueprint deployment instructions. (If you are adding a new blueprint, use on of the existing examples to refer to the `README.md` file within your Node Runner blueprint directory inside `lib`). + +### License +This repository uses MIT License. See more in [LICENSE](./LICENSE) diff --git a/docs/pre-merge-tools.md b/docs/pre-merge-tools.md new file mode 100644 index 00000000..fc75c403 --- /dev/null +++ b/docs/pre-merge-tools.md @@ -0,0 +1,43 @@ +# Pre-merge tools + +We need your help to achieve better code quality and make sure the blueprints stay secure. Before merging your new commit, please set up and run the following tools on your development machine. + +1. [git-secrets](https://github.com/awslabs/git-secrets) + +```bash +# Install (Mac OS) +npm run install-git-secrets-mac + +# Install on other platforms: https://github.com/awslabs/git-secrets#installing-git-secrets + +# Setup +npm run setup-git-secrets + +# Scan history +npm run scan-history-git-secrets + +# Scan repository +npm run scan-repo-git-secrets +``` + +2. [semgrep](https://github.com/semgrep/semgrep) + +```bash +# Install (Mac OS) +npm run install-semgrep-mac + +# Install on other platforms: https://github.com/semgrep/semgrep#option-2-getting-started-from-the-cli + +# Scan +npm run scan-semgrep +``` + +3. [pre-commit](https://pre-commit.com) + +```bash +# Install (Mac OS) +npm run install-pre-commit-mac + +# Run +npm run run-pre-commit +``` \ No newline at end of file diff --git a/lib/constructs/constants.ts b/lib/constructs/constants.ts index 3104a04b..71604acc 100644 --- a/lib/constructs/constants.ts +++ b/lib/constructs/constants.ts @@ -1,4 +1,4 @@ export const InstanceStoreageDeviceVolumeType = "instance-store"; export const NoneValue = "none"; export const VolumeDeviceNames = ["/dev/sdf", "/dev/sdg", "/dev/sdh", "/dev/sdi", "/dev/sdj", "/dev/sdk"] -export const GibibytesToBytesConversionCoefficient = 1073741824; \ No newline at end of file +export const GibibytesToBytesConversionCoefficient = 1073741824; diff --git a/lib/constructs/ha-rpc-nodes-with-alb.ts b/lib/constructs/ha-rpc-nodes-with-alb.ts index dd0b8872..e4b6bd2a 100644 --- a/lib/constructs/ha-rpc-nodes-with-alb.ts +++ b/lib/constructs/ha-rpc-nodes-with-alb.ts @@ -35,7 +35,7 @@ export class HANodesConstruct extends cdkContructs.Construct { const availabilityZones = cdk.Stack.of(this).availabilityZones; - const { + const { instanceType, dataVolumes, rootDataVolumeDeviceName, @@ -202,10 +202,10 @@ export class HANodesConstruct extends cdkContructs.Construct { { id: "AwsSolutions-EC29", reason: "Its Ok to terminate this instance as long as we have the data in the snapshot", - + }, ], true ); } -} \ No newline at end of file +} diff --git a/lib/constructs/single-node.ts b/lib/constructs/single-node.ts index b9a31fec..a87369b5 100644 --- a/lib/constructs/single-node.ts +++ b/lib/constructs/single-node.ts @@ -25,7 +25,7 @@ export class SingleNodeConstruct extends cdkContructs.Construct { constructor(scope: cdkContructs.Construct, id: string, props: SingleNodeConstructCustomProps) { super(scope, id); - const { + const { instanceName, instanceType, dataVolumes, @@ -37,7 +37,7 @@ export class SingleNodeConstruct extends cdkContructs.Construct { availabilityZone, vpcSubnets, } = props; - + const singleNode = new ec2.Instance(this, "single-node", { instanceName: instanceName, instanceType: instanceType, @@ -64,10 +64,10 @@ export class SingleNodeConstruct extends cdkContructs.Construct { }); this.instance = singleNode; - + // Processing data volumes let dataVolumeIDs: string[] = [constants.NoneValue]; - + dataVolumes.forEach((dataVolume, arrayIndex) => { const dataVolumeIndex = arrayIndex +1; if (dataVolumeIndex > 6){ @@ -83,18 +83,18 @@ export class SingleNodeConstruct extends cdkContructs.Construct { throughput: dataVolume.throughput, removalPolicy: cdk.RemovalPolicy.DESTROY, }); - + new ec2.CfnVolumeAttachment(this, `data-volume${dataVolumeIndex}-attachment`, { // Device naming according to https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/device_naming.html device: constants.VolumeDeviceNames[arrayIndex], instanceId: singleNode.instanceId, volumeId: newDataVolume.volumeId, }); - + dataVolumeIDs[arrayIndex] = newDataVolume.volumeId; } }) - + // Getting logical ID of the instance to send ready signal later once the instance is initialized const singleNodeCfn = singleNode.node.defaultChild as ec2.CfnInstance; this.nodeCFLogicalId = singleNodeCfn.logicalId; @@ -117,10 +117,10 @@ export class SingleNodeConstruct extends cdkContructs.Construct { { id: "AwsSolutions-EC29", reason: "Its Ok to terminate this instance as long as we have the data in the snapshot", - + }, ], true ); } -} \ No newline at end of file +} diff --git a/lib/constructs/snapshots-bucket.ts b/lib/constructs/snapshots-bucket.ts index 566e238c..8d2065ae 100644 --- a/lib/constructs/snapshots-bucket.ts +++ b/lib/constructs/snapshots-bucket.ts @@ -12,7 +12,7 @@ export class SnapshotsS3BucketConstruct extends cdkContructs.Construct { constructor(scope: cdkContructs.Construct, id: string, props: SnapshotsS3BucketConstructProps) { super(scope, id); - const { + const { bucketName } = props; @@ -28,9 +28,9 @@ export class SnapshotsS3BucketConstruct extends cdkContructs.Construct { encryption: s3.BucketEncryption.S3_MANAGED, enforceSSL: true, }); - + this.bucketName = snapshotsBucket.bucketName; this.bucketArn = snapshotsBucket.bucketArn; this.arnForObjects = snapshotsBucket.arnForObjects; } -} \ No newline at end of file +} diff --git a/lib/ethereum/README.md b/lib/ethereum/README.md index e039c0ff..1cdc4412 100644 --- a/lib/ethereum/README.md +++ b/lib/ethereum/README.md @@ -129,7 +129,7 @@ Note: the snapshot backup process will automatically run ever day at midnight ti ```bash export ETH_RPC_ABL_URL=$(cat rpc-node-deploy.json | jq -r '..|.alburl? | select(. != null)') echo $ETH_RPC_ABL_URL - + # We query token balance of Beacon deposit contract: https://etherscan.io/address/0x00000000219ab540356cbb839cbe05303d7705fa curl http://$ETH_RPC_ABL_URL:8545 -X POST -H "Content-Type: application/json" \ --data '{"method":"eth_getBalance","params":["0x00000000219ab540356cBB839Cbe05303d7705Fa", "latest"],"id":1,"jsonrpc":"2.0"}' @@ -151,7 +151,7 @@ The result should be like this (the actual balance might change): ``` -**NOTE:** By default and for security reasons the load balancer is available only from wihtin the default VPC in the region where it is deployed. It is not available from the Internet and is not open for external connections. Before opening it up please make sure you protect your RPC APIs. +**NOTE:** By default and for security reasons the load balancer is available only from wihtin the default VPC in the region where it is deployed. It is not available from the Internet and is not open for external connections. Before opening it up please make sure you protect your RPC APIs. ### Clearing up and undeploying everything @@ -161,10 +161,10 @@ The result should be like this (the actual balance might change): # Setting the AWS account id and region in case local .env file is lost export AWS_ACCOUNT_ID= export AWS_REGION= - + pwd # Make sure you are in aws-blockchain-node-runners/lib/ethereum - + # Undeploy RPC Nodes cdk destroy eth-rpc-nodes diff --git a/lib/ethereum/cdk.json b/lib/ethereum/cdk.json index 1994f2d7..d374005c 100644 --- a/lib/ethereum/cdk.json +++ b/lib/ethereum/cdk.json @@ -41,4 +41,4 @@ "@aws-cdk/aws-route53-patters:useCertificate": true, "@aws-cdk/customresources:installLatestAwsSdkDefault": false } -} \ No newline at end of file +} diff --git a/lib/ethereum/doc/assets/Well_Architected.md b/lib/ethereum/doc/assets/Well_Architected.md index ddd50f5e..e8a9281c 100644 --- a/lib/ethereum/doc/assets/Well_Architected.md +++ b/lib/ethereum/doc/assets/Well_Architected.md @@ -23,4 +23,4 @@ This is the Well-Architected checklist for Ethereum nodes implementation of the | | Storage selection | How is storage solution selected? | Storage solution is selected based on best price-performance, i.e. gp3 Amazon EBS volumes with optimal IOPS and throughput. | | | Architecture selection | How is the best performance architecture selected? | s5cmd tool has been chosen for Amazon S3 uploads/downloads because it gives better price-performance compared to Amazon EBS snapshots (including Fast Snapshot Restore, which can be expensive). | | Operational excellence | Workload health | How is health of workload determined? | Health of workload is determined via AWS Application Load Balancer Target Group Health Checks, on port 8545. | -| Sustainability | Hardware & services | Select most efficient hardware for your workload | This solution uses AWS Graviton-based Amazon EC2 instances which offer the best performance per watt of energy use in Amazon EC2. | \ No newline at end of file +| Sustainability | Hardware & services | Select most efficient hardware for your workload | This solution uses AWS Graviton-based Amazon EC2 instances which offer the best performance per watt of energy use in Amazon EC2. | diff --git a/lib/ethereum/lib/assets/copy-data-from-s3.sh b/lib/ethereum/lib/assets/copy-data-from-s3.sh index 8ac2f339..aa70fd09 100644 --- a/lib/ethereum/lib/assets/copy-data-from-s3.sh +++ b/lib/ethereum/lib/assets/copy-data-from-s3.sh @@ -14,4 +14,4 @@ echo "$(($SECONDS / 60)) minutes and $(($SECONDS % 60)) seconds elapsed." && \ su ethereum && \ /usr/local/bin/docker-compose -f /home/ethereum/docker-compose.yml up -d && \ aws autoscaling complete-lifecycle-action --lifecycle-action-result CONTINUE --instance-id $INSTANCE_ID --lifecycle-hook-name "$LIFECYCLE_HOOK_NAME" --auto-scaling-group-name "$AUTOSCALING_GROUP_NAME" --region $REGION || \ -aws autoscaling complete-lifecycle-action --lifecycle-action-result ABANDON --instance-id $INSTANCE_ID --lifecycle-hook-name "$LIFECYCLE_HOOK_NAME" --auto-scaling-group-name "$AUTOSCALING_GROUP_NAME" --region $REGION +aws autoscaling complete-lifecycle-action --lifecycle-action-result ABANDON --instance-id $INSTANCE_ID --lifecycle-hook-name "$LIFECYCLE_HOOK_NAME" --auto-scaling-group-name "$AUTOSCALING_GROUP_NAME" --region $REGION diff --git a/lib/ethereum/lib/assets/copy-data-to-s3.sh b/lib/ethereum/lib/assets/copy-data-to-s3.sh index 4e7d6a4a..63cef98a 100644 --- a/lib/ethereum/lib/assets/copy-data-to-s3.sh +++ b/lib/ethereum/lib/assets/copy-data-to-s3.sh @@ -8,4 +8,4 @@ s5cmd --log error sync /data $SNAPSHOT_S3_PATH/ echo "Sync finished at " $(date) sudo touch /data/snapshotted sudo su ethereum -/usr/local/bin/docker-compose -f /home/ethereum/docker-compose.yml up -d \ No newline at end of file +/usr/local/bin/docker-compose -f /home/ethereum/docker-compose.yml up -d diff --git a/lib/ethereum/lib/assets/cw-agent.json b/lib/ethereum/lib/assets/cw-agent.json index b0d696f3..28833017 100644 --- a/lib/ethereum/lib/assets/cw-agent.json +++ b/lib/ethereum/lib/assets/cw-agent.json @@ -73,4 +73,4 @@ } } } -} \ No newline at end of file +} diff --git a/lib/ethereum/lib/assets/node-cw-dashboard.ts b/lib/ethereum/lib/assets/node-cw-dashboard.ts index 587bf65b..731b889c 100644 --- a/lib/ethereum/lib/assets/node-cw-dashboard.ts +++ b/lib/ethereum/lib/assets/node-cw-dashboard.ts @@ -270,4 +270,4 @@ export const SyncNodeCWDashboardJSON = { } } ] -} \ No newline at end of file +} diff --git a/lib/ethereum/lib/assets/sync-checker/syncchecker-besu-teku.sh b/lib/ethereum/lib/assets/sync-checker/syncchecker-besu-teku.sh index 81c6618a..e40f04f1 100644 --- a/lib/ethereum/lib/assets/sync-checker/syncchecker-besu-teku.sh +++ b/lib/ethereum/lib/assets/sync-checker/syncchecker-besu-teku.sh @@ -49,7 +49,7 @@ aws cloudwatch put-metric-data --metric-name elc_sync_block --namespace CWAgent aws cloudwatch put-metric-data --metric-name elc_blocks_behind --namespace CWAgent --value $EXECUTION_CLIENT_BLOCKS_BEHIND --timestamp $TIMESTAMP --dimensions InstanceId=$INSTANCE_ID --region $REGION # If the node is a sync node, check if the snapshot is already taken. If the snapshot is not taken, then take it and restart the node. -if [[ "$NODE_ROLE" == "sync-node" ]]; then +if [[ "$NODE_ROLE" == "sync-node" ]]; then if [ ! -f "/data/snapshotted" ]; then if [ "$EXECUTION_CLIENT_SYNC_STATS" == "false" ] && [ "$CONSENSUS_CLIENT_IS_SYNCING" == "false" ] && [ "$CONSENSUS_CLIENT_IS_OPTIMISTIC" == "false" ]; then sudo /opt/copy-data-to-s3.sh @@ -57,6 +57,6 @@ if [[ "$NODE_ROLE" == "sync-node" ]]; then # Take a snapshot once a day at midnight (sudo crontab -u root -l; echo '0 0 * * * /opt/copy-data-to-s3.sh' ) | sudo crontab -u root - sudo crontab -l - fi + fi fi -fi \ No newline at end of file +fi diff --git a/lib/ethereum/lib/assets/sync-checker/syncchecker-erigon-lighthouse.sh b/lib/ethereum/lib/assets/sync-checker/syncchecker-erigon-lighthouse.sh index 6c8e5196..5450f1c8 100644 --- a/lib/ethereum/lib/assets/sync-checker/syncchecker-erigon-lighthouse.sh +++ b/lib/ethereum/lib/assets/sync-checker/syncchecker-erigon-lighthouse.sh @@ -49,7 +49,7 @@ aws cloudwatch put-metric-data --metric-name elc_sync_block --namespace CWAgent aws cloudwatch put-metric-data --metric-name elc_blocks_behind --namespace CWAgent --value $EXECUTION_CLIENT_BLOCKS_BEHIND --timestamp $TIMESTAMP --dimensions InstanceId=$INSTANCE_ID --region $REGION # If the node is a sync node, check if the snapshot is already taken. If the snapshot is not taken, then take it and restart the node. -if [[ "$NODE_ROLE" == "sync-node" ]]; then +if [[ "$NODE_ROLE" == "sync-node" ]]; then if [ ! -f "/data/snapshotted" ]; then if [ "$EXECUTION_CLIENT_SYNC_STATS" == "false" ] && [ "$CONSENSUS_CLIENT_IS_SYNCING" == "false" ] && [ "$CONSENSUS_CLIENT_IS_OPTIMISTIC" == "false" ]; then sudo /opt/copy-data-to-s3.sh @@ -57,6 +57,6 @@ if [[ "$NODE_ROLE" == "sync-node" ]]; then # Take a snapshot once a day at midnight (sudo crontab -u root -l; echo '0 0 * * * /opt/copy-data-to-s3.sh' ) | sudo crontab -u root - sudo crontab -l - fi + fi fi -fi \ No newline at end of file +fi diff --git a/lib/ethereum/lib/assets/sync-checker/syncchecker-erigon-prysm.sh b/lib/ethereum/lib/assets/sync-checker/syncchecker-erigon-prysm.sh index 6c8e5196..5450f1c8 100644 --- a/lib/ethereum/lib/assets/sync-checker/syncchecker-erigon-prysm.sh +++ b/lib/ethereum/lib/assets/sync-checker/syncchecker-erigon-prysm.sh @@ -49,7 +49,7 @@ aws cloudwatch put-metric-data --metric-name elc_sync_block --namespace CWAgent aws cloudwatch put-metric-data --metric-name elc_blocks_behind --namespace CWAgent --value $EXECUTION_CLIENT_BLOCKS_BEHIND --timestamp $TIMESTAMP --dimensions InstanceId=$INSTANCE_ID --region $REGION # If the node is a sync node, check if the snapshot is already taken. If the snapshot is not taken, then take it and restart the node. -if [[ "$NODE_ROLE" == "sync-node" ]]; then +if [[ "$NODE_ROLE" == "sync-node" ]]; then if [ ! -f "/data/snapshotted" ]; then if [ "$EXECUTION_CLIENT_SYNC_STATS" == "false" ] && [ "$CONSENSUS_CLIENT_IS_SYNCING" == "false" ] && [ "$CONSENSUS_CLIENT_IS_OPTIMISTIC" == "false" ]; then sudo /opt/copy-data-to-s3.sh @@ -57,6 +57,6 @@ if [[ "$NODE_ROLE" == "sync-node" ]]; then # Take a snapshot once a day at midnight (sudo crontab -u root -l; echo '0 0 * * * /opt/copy-data-to-s3.sh' ) | sudo crontab -u root - sudo crontab -l - fi + fi fi -fi \ No newline at end of file +fi diff --git a/lib/ethereum/lib/assets/sync-checker/syncchecker-geth-lighthouse.sh b/lib/ethereum/lib/assets/sync-checker/syncchecker-geth-lighthouse.sh index b4cc7cba..d85f1bde 100644 --- a/lib/ethereum/lib/assets/sync-checker/syncchecker-geth-lighthouse.sh +++ b/lib/ethereum/lib/assets/sync-checker/syncchecker-geth-lighthouse.sh @@ -52,7 +52,7 @@ aws cloudwatch put-metric-data --metric-name elc_sync_block --namespace CWAgent aws cloudwatch put-metric-data --metric-name elc_blocks_behind --namespace CWAgent --value $EXECUTION_CLIENT_BLOCKS_BEHIND --timestamp $TIMESTAMP --dimensions InstanceId=$INSTANCE_ID --region $REGION # If the node is a sync node, check if the snapshot is already taken. If the snapshot is not taken, then take it and restart the node. -if [[ "$NODE_ROLE" == "sync-node" ]]; then +if [[ "$NODE_ROLE" == "sync-node" ]]; then if [ ! -f "/data/snapshotted" ]; then if [ "$EXECUTION_CLIENT_SYNC_STATS" == "false" ] && [ "$CONSENSUS_CLIENT_IS_SYNCING" == "false" ] && [ "$CONSENSUS_CLIENT_IS_OPTIMISTIC" == "false" ]; then sudo /opt/copy-data-to-s3.sh @@ -60,6 +60,6 @@ if [[ "$NODE_ROLE" == "sync-node" ]]; then # Take a snapshot once a day at midnight (sudo crontab -u root -l; echo '0 0 * * * /opt/copy-data-to-s3.sh' ) | sudo crontab -u root - sudo crontab -l - fi + fi fi -fi \ No newline at end of file +fi diff --git a/lib/ethereum/lib/assets/sync-checker/syncchecker-nethermind-teku.sh b/lib/ethereum/lib/assets/sync-checker/syncchecker-nethermind-teku.sh index 81c6618a..e40f04f1 100644 --- a/lib/ethereum/lib/assets/sync-checker/syncchecker-nethermind-teku.sh +++ b/lib/ethereum/lib/assets/sync-checker/syncchecker-nethermind-teku.sh @@ -49,7 +49,7 @@ aws cloudwatch put-metric-data --metric-name elc_sync_block --namespace CWAgent aws cloudwatch put-metric-data --metric-name elc_blocks_behind --namespace CWAgent --value $EXECUTION_CLIENT_BLOCKS_BEHIND --timestamp $TIMESTAMP --dimensions InstanceId=$INSTANCE_ID --region $REGION # If the node is a sync node, check if the snapshot is already taken. If the snapshot is not taken, then take it and restart the node. -if [[ "$NODE_ROLE" == "sync-node" ]]; then +if [[ "$NODE_ROLE" == "sync-node" ]]; then if [ ! -f "/data/snapshotted" ]; then if [ "$EXECUTION_CLIENT_SYNC_STATS" == "false" ] && [ "$CONSENSUS_CLIENT_IS_SYNCING" == "false" ] && [ "$CONSENSUS_CLIENT_IS_OPTIMISTIC" == "false" ]; then sudo /opt/copy-data-to-s3.sh @@ -57,6 +57,6 @@ if [[ "$NODE_ROLE" == "sync-node" ]]; then # Take a snapshot once a day at midnight (sudo crontab -u root -l; echo '0 0 * * * /opt/copy-data-to-s3.sh' ) | sudo crontab -u root - sudo crontab -l - fi + fi fi -fi \ No newline at end of file +fi diff --git a/lib/ethereum/lib/assets/user-data/node.sh b/lib/ethereum/lib/assets/user-data/node.sh index bcc3f365..6b653371 100644 --- a/lib/ethereum/lib/assets/user-data/node.sh +++ b/lib/ethereum/lib/assets/user-data/node.sh @@ -224,7 +224,7 @@ if $(lsblk | grep -q nvme1n1); then # Write the line to fstab echo $line | sudo tee -a /etc/fstab - + mount -a else @@ -257,4 +257,4 @@ if [ "$NODE_ROLE" == "rpc-node" ]; then echo "/opt/copy-data-from-s3.sh" | at now +3 minutes fi -echo "All Done!!" \ No newline at end of file +echo "All Done!!" diff --git a/lib/ethereum/lib/constructs/eth-node-security-group.ts b/lib/ethereum/lib/constructs/eth-node-security-group.ts index 30299b37..24abbee8 100644 --- a/lib/ethereum/lib/constructs/eth-node-security-group.ts +++ b/lib/ethereum/lib/constructs/eth-node-security-group.ts @@ -15,11 +15,11 @@ export interface EthNodeSecurityGroupConstructProps { constructor(scope: cdkContructs.Construct, id: string, props: EthNodeSecurityGroupConstructProps) { super(scope, id); - const { + const { vpc, clientCombination, } = props; - + const sg = new ec2.SecurityGroup(this, `node-security-group`, { vpc, description: "Security Group for Blockchain nodes", @@ -61,4 +61,4 @@ export interface EthNodeSecurityGroupConstructProps { true ); } - } \ No newline at end of file + } diff --git a/lib/ethereum/lib/sync-node-stack.ts b/lib/ethereum/lib/sync-node-stack.ts index c8f2bf10..667a19ef 100644 --- a/lib/ethereum/lib/sync-node-stack.ts +++ b/lib/ethereum/lib/sync-node-stack.ts @@ -30,10 +30,10 @@ export class EthSyncNodeStack extends cdk.Stack { const chosenAvailabilityZone = availabilityZones.slice(0, 1)[0]; // Getting our config from initialization properties - const { + const { instanceType, - ethClientCombination, - instanceCpuType, + ethClientCombination, + instanceCpuType, dataVolumes, } = props; @@ -104,7 +104,7 @@ export class EthSyncNodeStack extends cdk.Stack { INSTANCE_NAME: STACK_NAME, REGION: REGION, }) - + new cw.CfnDashboard(this, 'sync-cw-dashboard', { dashboardName: STACK_NAME, dashboardBody: dashboardString, diff --git a/lib/ethereum/test/common-stack.test.ts b/lib/ethereum/test/common-stack.test.ts index 06d66534..31f57139 100644 --- a/lib/ethereum/test/common-stack.test.ts +++ b/lib/ethereum/test/common-stack.test.ts @@ -98,4 +98,4 @@ describe("EthCommonStack", () => { }) }); -}); \ No newline at end of file +}); diff --git a/lib/ethereum/test/rpc-nodes-stack.test.ts b/lib/ethereum/test/rpc-nodes-stack.test.ts index 6ee47007..05555a85 100644 --- a/lib/ethereum/test/rpc-nodes-stack.test.ts +++ b/lib/ethereum/test/rpc-nodes-stack.test.ts @@ -283,4 +283,4 @@ describe("EthRpcNodesStack", () => { VpcId: Match.anyValue(), }) }); -}); \ No newline at end of file +}); diff --git a/lib/ethereum/test/sync-node-stack.test.ts b/lib/ethereum/test/sync-node-stack.test.ts index 96be1ada..ffdb310e 100644 --- a/lib/ethereum/test/sync-node-stack.test.ts +++ b/lib/ethereum/test/sync-node-stack.test.ts @@ -12,7 +12,7 @@ describe("EthSyncNodeStack", () => { // Create the EthSyncNodeStack. const ethSyncNodeStack = new EthSyncNodeStack(app, "eth-sync-node", { stackName: `eth-sync-node-${config.baseConfig.clientCombination}`, - + env: { account: config.baseConfig.accountId, region: config.baseConfig.region }, ethClientCombination: config.baseConfig.clientCombination, instanceType: config.syncNodeConfig.instanceType, @@ -158,4 +158,4 @@ describe("EthSyncNodeStack", () => { }) }); -}); \ No newline at end of file +}); diff --git a/lib/solana/README.md b/lib/solana/README.md index 1b41c651..014e89e8 100644 --- a/lib/solana/README.md +++ b/lib/solana/README.md @@ -30,7 +30,7 @@ Solana nodes on AWS can be deployed in 3 different configurations: Consensus, ba During the startup, if a node can't find the necessary identity file on the attached Root EBS volume, it generates a new one and stores it in AWS Secrets Manager. For a single-node deployment, the ARN of a secret can be provided within the `.env` configuration file with configuration and the node will pick it up. -Base RPC and Extended RPC nodes use only 1 secret: +Base RPC and Extended RPC nodes use only 1 secret: - **Solana Node Identity Secret**: The identity key pair for a Solana node. @@ -160,7 +160,7 @@ Create your own copy of `.env` file and edit it to update with your AWS Account ```bash export RPC_ABL_URL=$(cat ha-nodes-deploy.json | jq -r '..|.ALBURL? | select(. != null)') echo $RPC_ABL_URL - + # We query token balance this account: https://solanabeach.io/address/9WzDXwBbmkg8ZTbNMqUxvQRAyrZzDsGYdLVL9zYtAWWM curl http://$RPC_ABL_URL:8899 -X POST -H "Content-Type: application/json" \ --data '{ "jsonrpc": "2.0", "id": 1, "method": "getBalance", "params": ["9WzDXwBbmkg8ZTbNMqUxvQRAyrZzDsGYdLVL9zYtAWWM"]}' @@ -182,7 +182,7 @@ The result should be like this (the actual balance might change): ``` -**NOTE:** By default and for security reasons the load balancer is available only from within the default VPC in the region where it is deployed. It is not available from the Internet and is not open for external connections. Before opening it up please make sure you protect your RPC APIs. +**NOTE:** By default and for security reasons the load balancer is available only from within the default VPC in the region where it is deployed. It is not available from the Internet and is not open for external connections. Before opening it up please make sure you protect your RPC APIs. ### Clearing up and undeploy everything @@ -192,10 +192,10 @@ The result should be like this (the actual balance might change): # Setting the AWS account id and region in case local .env file is lost export AWS_ACCOUNT_ID= export AWS_REGION= - + pwd # Make sure you are in aws-blockchain-node-runners/lib/solana - + # Undeploy HA Nodes cdk destroy solana-ha-nodes @@ -259,4 +259,4 @@ The result should be like this (the actual balance might change): ## Upgrades -When nodes need to be upgraded or downgraded, [use blue/green pattern to do it](https://aws.amazon.com/blogs/devops/performing-bluegreen-deployments-with-aws-codedeploy-and-auto-scaling-groups/). This is not yet automated and contributions are welcome! \ No newline at end of file +When nodes need to be upgraded or downgraded, [use blue/green pattern to do it](https://aws.amazon.com/blogs/devops/performing-bluegreen-deployments-with-aws-codedeploy-and-auto-scaling-groups/). This is not yet automated and contributions are welcome! diff --git a/lib/solana/cdk.json b/lib/solana/cdk.json index 1994f2d7..d374005c 100644 --- a/lib/solana/cdk.json +++ b/lib/solana/cdk.json @@ -41,4 +41,4 @@ "@aws-cdk/aws-route53-patters:useCertificate": true, "@aws-cdk/customresources:installLatestAwsSdkDefault": false } -} \ No newline at end of file +} diff --git a/lib/solana/doc/assets/Recommended_infra.md b/lib/solana/doc/assets/Recommended_infra.md index 8ad9a093..123f40ac 100644 --- a/lib/solana/doc/assets/Recommended_infra.md +++ b/lib/solana/doc/assets/Recommended_infra.md @@ -4,4 +4,4 @@ |---|---|---|---|---| | 1/ Consensus node | 32 vCPU, 256 GB RAM, Accounts volume: 1TB, 5K IOPS, 700 MB/s throughput, Data volume: 3TB, 10K IOPS, 700 MB/s throughput | r6a.8xlarge, Accounts volume: EBS gp3 1TB, 5K IOPS, 700 MB/s throughput, Data volume: EBS gp3 10K IOPS, 700 MB/s throughput | Proportional to the amount at stake. Between 200TB to 400TB/month | [.env-sample-consensus](../../sample-configs/.env-sample-consensus) | | 2/ Base RPC node (no secondary indexes) | 32 vCPU, 256 GB RAM, Accounts volume: 1TB, 5K IOPS, 700 MB/s throughput, Data volume: 3TB, 12K IOPS, 700 MB/s throughput | r6a.8xlarge, Accounts volume: EBS gp3 1TB, 5K IOPS, 700 MB/s throughput Data volume: EBS gp3 12K IOPS, 700 MB/s throughput | 150-200TB/month (no staking) | [.env-sample-baserpc](../../sample-configs/.env-sample-baserpc) | -| 3/ Extended RPC node (with all secondary indexes) | 64 vCPU, 1 TB RAM, Accounts volume: 1TB, 7K IOPS, 700 MB/s throughput, Data volume: 3TB, 16K IOPS, 700 MB/s throughput | x2idn.16xlarge, Accounts: instance storage (ephemeral NVMe volumes) 1.9 TB, Data volume: 3TB, 12K IOPS, 700 MB/s throughput | 150-200TB/month (no staking) | [.env-sample-extendedrpc](../../sample-configs/.env-sample-extendedrpc) | \ No newline at end of file +| 3/ Extended RPC node (with all secondary indexes) | 64 vCPU, 1 TB RAM, Accounts volume: 1TB, 7K IOPS, 700 MB/s throughput, Data volume: 3TB, 16K IOPS, 700 MB/s throughput | x2idn.16xlarge, Accounts: instance storage (ephemeral NVMe volumes) 1.9 TB, Data volume: 3TB, 12K IOPS, 700 MB/s throughput | 150-200TB/month (no staking) | [.env-sample-extendedrpc](../../sample-configs/.env-sample-extendedrpc) | diff --git a/lib/solana/doc/assets/Solana_on_AWS.md b/lib/solana/doc/assets/Solana_on_AWS.md index 85182368..19877ca1 100644 --- a/lib/solana/doc/assets/Solana_on_AWS.md +++ b/lib/solana/doc/assets/Solana_on_AWS.md @@ -12,7 +12,7 @@ Consensus nodes on both Mainnet Beta and testnets [support proof-of-stake consen - Root volume: EBS gp3 500 GB, 3K IOPS, 250 MB/s throughput, - Accounts volume: EBS gp3 500GB, 5K IOPS, 700 MB/s throughput, - Data volume: EBS gp3 2TB, 10K IOPS, 700 MB/s throughput. - + To set up new validator node, you first need to generate cryptographic keys that will be used in the process. After the keys are generated with the standard `solana-keygen` tool on the EC2 instance you can keep a backup copy of the key pair in [AWS Secrets Manager](https://docs.aws.amazon.com/secretsmanager/latest/userguide/intro.html). Based on amount you have at stake, you can estimate with [community-developed calculators](https://www.stakingrewards.com/asset/solana) the amount of profit your validator node can generate and then calculate the cost of the configuration with [AWS calculator](https://calculator.aws/#/). Also note that, depending on the amount at stake, your validator node will generate between 150 TB to 300 TB of data transfer out to the Internet per month, so talk to your AWS account manager about potential cost optimization. @@ -29,22 +29,22 @@ Base RPC nodes (or just "RPC nodes") can be used by your application to perform Data transfer costs for this node can vary depending on whether you expose the RPC endpoints to the Internet (generates more traffic to the Internet) or consume it with the same AWS Availability Zone (will cost you nothing). If you are not exposing the RPC interface for external consumption, then your node will generate about 13-15 TB of outgoing data per month per node. It is less than Consensus nodes, but can still be sufficient and better be discussed with your AWS account manager. - To run RPC node on AWS, use the [Solana Node Runner CDK application](https://github.com/aws-samples/aws-blockchain-node-runners/tree/solana/lib/solana) in [AWS Blockchain Node Runners](https://aws-samples.github.io/aws-blockchain-node-runners/) and use [sample config for RPC node](https://github.com/aws-samples/aws-blockchain-node-runners/blob/solana/lib/solana/sample-configs/.env-sample-baserpc). You can use both Single-node and Highly Available-node setup. - + ### Extended RPC nodes with secondary indexes - + RPC nodes with secondary indexes allow you to call "extended" RPC functions like mentioned above. To use them you need to enable extra indexes on your RPC node, which requires more hardware. At the time of writing (September 2023) it is recommended to use at least 1 TB or RAM with NVMe discs, or, on AWS an instance like `x2idn.16xlarge` which is also equipped with a physically-attached NVMe SSD [Instance Store volume](https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/InstanceStorage.html). The storage configurations looks like this: - Root volume: EBS gp3 500 GB, 3K IOPS, 250 MB/s throughput, - Accounts volume: Instance store (comes with the `x2idn.16xlarge` instance) 1.9TB, - Data volume: EBS gp3 2TB, 10K IOPS, 700 MB/s throughput. - + As with the RPC nodes, data transfer amount may vary and the estimated amount is 15 TB of outgoing data per month per node. - To run RPC node with secondary indexes on AWS, use the [Solana Node Runner CDK application](https://github.com/aws-samples/aws-blockchain-node-runners/tree/solana/lib/solana) in [AWS Blockchain Node Runners](https://aws-samples.github.io/aws-blockchain-node-runners/) and use [sample config for RPC with secondary indexes node](https://github.com/aws-samples/aws-blockchain-node-runners/blob/solana/lib/solana/sample-configs/.env-sample-extendedrpc). You can use both Single-node and Highly Available-node setup. - + ### History nodes - + History nodes are not yet available on AWS because or dependency on the GCP's BigTable. But there is some awesome work that Solana community is doing to make this data available in cloud-agnostic way, so stay tuned. ## Cost Optimization -To optimize the cost you can use either [Compute Savings Plan for EC2](https://aws.amazon.com/savingsplans/compute-pricing/) or talk to one of the AWS partners like [Antimetal](https://www.antimetal.com/) or [Zesty](https://zesty.co/). We don’t recommend using Spot instances for Solana nodes because they can be terminated with a short notice and a similar instance might not be immediately available for you even with on-demand pricing. \ No newline at end of file +To optimize the cost you can use either [Compute Savings Plan for EC2](https://aws.amazon.com/savingsplans/compute-pricing/) or talk to one of the AWS partners like [Antimetal](https://www.antimetal.com/) or [Zesty](https://zesty.co/). We don’t recommend using Spot instances for Solana nodes because they can be terminated with a short notice and a similar instance might not be immediately available for you even with on-demand pricing. diff --git a/lib/solana/doc/assets/Well_Architected.md b/lib/solana/doc/assets/Well_Architected.md index 74a39ecd..048f0d7e 100644 --- a/lib/solana/doc/assets/Well_Architected.md +++ b/lib/solana/doc/assets/Well_Architected.md @@ -23,4 +23,4 @@ This is the Well-Architected checklist for Solana nodes implementation of the AW | | Storage selection | How is storage solution selected? | Storage solution is selected based on best price-performance, i.e. gp3 Amazon EBS volumes with optimal IOPS and throughput. | | | Architecture selection | How is the best performance architecture selected? | We used a combination of recommendations from the Solana community and our own testing. | | Operational excellence | Workload health | How is health of workload determined? | Health of workload is determined via AWS Application Load Balancer Target Group Health Checks, on port 8899. | -| Sustainability | Hardware & services | Select most efficient hardware for your workload | The solution uses AMD-powered instances. There is a potential to use AWS Graviton-based Amazon EC2 instances which offer the best performance per watt of energy use in Amazon EC2. | \ No newline at end of file +| Sustainability | Hardware & services | Select most efficient hardware for your workload | The solution uses AMD-powered instances. There is a potential to use AWS Graviton-based Amazon EC2 instances which offer the best performance per watt of energy use in Amazon EC2. | diff --git a/lib/solana/lib/assets/build-binaries.sh b/lib/solana/lib/assets/build-binaries.sh index c0f07a15..61d26237 100644 --- a/lib/solana/lib/assets/build-binaries.sh +++ b/lib/solana/lib/assets/build-binaries.sh @@ -32,4 +32,4 @@ echo "Check solana-validator version" echo "Modifying path" echo export PATH=$PWD/bin:$PATH >> /home/ssm-user/.profile -source /home/ssm-user/.profile \ No newline at end of file +source /home/ssm-user/.profile diff --git a/lib/solana/lib/assets/cfn-hup/cfn-auto-reloader.conf b/lib/solana/lib/assets/cfn-hup/cfn-auto-reloader.conf index 35bb46f8..3cd32a0a 100644 --- a/lib/solana/lib/assets/cfn-hup/cfn-auto-reloader.conf +++ b/lib/solana/lib/assets/cfn-hup/cfn-auto-reloader.conf @@ -1,4 +1,4 @@ [cfn-auto-reloader-hook] triggers=post.update path=Resources.WebServerHost.Metadata.AWS::CloudFormation::Init -action=/opt/aws/bin/cfn-init -v --stack __AWS_STACK_NAME__ --resource WebServerHost --region __AWS_REGION__ \ No newline at end of file +action=/opt/aws/bin/cfn-init -v --stack __AWS_STACK_NAME__ --resource WebServerHost --region __AWS_REGION__ diff --git a/lib/solana/lib/assets/cfn-hup/cfn-hup.conf b/lib/solana/lib/assets/cfn-hup/cfn-hup.conf index 4504c8c5..2163b37a 100644 --- a/lib/solana/lib/assets/cfn-hup/cfn-hup.conf +++ b/lib/solana/lib/assets/cfn-hup/cfn-hup.conf @@ -2,4 +2,4 @@ stack=__AWS_STACK_ID__ region=__AWS_REGION__ # The interval used to check for changes to the resource metadata in minutes. Default is 15 -interval=2 \ No newline at end of file +interval=2 diff --git a/lib/solana/lib/assets/cfn-hup/cfn-hup.service b/lib/solana/lib/assets/cfn-hup/cfn-hup.service index 992ceb69..2660ea46 100644 --- a/lib/solana/lib/assets/cfn-hup/cfn-hup.service +++ b/lib/solana/lib/assets/cfn-hup/cfn-hup.service @@ -5,4 +5,4 @@ Type=simple ExecStart=/usr/local/bin/cfn-hup Restart=always [Install] -WantedBy=multi-user.target \ No newline at end of file +WantedBy=multi-user.target diff --git a/lib/solana/lib/assets/cw-agent.json b/lib/solana/lib/assets/cw-agent.json index b0d696f3..28833017 100644 --- a/lib/solana/lib/assets/cw-agent.json +++ b/lib/solana/lib/assets/cw-agent.json @@ -73,4 +73,4 @@ } } } -} \ No newline at end of file +} diff --git a/lib/solana/lib/assets/node-cw-dashboard.ts b/lib/solana/lib/assets/node-cw-dashboard.ts index 1f0e679e..5eb421aa 100644 --- a/lib/solana/lib/assets/node-cw-dashboard.ts +++ b/lib/solana/lib/assets/node-cw-dashboard.ts @@ -285,4 +285,4 @@ export const SingleNodeCWDashboardJSON = { } } ] -} \ No newline at end of file +} diff --git a/lib/solana/lib/assets/setup-instance-store-volumes.sh b/lib/solana/lib/assets/setup-instance-store-volumes.sh index 108708a1..2ed0f85d 100644 --- a/lib/solana/lib/assets/setup-instance-store-volumes.sh +++ b/lib/solana/lib/assets/setup-instance-store-volumes.sh @@ -75,4 +75,4 @@ if [ -n "$ACCOUNTS_VOLUME_ID" ]; then else echo "Accounts volume is mounted, nothing changed" fi -fi \ No newline at end of file +fi diff --git a/lib/solana/lib/assets/solana/node-consensus-template.sh b/lib/solana/lib/assets/solana/node-consensus-template.sh index 903b2994..0d6f7748 100644 --- a/lib/solana/lib/assets/solana/node-consensus-template.sh +++ b/lib/solana/lib/assets/solana/node-consensus-template.sh @@ -23,4 +23,4 @@ __ENTRY_POINTS__ \ --no-os-cpu-stats-reporting \ --no-os-memory-stats-reporting \ --no-os-network-stats-reporting \ ---log - \ No newline at end of file +--log - diff --git a/lib/solana/lib/assets/solana/node-heavy-rpc-template.sh b/lib/solana/lib/assets/solana/node-heavy-rpc-template.sh index a38f8630..751c246e 100644 --- a/lib/solana/lib/assets/solana/node-heavy-rpc-template.sh +++ b/lib/solana/lib/assets/solana/node-heavy-rpc-template.sh @@ -38,4 +38,4 @@ __ENTRY_POINTS__ \ --account-index spl-token-mint \ --account-index-exclude-key kinXdEcpDQeHPEuQnqmUgtYykqKGVFq6CeVX5iAHJq6 \ --account-index-exclude-key TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA \ ---log - \ No newline at end of file +--log - diff --git a/lib/solana/lib/assets/solana/node-light-rpc-template.sh b/lib/solana/lib/assets/solana/node-light-rpc-template.sh index c5c1b96c..32f09e4c 100644 --- a/lib/solana/lib/assets/solana/node-light-rpc-template.sh +++ b/lib/solana/lib/assets/solana/node-light-rpc-template.sh @@ -33,4 +33,4 @@ __ENTRY_POINTS__ \ --no-os-cpu-stats-reporting \ --no-os-memory-stats-reporting \ --no-os-network-stats-reporting \ ---log - \ No newline at end of file +--log - diff --git a/lib/solana/lib/assets/sync-checker/syncchecker-solana.sh b/lib/solana/lib/assets/sync-checker/syncchecker-solana.sh index 98748ca9..365626d8 100644 --- a/lib/solana/lib/assets/sync-checker/syncchecker-solana.sh +++ b/lib/solana/lib/assets/sync-checker/syncchecker-solana.sh @@ -29,4 +29,4 @@ if [ -f "$INIT_COMPLETED_FILE" ]; then aws cloudwatch put-metric-data --metric-name solana_slots_behind --namespace CWAgent --value $SOLANA_SLOTS_BEHIND --timestamp $TIMESTAMP --dimensions InstanceId=$INSTANCE_ID --region $REGION else aws cloudwatch put-metric-data --metric-name solana_block_height --namespace CWAgent --value 0 --timestamp $TIMESTAMP --dimensions InstanceId=$INSTANCE_ID --region $REGION -fi \ No newline at end of file +fi diff --git a/lib/solana/lib/assets/user-data/node.sh b/lib/solana/lib/assets/user-data/node.sh index 56214601..f5d11268 100644 --- a/lib/solana/lib/assets/user-data/node.sh +++ b/lib/solana/lib/assets/user-data/node.sh @@ -264,7 +264,7 @@ if [[ "$SOLANA_NODE_TYPE" == "consensus" ]]; then sudo mv ~/id.json /root/.config/solana/id.json echo "Creating Vote Account on-chain" sudo ./solana create-vote-account /home/solana/config/vote-account-keypair.json /home/solana/config/validator-keypair.json /home/solana/config/authorized-withdrawer-keypair.json - + echo "Deleting Transaction Funding Account Secret from the local disc" sudo rm /root/.config/solana/id.json else @@ -353,4 +353,4 @@ if [[ "$LIFECYCLE_HOOK_NAME" != "none" ]]; then aws autoscaling complete-lifecycle-action --lifecycle-action-result CONTINUE --instance-id $INSTANCE_ID --lifecycle-hook-name "$LIFECYCLE_HOOK_NAME" --auto-scaling-group-name "$ASG_NAME" --region $AWS_REGION fi -echo "All Done!!" \ No newline at end of file +echo "All Done!!" diff --git a/lib/solana/lib/common-stack.ts b/lib/solana/lib/common-stack.ts index 56ca3373..1a307466 100644 --- a/lib/solana/lib/common-stack.ts +++ b/lib/solana/lib/common-stack.ts @@ -30,7 +30,7 @@ export class SolanaCommonStack extends cdk.Stack { resources: ["*"], actions: ["cloudformation:SignalResource"], })); - + instanceRole.addToPolicy(new iam.PolicyStatement({ resources: [`arn:aws:autoscaling:${region}:${this.AWS_ACCOUNT_ID}:autoScalingGroup:*:autoScalingGroupName/solana-*`], actions: ["autoscaling:CompleteLifecycleAction"], diff --git a/lib/solana/lib/config/solanaConfig.ts b/lib/solana/lib/config/solanaConfig.ts index 5d473c7c..37052e1c 100644 --- a/lib/solana/lib/config/solanaConfig.ts +++ b/lib/solana/lib/config/solanaConfig.ts @@ -19,15 +19,15 @@ const parseDataVolumeType = (dataVolumeType: string) => { } export const baseConfig: configTypes.SolanaBaseConfig = { - accountId: process.env.AWS_ACCOUNT_ID || "xxxxxxxxxxx", - region: process.env.AWS_REGION || "us-east-2", + accountId: process.env.AWS_ACCOUNT_ID || "xxxxxxxxxxx", + region: process.env.AWS_REGION || "us-east-2", } export const baseNodeConfig: configTypes.SolanaBaseNodeConfig = { instanceType: new ec2.InstanceType(process.env.SOLANA_INSTANCE_TYPE ? process.env.SOLANA_INSTANCE_TYPE : "r6a.8xlarge"), instanceCpuType: process.env.SOLANA_CPU_TYPE?.toLowerCase() == "x86_64" ? ec2.AmazonLinuxCpuType.X86_64 : ec2.AmazonLinuxCpuType.ARM_64, - solanaCluster: process.env.SOLANA_CLUSTER || "mainnet-beta", - solanaVersion: process.env.SOLANA_VERSION || "1.16.15", + solanaCluster: process.env.SOLANA_CLUSTER || "mainnet-beta", + solanaVersion: process.env.SOLANA_VERSION || "1.16.15", nodeConfiguration: process.env.SOLANA_NODE_CONFIGURATION || "baserpc", dataVolume: { sizeGiB: process.env.SOLANA_DATA_VOL_SIZE ? parseInt(process.env.SOLANA_DATA_VOL_SIZE): 2000, diff --git a/lib/solana/lib/constructs/solana-node-security-group.ts b/lib/solana/lib/constructs/solana-node-security-group.ts index 09c8fa02..1bddf5b5 100644 --- a/lib/solana/lib/constructs/solana-node-security-group.ts +++ b/lib/solana/lib/constructs/solana-node-security-group.ts @@ -13,10 +13,10 @@ export interface SolanaNodeSecurityGroupConstructProps { constructor(scope: cdkContructs.Construct, id: string, props: SolanaNodeSecurityGroupConstructProps) { super(scope, id); - const { + const { vpc, } = props; - + const sg = new ec2.SecurityGroup(this, `rpc-node-security-group`, { vpc, description: "Security Group for Blockchain nodes", @@ -48,4 +48,4 @@ export interface SolanaNodeSecurityGroupConstructProps { true ); } - } \ No newline at end of file + } diff --git a/lib/solana/lib/ha-nodes-stack.ts b/lib/solana/lib/ha-nodes-stack.ts index 265bcd17..ccecf8f6 100644 --- a/lib/solana/lib/ha-nodes-stack.ts +++ b/lib/solana/lib/ha-nodes-stack.ts @@ -78,7 +78,7 @@ export class SolanaHANodesStack extends cdk.Stack { if (nodeConfiguration === "consensus") { throw new Error("Consensus node configuration is not yet supported for HA setup"); } - + // Use Ubuntu 20.04 LTS image for amd64. Find more: https://discourse.ubuntu.com/t/finding-ubuntu-images-with-the-aws-ssm-parameter-store/15507 const ubuntu204stableImageSsmName = "/aws/service/canonical/ubuntu/server/20.04/stable/current/amd64/hvm/ebs-gp2/ami-id" diff --git a/lib/solana/lib/single-node-stack.ts b/lib/solana/lib/single-node-stack.ts index e7685c8b..bb6634a2 100644 --- a/lib/solana/lib/single-node-stack.ts +++ b/lib/solana/lib/single-node-stack.ts @@ -130,7 +130,7 @@ export class SolanaSingleNodeStack extends cdk.Stack { INSTANCE_NAME: STACK_NAME, REGION: REGION, }) - + new cw.CfnDashboard(this, 'solana-cw-dashboard', { dashboardName: STACK_NAME, dashboardBody: dashboardString, diff --git a/lib/solana/sample-configs/.env-sample-baserpc b/lib/solana/sample-configs/.env-sample-baserpc index 42859907..01aeff51 100644 --- a/lib/solana/sample-configs/.env-sample-baserpc +++ b/lib/solana/sample-configs/.env-sample-baserpc @@ -33,4 +33,3 @@ SOLANA_REGISTRATION_TRANSACTION_FUNDING_ACCOUNT_SECRET_ARN="none" # Required for SOLANA_HA_NUMBER_OF_NODES="2" # Total number of RPC nodes to be provisioned. Default: 2 SOLANA_HA_ALB_HEALTHCHECK_GRACE_PERIOD_MIN="60" # Time enough to initialize the instance SOLANA_HA_NODES_HEARTBEAT_DELAY_MIN="10" # Time sufficient enough for a node do sync - diff --git a/lib/solana/sample-configs/.env-sample-consensus b/lib/solana/sample-configs/.env-sample-consensus index da9ff3d0..400b82d7 100644 --- a/lib/solana/sample-configs/.env-sample-consensus +++ b/lib/solana/sample-configs/.env-sample-consensus @@ -33,4 +33,3 @@ SOLANA_REGISTRATION_TRANSACTION_FUNDING_ACCOUNT_SECRET_ARN="none" # Required for SOLANA_HA_NUMBER_OF_NODES="2" # Total number of RPC nodes to be provisioned. Default: 2 SOLANA_HA_ALB_HEALTHCHECK_GRACE_PERIOD_MIN="60" # Time enough to initialize the instance SOLANA_HA_NODES_HEARTBEAT_DELAY_MIN="10" # Time sufficient enough for a node do sync - diff --git a/lib/solana/sample-configs/.env-sample-extendedrpc b/lib/solana/sample-configs/.env-sample-extendedrpc index 5733db4b..b7647d73 100644 --- a/lib/solana/sample-configs/.env-sample-extendedrpc +++ b/lib/solana/sample-configs/.env-sample-extendedrpc @@ -32,4 +32,4 @@ SOLANA_REGISTRATION_TRANSACTION_FUNDING_ACCOUNT_SECRET_ARN="none" # Required for ## HA nodes configuration ## SOLANA_HA_NUMBER_OF_NODES="2" # Total number of RPC nodes to be provisioned. Default: 2 SOLANA_HA_ALB_HEALTHCHECK_GRACE_PERIOD_MIN="70" # Time enough to initialize the instance -SOLANA_HA_NODES_HEARTBEAT_DELAY_MIN="10" # Time sufficient enough for a node do sync \ No newline at end of file +SOLANA_HA_NODES_HEARTBEAT_DELAY_MIN="10" # Time sufficient enough for a node do sync diff --git a/lib/solana/test/.env-test b/lib/solana/test/.env-test index 96c0677c..26c19665 100644 --- a/lib/solana/test/.env-test +++ b/lib/solana/test/.env-test @@ -33,4 +33,3 @@ SOLANA_REGISTRATION_TRANSACTION_FUNDING_ACCOUNT_SECRET_ARN="none" # Required for SOLANA_HA_NUMBER_OF_NODES="2" # Total number of RPC nodes to be provisioned. Default: 2 SOLANA_HA_ALB_HEALTHCHECK_GRACE_PERIOD_MIN="60" # Time enough to initialize the instance SOLANA_HA_NODES_HEARTBEAT_DELAY_MIN="10" # Time sufficient enough for a node do sync - diff --git a/lib/solana/test/common-stack.test.ts b/lib/solana/test/common-stack.test.ts index b20f4459..36b52f75 100644 --- a/lib/solana/test/common-stack.test.ts +++ b/lib/solana/test/common-stack.test.ts @@ -72,4 +72,4 @@ describe("SolanaCommonStack", () => { }) }); -}); \ No newline at end of file +}); diff --git a/lib/solana/test/ha-nodes-stack.test.ts b/lib/solana/test/ha-nodes-stack.test.ts index c835a5f5..83811745 100644 --- a/lib/solana/test/ha-nodes-stack.test.ts +++ b/lib/solana/test/ha-nodes-stack.test.ts @@ -257,4 +257,4 @@ describe("SolanaHANodesStack", () => { VpcId: Match.anyValue(), }) }); -}); \ No newline at end of file +}); diff --git a/lib/solana/test/single-node-stack.test.ts b/lib/solana/test/single-node-stack.test.ts index 89fd9663..bffb0e17 100644 --- a/lib/solana/test/single-node-stack.test.ts +++ b/lib/solana/test/single-node-stack.test.ts @@ -13,7 +13,7 @@ describe("SolanaSingleNodeStack", () => { const solanaSingleNodeStack = new SolanaSingleNodeStack(app, "solana-sync-node", { stackName: `solana-single-node-${config.baseNodeConfig.nodeConfiguration}`, env: { account: config.baseConfig.accountId, region: config.baseConfig.region }, - + instanceType: config.baseNodeConfig.instanceType, instanceCpuType: config.baseNodeConfig.instanceCpuType, solanaCluster: config.baseNodeConfig.solanaCluster, @@ -126,7 +126,7 @@ describe("SolanaSingleNodeStack", () => { Throughput: 700, VolumeType: "gp3" }) - + // Has EBS accounts volume attachment. template.hasResourceProperties("AWS::EC2::VolumeAttachment", { Device: "/dev/sdg", @@ -141,4 +141,4 @@ describe("SolanaSingleNodeStack", () => { }) }); -}); \ No newline at end of file +}); diff --git a/package-lock.json b/package-lock.json index ca29cbc5..22a0cc46 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,11 +1,11 @@ { - "name": "eth-initial-sync-cdk", + "name": "aws-blockchain-node-runners", "version": "0.1.0", "lockfileVersion": 3, "requires": true, "packages": { "": { - "name": "eth-initial-sync-cdk", + "name": "aws-blockchain-node-runners", "version": "0.1.0", "dependencies": { "aws-cdk-lib": "^2.84.0", diff --git a/package.json b/package.json index 88820c00..9a2d62f0 100644 --- a/package.json +++ b/package.json @@ -6,8 +6,10 @@ "setup-git-secrets": "git secrets --install & git secrets --register-aws", "scan-history-git-secrets": "git secrets --scan-history", "scan-repo-git-secrets": "git secrets --scan", - "install-semgrep": "brew install semgrep", - "scan-semgrep": "semgrep scan --config auto" + "install-semgrep-mac": "brew install semgrep", + "scan-semgrep": "semgrep scan --config auto", + "install-pre-commit-mac": "brew install pre-commit", + "run-pre-commit": "pre-commit run --all-files" }, "devDependencies": { "@types/jest": "^29.5.0", diff --git a/website/README.md b/website/README.md index aaba2fa1..e6f9731a 100644 --- a/website/README.md +++ b/website/README.md @@ -26,14 +26,6 @@ This command generates static content into the `build` directory and can be serv ### Deployment -Using SSH: - -``` -$ USE_SSH=true yarn deploy -``` - -Not using SSH: - ``` $ GIT_USER= yarn deploy ``` diff --git a/website/docs/Blueprints/Ethereum.md b/website/docs/Blueprints/Ethereum.md index 7fa52c1e..b944033b 100644 --- a/website/docs/Blueprints/Ethereum.md +++ b/website/docs/Blueprints/Ethereum.md @@ -2,8 +2,8 @@ sidebar_position: 2 sidebar_label: Ethereum --- -# +# import Readme from '../../../lib/ethereum/README.md'; - \ No newline at end of file + diff --git a/website/docs/Blueprints/Solana.md b/website/docs/Blueprints/Solana.md index 3029a84e..24f958a9 100644 --- a/website/docs/Blueprints/Solana.md +++ b/website/docs/Blueprints/Solana.md @@ -2,8 +2,8 @@ sidebar_position: 3 sidebar_label: Solana --- -# +# import Readme from '../../../lib/solana/README.md'; - \ No newline at end of file + diff --git a/website/docs/Blueprints/intro.md b/website/docs/Blueprints/intro.md index 0b38470b..d69fe01a 100644 --- a/website/docs/Blueprints/intro.md +++ b/website/docs/Blueprints/intro.md @@ -5,7 +5,6 @@ sidebar_label: About blueprints # About blueprints -Blueprints are TypeScrypt application built with [AWS Cloud Development Kit](https://aws.amazon.com/cdk/). They are infrastructure as code apps that you can use to deploy blockchain nodes in different configurations be it solo nodes or highly available setups. Most of the apps will look into `.env` file in its root directory for input params to know which compute, storage and node setup options to use during deployment. +Blueprints are TypeScrypt application built with [AWS Cloud Development Kit](https://aws.amazon.com/cdk/). They are infrastructure as code apps that you can use to deploy blockchain nodes in different configurations be it solo nodes or highly available setups. Most of the apps will look into `.env` file in its root directory for input params to know which compute, storage and node setup options to use during deployment. 👈 Use navigation bar on the left for setting up nodes for different protocols. - diff --git a/website/docs/intro/intro.md b/website/docs/intro/intro.md index 7acca57c..7a303d23 100644 --- a/website/docs/intro/intro.md +++ b/website/docs/intro/intro.md @@ -15,4 +15,4 @@ We welcome contributions from both enthusiasts like us or established blockchain ## Code of Conduct This project has adopted the [Amazon Open Source Code of Conduct](https://aws.github.io/code-of-conduct). For more information see the [Code of Conduct FAQ](https://aws.github.io/code-of-conduct-faq) or contact -opensource-codeofconduct@amazon.com with any additional questions or comments. \ No newline at end of file +opensource-codeofconduct@amazon.com with any additional questions or comments. diff --git a/website/docs/intro/setup-cloud9.md b/website/docs/intro/setup-cloud9.md index 15cf990b..0b7925b7 100644 --- a/website/docs/intro/setup-cloud9.md +++ b/website/docs/intro/setup-cloud9.md @@ -3,8 +3,8 @@ sidebar_position: 1 sidebar_label: SetupCloud9 slug: /setup-cloud9.md --- -# +# import Readme from '../../../docs/setup-cloud9.md'; - \ No newline at end of file + diff --git a/website/docusaurus.config.js b/website/docusaurus.config.js index 708906c2..aab0bfa8 100644 --- a/website/docusaurus.config.js +++ b/website/docusaurus.config.js @@ -86,7 +86,7 @@ const config = { items: [ { label: 'Docs', - to: '/docs/intro/intro', + to: '/docs/intro', }, ], }, @@ -96,6 +96,10 @@ const config = { { label: 'Github', href: 'https://github.com/aws-samples/aws-blockchain-node-runners', + }, + { + label: 'Contribution guide', + href: 'https://github.com/aws-samples/aws-blockchain-node-runners/blob/main/CONTRIBUTING.md', } ], }, diff --git a/website/src/components/HomepageFeatures/index.js b/website/src/components/HomepageFeatures/index.js index 47e9fe6c..dece511b 100644 --- a/website/src/components/HomepageFeatures/index.js +++ b/website/src/components/HomepageFeatures/index.js @@ -59,4 +59,4 @@ export default function HomepageFeatures() { ); -} \ No newline at end of file +} diff --git a/website/src/components/HomepageFeatures/styles.module.css b/website/src/components/HomepageFeatures/styles.module.css index 335197bb..846d3549 100644 --- a/website/src/components/HomepageFeatures/styles.module.css +++ b/website/src/components/HomepageFeatures/styles.module.css @@ -5,7 +5,7 @@ width: 100%; /*background: whitesmoke;*/ } - + .featureSvg { color: var(--ifm-color-primary); height: 250px; @@ -17,11 +17,11 @@ color: var(--ifm-color-primary); font-size: 3em; } - + .featureSvg:hover { transform: scale(1.5); /* Zoom in slightly on hover */ } - + /* Adding animation to feature items */ @keyframes fadeInUp { from { @@ -33,13 +33,13 @@ transform: translateY(0); } } - + /* Apply animation to each feature item */ .row .col { animation: fadeInUp 0.5s ease forwards; animation-delay: 0.3s; } - + .heading { font-weight: bold; - } \ No newline at end of file + } diff --git a/website/static/img/logo.svg b/website/static/img/logo.svg index 9db6d0d0..ad9d11a4 100644 --- a/website/static/img/logo.svg +++ b/website/static/img/logo.svg @@ -1 +1 @@ - \ No newline at end of file +