Skip to content

Commit 3be882b

Browse files
authored
Merge pull request #162 from StayHungryStayFoolish/solana-awscli-fix
Fix Solana node installing aws-cli error on x86_64 architecture
2 parents 13733e3 + 6b466bf commit 3be882b

File tree

3 files changed

+19
-18
lines changed

3 files changed

+19
-18
lines changed

lib/constructs/ha-rpc-nodes-with-alb.ts

Lines changed: 16 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -75,18 +75,22 @@ export class HANodesConstruct extends cdkContructs.Construct {
7575
}
7676

7777
if (dataVolume.type !== constants.InstanceStoreageDeviceVolumeType){
78-
blockDevices.push(
79-
{
80-
deviceName: constants.VolumeDeviceNames[arrayIndex],
81-
volume: autoscaling.BlockDeviceVolume.ebs(dataVolume.sizeGiB, {
82-
deleteOnTermination: true,
83-
throughput: dataVolume.throughput,
84-
encrypted: true,
85-
iops: dataVolume.iops,
86-
volumeType: autoscaling.EbsDeviceVolumeType[dataVolume.type.toUpperCase() as keyof typeof autoscaling.EbsDeviceVolumeType],
87-
}),
88-
}
89-
)
78+
const volumeType = dataVolume.type.toUpperCase();
79+
const ebsConfig: any = {
80+
deleteOnTermination: true,
81+
encrypted: true,
82+
iops: dataVolume.iops,
83+
volumeType: autoscaling.EbsDeviceVolumeType[dataVolume.type.toUpperCase() as keyof typeof autoscaling.EbsDeviceVolumeType],
84+
};
85+
86+
if (volumeType == 'GP3'){
87+
ebsConfig.throughput = dataVolume.throughput;
88+
}
89+
90+
blockDevices.push({
91+
deviceName: constants.VolumeDeviceNames[arrayIndex],
92+
volume: autoscaling.BlockDeviceVolume.ebs(dataVolume.sizeGiB, ebsConfig)
93+
})
9094
}
9195
});
9296

lib/solana/lib/assets/instance/storage/setup.sh

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,8 @@ get_all_empty_nvme_disks () {
3232
local unmounted_nvme_disks=()
3333
local sorted_unmounted_nvme_disks
3434

35-
all_not_mounted_nvme_disks=$(lsblk -lnb | awk '{if ($7=="") {print $1}}' | grep nvme)
35+
#The disk will only be mounted when the nvme disk is larger than 100GB to avoid storing blockchain node data directly on the root EBS disk (which is 46GB by default)
36+
all_not_mounted_nvme_disks=$(lsblk -lnb | awk '{if ($7 == "" && $4 > 100000000) {print $1}}' | grep nvme)
3637
all_mounted_nvme_partitions=$(mount | awk '{print $1}' | grep /dev/nvme)
3738
for disk in ${all_not_mounted_nvme_disks[*]}; do
3839
if [[ ! "${all_mounted_nvme_partitions[*]}" =~ $disk ]]; then

lib/solana/lib/assets/user-data-ubuntu.sh

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -33,20 +33,16 @@ apt-get -yqq install jq unzip python3-pip chrony
3333

3434
if [ "$ARCH" == "x86_64" ]; then
3535
CW_AGENT_BINARY_URI=https://s3.amazonaws.com/amazoncloudwatch-agent/ubuntu/amd64/latest/amazon-cloudwatch-agent.deb
36-
AWS_CLI_BINARY_URI=https://awscli.amazonaws.com/awscli-exe-linux-x86_64.zip
3736
else
3837
CW_AGENT_BINARY_URI=https://s3.amazonaws.com/amazoncloudwatch-agent/ubuntu/arm64/latest/amazon-cloudwatch-agent.deb
39-
AWS_CLI_BINARY_URI=https://awscli.amazonaws.com/awscli-exe-linux-aarch64.zip
4038
fi
4139

4240
cd /opt || exit 1
4341

4442
ARCH=$(uname -m)
4543

4644
echo "Intalling AWS CLI"
47-
curl "$AWS_CLI_BINARY_URI" -o "awscliv2.zip"
48-
unzip awscliv2.zip
49-
/opt/aws/install
45+
snap install aws-cli --classic
5046

5147
echo "Downloading assets zip file"
5248
aws s3 cp $ASSETS_S3_PATH ./assets.zip --region $AWS_REGION

0 commit comments

Comments
 (0)