Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion lib/constructs/ha-rpc-nodes-with-alb.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ export interface HANodesConstructCustomProps {
rpcPortForALB: number,
albHealthCheckGracePeriodMin: number;
healthCheckPath? : string;
healthCheckPort?: number;
heartBeatDelayMin: number;
lifecycleHookName: string;
autoScalingGroupName: string;
Expand All @@ -48,6 +49,7 @@ export class HANodesConstruct extends cdkContructs.Construct {
rpcPortForALB,
albHealthCheckGracePeriodMin,
healthCheckPath,
healthCheckPort,
heartBeatDelayMin,
lifecycleHookName,
autoScalingGroupName,
Expand Down Expand Up @@ -183,7 +185,7 @@ export class HANodesConstruct extends cdkContructs.Construct {
healthyHttpCodes: "200-299",
path: healthCheckPath ? healthCheckPath : "/",
// In the future, can create a separate service to have a more reliable health check
port: rpcPortForALB.toString(),
port: (healthCheckPort ? healthCheckPort : rpcPortForALB).toString(),
unhealthyThresholdCount: 2,
healthyThresholdCount: 3,
interval: cdk.Duration.seconds(30),
Expand Down
8 changes: 8 additions & 0 deletions lib/vechain/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
*.js
!jest.config.js
*.d.ts
node_modules

# CDK asset staging directory
.cdk.staging
cdk.out
6 changes: 6 additions & 0 deletions lib/vechain/.npmignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
*.ts
!*.d.ts

# CDK asset staging directory
.cdk.staging
cdk.out
310 changes: 310 additions & 0 deletions lib/vechain/README.md

Large diffs are not rendered by default.

54 changes: 54 additions & 0 deletions lib/vechain/app.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
import * as cdk from "aws-cdk-lib";
import "dotenv/config";
import { VetCommonStack } from "./lib/common-stack";
import * as config from "./lib/config/node-config";
import { VETHaNodeStack } from "./lib/ha-node-stack";
import { VETSingleNodeStack } from "./lib/single-node-stack";
import * as nag from "cdk-nag";

const app = new cdk.App();
cdk.Tags.of(app).add("Project", "AWSVet");

const commonStack = new VetCommonStack(app, "vet-common", {
stackName: `vet-common`,
env: { account: config.baseConfig.accountId, region: config.baseConfig.region },
});

new VETSingleNodeStack(app, `vet-single-node`, {
env: { account: config.baseConfig.accountId, region: config.baseConfig.region },
vetNodeType: config.baseNodeConfig.vetNodeType,
syncFromPublicSnapshot: config.baseNodeConfig.syncFromPublicSnapshot,
instanceType: config.baseNodeConfig.instanceType,
instanceCpuType: config.baseNodeConfig.instanceCpuType,
dataVolume: config.baseNodeConfig.dataVolume,
network: config.baseNodeConfig.network,
vetContainerImage: config.baseNodeConfig.vetContainerImage,
instanceRole: commonStack.instanceRole,
});

// Note: The Load balancer is not exposed to the public internet
// therefore you can only access the nodes from within the VPC
// HA nodes are only supported for public nodes
new VETHaNodeStack(app, `vet-ha-node`, {
env: { account: config.baseConfig.accountId, region: config.baseConfig.region },
vetNodeType: config.baseNodeConfig.vetNodeType,
syncFromPublicSnapshot: config.baseNodeConfig.syncFromPublicSnapshot,
instanceType: config.baseNodeConfig.instanceType,
instanceCpuType: config.baseNodeConfig.instanceCpuType,
dataVolume: config.baseNodeConfig.dataVolume,
network: config.baseNodeConfig.network,
vetContainerImage: config.baseNodeConfig.vetContainerImage,
instanceRole: commonStack.instanceRole,
albHealthCheckGracePeriodMin: config.haNodeConfig.albHealthCheckGracePeriodMin,
heartBeatDelayMin: config.haNodeConfig.heartBeatDelayMin,
numberOfNodes: config.haNodeConfig.numberOfNodes,
});

// Security Check
cdk.Aspects.of(app).add(
new nag.AwsSolutionsChecks({
verbose: false,
reports: true,
logIgnores: false,
})
);
97 changes: 97 additions & 0 deletions lib/vechain/cdk.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,97 @@
{
"app": "npx ts-node --prefer-ts-exts app.ts",
"watch": {
"include": [
"**"
],
"exclude": [
"README.md",
"cdk*.json",
"**/*.d.ts",
"**/*.js",
"tsconfig.json",
"package*.json",
"yarn.lock",
"node_modules",
"test"
]
},
"context": {
"@aws-cdk/aws-lambda:recognizeLayerVersion": true,
"@aws-cdk/core:checkSecretUsage": true,
"@aws-cdk/core:target-partitions": [
"aws",
"aws-cn"
],
"@aws-cdk-containers/ecs-service-extensions:enableDefaultLogDriver": true,
"@aws-cdk/aws-ec2:uniqueImdsv2TemplateName": true,
"@aws-cdk/aws-ecs:arnFormatIncludesClusterName": true,
"@aws-cdk/aws-iam:minimizePolicies": true,
"@aws-cdk/core:validateSnapshotRemovalPolicy": true,
"@aws-cdk/aws-codepipeline:crossAccountKeyAliasStackSafeResourceName": true,
"@aws-cdk/aws-s3:createDefaultLoggingPolicy": true,
"@aws-cdk/aws-sns-subscriptions:restrictSqsDescryption": true,
"@aws-cdk/aws-apigateway:disableCloudWatchRole": true,
"@aws-cdk/core:enablePartitionLiterals": true,
"@aws-cdk/aws-events:eventsTargetQueueSameAccount": true,
"@aws-cdk/aws-ecs:disableExplicitDeploymentControllerForCircuitBreaker": true,
"@aws-cdk/aws-iam:importedRoleStackSafeDefaultPolicyName": true,
"@aws-cdk/aws-s3:serverAccessLogsUseBucketPolicy": true,
"@aws-cdk/aws-route53-patters:useCertificate": true,
"@aws-cdk/customresources:installLatestAwsSdkDefault": false,
"@aws-cdk/aws-rds:databaseProxyUniqueResourceName": true,
"@aws-cdk/aws-codedeploy:removeAlarmsFromDeploymentGroup": true,
"@aws-cdk/aws-apigateway:authorizerChangeDeploymentLogicalId": true,
"@aws-cdk/aws-ec2:launchTemplateDefaultUserData": true,
"@aws-cdk/aws-secretsmanager:useAttachedSecretResourcePolicyForSecretTargetAttachments": true,
"@aws-cdk/aws-redshift:columnId": true,
"@aws-cdk/aws-stepfunctions-tasks:enableEmrServicePolicyV2": true,
"@aws-cdk/aws-ec2:restrictDefaultSecurityGroup": true,
"@aws-cdk/aws-apigateway:requestValidatorUniqueId": true,
"@aws-cdk/aws-kms:aliasNameRef": true,
"@aws-cdk/aws-autoscaling:generateLaunchTemplateInsteadOfLaunchConfig": true,
"@aws-cdk/core:includePrefixInUniqueNameGeneration": true,
"@aws-cdk/aws-efs:denyAnonymousAccess": true,
"@aws-cdk/aws-opensearchservice:enableOpensearchMultiAzWithStandby": true,
"@aws-cdk/aws-lambda-nodejs:useLatestRuntimeVersion": true,
"@aws-cdk/aws-efs:mountTargetOrderInsensitiveLogicalId": true,
"@aws-cdk/aws-rds:auroraClusterChangeScopeOfInstanceParameterGroupWithEachParameters": true,
"@aws-cdk/aws-appsync:useArnForSourceApiAssociationIdentifier": true,
"@aws-cdk/aws-rds:preventRenderingDeprecatedCredentials": true,
"@aws-cdk/aws-codepipeline-actions:useNewDefaultBranchForCodeCommitSource": true,
"@aws-cdk/aws-cloudwatch-actions:changeLambdaPermissionLogicalIdForLambdaAction": true,
"@aws-cdk/aws-codepipeline:crossAccountKeysDefaultValueToFalse": true,
"@aws-cdk/aws-codepipeline:defaultPipelineTypeToV2": true,
"@aws-cdk/aws-kms:reduceCrossAccountRegionPolicyScope": true,
"@aws-cdk/aws-eks:nodegroupNameAttribute": true,
"@aws-cdk/aws-ec2:ebsDefaultGp3Volume": true,
"@aws-cdk/aws-ecs:removeDefaultDeploymentAlarm": true,
"@aws-cdk/custom-resources:logApiResponseDataPropertyTrueDefault": false,
"@aws-cdk/aws-s3:keepNotificationInImportedBucket": false,
"@aws-cdk/aws-ecs:enableImdsBlockingDeprecatedFeature": false,
"@aws-cdk/aws-ecs:disableEcsImdsBlocking": true,
"@aws-cdk/aws-ecs:reduceEc2FargateCloudWatchPermissions": true,
"@aws-cdk/aws-dynamodb:resourcePolicyPerReplica": true,
"@aws-cdk/aws-ec2:ec2SumTImeoutEnabled": true,
"@aws-cdk/aws-appsync:appSyncGraphQLAPIScopeLambdaPermission": true,
"@aws-cdk/aws-rds:setCorrectValueForDatabaseInstanceReadReplicaInstanceResourceId": true,
"@aws-cdk/core:cfnIncludeRejectComplexResourceUpdateCreatePolicyIntrinsics": true,
"@aws-cdk/aws-lambda-nodejs:sdkV3ExcludeSmithyPackages": true,
"@aws-cdk/aws-stepfunctions-tasks:fixRunEcsTaskPolicy": true,
"@aws-cdk/aws-ec2:bastionHostUseAmazonLinux2023ByDefault": true,
"@aws-cdk/aws-route53-targets:userPoolDomainNameMethodWithoutCustomResource": true,
"@aws-cdk/aws-elasticloadbalancingV2:albDualstackWithoutPublicIpv4SecurityGroupRulesDefault": true,
"@aws-cdk/aws-iam:oidcRejectUnauthorizedConnections": true,
"@aws-cdk/core:enableAdditionalMetadataCollection": true,
"@aws-cdk/aws-lambda:createNewPoliciesWithAddToRolePolicy": false,
"@aws-cdk/aws-s3:setUniqueReplicationRoleName": true,
"@aws-cdk/aws-events:requireEventBusPolicySid": true,
"@aws-cdk/core:aspectPrioritiesMutating": true,
"@aws-cdk/aws-dynamodb:retainTableReplica": true,
"@aws-cdk/aws-stepfunctions:useDistributedMapResultWriterV2": true,
"@aws-cdk/s3-notifications:addS3TrustKeyPolicyForSnsSubscriptions": true,
"@aws-cdk/aws-ec2:requirePrivateSubnetsForEgressOnlyInternetGateway": true,
"@aws-cdk/aws-s3:publicAccessBlockedByDefault": true,
"@aws-cdk/aws-lambda:useCdkManagedLogGroup": true
}
}
Binary file added lib/vechain/doc/assets/ha-architecture.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Loading