Skip to content

Commit 667ad6d

Browse files
committed
Check to allow to deploy consensus single mainnet-beta node
1 parent ad3784e commit 667ad6d

File tree

2 files changed

+22
-21
lines changed

2 files changed

+22
-21
lines changed

lib/solana/app.ts

Lines changed: 20 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -34,23 +34,28 @@ new SolanaSingleNodeStack(app, "solana-single-node", {
3434
registrationTransactionFundingAccountSecretARN: config.baseNodeConfig.registrationTransactionFundingAccountSecretARN,
3535
});
3636

37-
new SolanaHANodesStack(app, "solana-ha-nodes", {
38-
stackName: `solana-ha-nodes-${config.baseNodeConfig.nodeConfiguration}`,
39-
env: { account: config.baseConfig.accountId, region: config.baseConfig.region },
40-
41-
instanceType: config.baseNodeConfig.instanceType,
42-
instanceCpuType: config.baseNodeConfig.instanceCpuType,
43-
solanaCluster: config.baseNodeConfig.solanaCluster,
44-
solanaVersion: config.baseNodeConfig.solanaVersion,
45-
nodeConfiguration: config.baseNodeConfig.nodeConfiguration,
46-
dataVolume: config.baseNodeConfig.dataVolume,
47-
accountsVolume: config.baseNodeConfig.accountsVolume,
37+
if (app.node.tryGetContext('deployHA') === 'true') {
38+
if (config.baseNodeConfig.nodeConfiguration !== "consensus") {
39+
new SolanaHANodesStack(app, "solana-ha-nodes", {
40+
stackName: `solana-ha-nodes-${config.baseNodeConfig.nodeConfiguration}`,
41+
env: { account: config.baseConfig.accountId, region: config.baseConfig.region },
4842

49-
albHealthCheckGracePeriodMin: config.haNodeConfig.albHealthCheckGracePeriodMin,
50-
heartBeatDelayMin: config.haNodeConfig.heartBeatDelayMin,
51-
numberOfNodes: config.haNodeConfig.numberOfNodes,
52-
});
43+
instanceType: config.baseNodeConfig.instanceType,
44+
instanceCpuType: config.baseNodeConfig.instanceCpuType,
45+
solanaCluster: config.baseNodeConfig.solanaCluster,
46+
solanaVersion: config.baseNodeConfig.solanaVersion,
47+
nodeConfiguration: config.baseNodeConfig.nodeConfiguration,
48+
dataVolume: config.baseNodeConfig.dataVolume,
49+
accountsVolume: config.baseNodeConfig.accountsVolume,
5350

51+
albHealthCheckGracePeriodMin: config.haNodeConfig.albHealthCheckGracePeriodMin,
52+
heartBeatDelayMin: config.haNodeConfig.heartBeatDelayMin,
53+
numberOfNodes: config.haNodeConfig.numberOfNodes,
54+
});
55+
} else {
56+
throw new Error("Consensus node configuration is not yet supported for HA setup");
57+
}
58+
}
5459

5560
// Security Check
5661
cdk.Aspects.of(app).add(

lib/solana/lib/ha-nodes-stack.ts

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ export class SolanaHANodesStack extends cdk.Stack {
5353
const vpc = ec2.Vpc.fromLookup(this, "vpc", { isDefault: true });
5454

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

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

78-
if (nodeConfiguration === "consensus") {
79-
throw new Error("Consensus node configuration is not yet supported for HA setup");
80-
}
81-
8278
// 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
8379
const ubuntu204stableImageSsmName = "/aws/service/canonical/ubuntu/server/20.04/stable/current/amd64/hvm/ebs-gp2/ami-id"
8480

@@ -110,7 +106,7 @@ export class SolanaHANodesStack extends cdk.Stack {
110106

111107
// Setting up the nodse using generic High Availability (HA) Node constract
112108
const healthCheckPath = "/health";
113-
const rpcNodes = new HANodesConstruct (this, "rpc-nodes", {
109+
const rpcNodes = new HANodesConstruct(this, "rpc-nodes", {
114110
instanceType,
115111
dataVolumes: [dataVolume, accountsVolume],
116112
rootDataVolumeDeviceName: "/dev/sda1",

0 commit comments

Comments
 (0)