Skip to content

Commit

Permalink
Merge pull request #145 from aws-samples/142-fail-to-deploy-consensus…
Browse files Browse the repository at this point in the history
…-mainnet-beta-node

Check to allow to deploy consensus single mainnet-beta node
  • Loading branch information
frbrkoala authored Nov 14, 2024
2 parents 95ddec4 + 5ca02d3 commit 8e350e0
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 21 deletions.
35 changes: 20 additions & 15 deletions lib/solana/app.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,23 +34,28 @@ new SolanaSingleNodeStack(app, "solana-single-node", {
registrationTransactionFundingAccountSecretARN: config.baseNodeConfig.registrationTransactionFundingAccountSecretARN,
});

new SolanaHANodesStack(app, "solana-ha-nodes", {
stackName: `solana-ha-nodes-${config.baseNodeConfig.nodeConfiguration}`,
env: { account: config.baseConfig.accountId, region: config.baseConfig.region },

instanceType: config.baseNodeConfig.instanceType,
instanceCpuType: config.baseNodeConfig.instanceCpuType,
solanaCluster: config.baseNodeConfig.solanaCluster,
solanaVersion: config.baseNodeConfig.solanaVersion,
nodeConfiguration: config.baseNodeConfig.nodeConfiguration,
dataVolume: config.baseNodeConfig.dataVolume,
accountsVolume: config.baseNodeConfig.accountsVolume,
if (app.node.tryGetContext('deployHA') === 'true') {
if (config.baseNodeConfig.nodeConfiguration !== "consensus") {
new SolanaHANodesStack(app, "solana-ha-nodes", {
stackName: `solana-ha-nodes-${config.baseNodeConfig.nodeConfiguration}`,
env: { account: config.baseConfig.accountId, region: config.baseConfig.region },

albHealthCheckGracePeriodMin: config.haNodeConfig.albHealthCheckGracePeriodMin,
heartBeatDelayMin: config.haNodeConfig.heartBeatDelayMin,
numberOfNodes: config.haNodeConfig.numberOfNodes,
});
instanceType: config.baseNodeConfig.instanceType,
instanceCpuType: config.baseNodeConfig.instanceCpuType,
solanaCluster: config.baseNodeConfig.solanaCluster,
solanaVersion: config.baseNodeConfig.solanaVersion,
nodeConfiguration: config.baseNodeConfig.nodeConfiguration,
dataVolume: config.baseNodeConfig.dataVolume,
accountsVolume: config.baseNodeConfig.accountsVolume,

albHealthCheckGracePeriodMin: config.haNodeConfig.albHealthCheckGracePeriodMin,
heartBeatDelayMin: config.haNodeConfig.heartBeatDelayMin,
numberOfNodes: config.haNodeConfig.numberOfNodes,
});
} else {
throw new Error("Consensus node configuration is not yet supported for HA setup");
}
}

// Security Check
cdk.Aspects.of(app).add(
Expand Down
8 changes: 2 additions & 6 deletions lib/solana/lib/ha-nodes-stack.ts
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ export class SolanaHANodesStack extends cdk.Stack {
const vpc = ec2.Vpc.fromLookup(this, "vpc", { isDefault: true });

// Setting up the security group for the node from Solana-specific construct
const instanceSG = new SolanaNodeSecurityGroupConstruct (this, "security-group", {
const instanceSG = new SolanaNodeSecurityGroupConstruct(this, "security-group", {
vpc: vpc,
})

Expand All @@ -75,10 +75,6 @@ export class SolanaHANodesStack extends cdk.Stack {
throw new Error("ARM_64 is not yet supported");
}

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"

Expand Down Expand Up @@ -110,7 +106,7 @@ export class SolanaHANodesStack extends cdk.Stack {

// Setting up the nodse using generic High Availability (HA) Node constract
const healthCheckPath = "/health";
const rpcNodes = new HANodesConstruct (this, "rpc-nodes", {
const rpcNodes = new HANodesConstruct(this, "rpc-nodes", {
instanceType,
dataVolumes: [accountsVolume, dataVolume],
rootDataVolumeDeviceName: "/dev/sda1",
Expand Down

0 comments on commit 8e350e0

Please sign in to comment.