Skip to content

Commit 37ff03b

Browse files
committed
Solana. Uncreased ulimit and added disc used metric to the dashboard
1 parent 0406223 commit 37ff03b

File tree

9 files changed

+63
-653
lines changed

9 files changed

+63
-653
lines changed

lib/solana/README.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,6 @@ Create your own copy of `.env` file and edit it to update with your AWS Account
129129
```bash
130130
pwd
131131
# Make sure you are in aws-blockchain-node-runners/lib/solana
132-
npm i --save-dev @types/node
133132
npx cdk deploy solana-common
134133
```
135134

lib/solana/lib/assets/node-cw-dashboard.ts

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -283,6 +283,42 @@ export const SingleNodeCWDashboardJSON = {
283283
"period": 60,
284284
"title": "nvme1n1 Volume Read/Write throughput (bytes/sec)"
285285
}
286+
},
287+
{
288+
"height": 5,
289+
"width": 6,
290+
"y": 15,
291+
"x": 6,
292+
"type": "metric",
293+
"properties": {
294+
"metrics": [
295+
[ "CWAgent", "disk_used_percent", "InstanceId", "${INSTANCE_ID}", "device", "nvme1n1", "path", "/var/solana/data", "fstype", "xfs", { "region": "${REGION}", "label": "/home/ubuntu/l2geth-source/l2geth-datadir" } ]
296+
],
297+
"sparkline": true,
298+
"view": "singleValue",
299+
"region": "${REGION}",
300+
"title": "nvme1n1 Disk Used (%)",
301+
"period": 60,
302+
"stat": "Average"
303+
}
304+
},
305+
{
306+
"height": 5,
307+
"width": 6,
308+
"y": 15,
309+
"x": 12,
310+
"type": "metric",
311+
"properties": {
312+
"metrics": [
313+
[ "CWAgent", "disk_used_percent", "InstanceId", "${INSTANCE_ID}", "device", "nvme2n1", "path", "/var/solana/accounts", "fstype", "xfs", { "region": "${REGION}", "label": "/home/ubuntu/l2geth-source/l2geth-datadir" } ]
314+
],
315+
"sparkline": true,
316+
"view": "singleValue",
317+
"region": "${REGION}",
318+
"title": "nvme2n1 Disk Used (%)",
319+
"period": 60,
320+
"stat": "Average"
321+
}
286322
}
287323
]
288324
}

lib/solana/lib/assets/solana/node-consensus-template.sh

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,9 @@ export RUST_LOG=error
88
export RUST_BACKTRACE=full
99
export SOLANA_METRICS_CONFIG=__SOLANA_METRICS_CONFIG__
1010

11+
#See https://github.com/aws-samples/aws-blockchain-node-runners/issues/31
12+
ulimit -n 1000000
13+
1114
TOKEN=$(curl -s -X PUT "http://169.254.169.254/latest/api/token" -H "X-aws-ec2-metadata-token-ttl-seconds: 21600")
1215
export EC2_INTERNAL_IP=$(curl -H "X-aws-ec2-metadata-token: $TOKEN" -s http://169.254.169.254/latest/meta-data/local-ipv4)
1316

lib/solana/lib/assets/solana/node-heavy-rpc-template.sh

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,9 @@ export RUST_LOG=error
88
export RUST_BACKTRACE=full
99
export SOLANA_METRICS_CONFIG=__SOLANA_METRICS_CONFIG__
1010

11+
#See https://github.com/aws-samples/aws-blockchain-node-runners/issues/31
12+
ulimit -n 1000000
13+
1114
TOKEN=$(curl -s -X PUT "http://169.254.169.254/latest/api/token" -H "X-aws-ec2-metadata-token-ttl-seconds: 21600")
1215
export EC2_INTERNAL_IP=$(curl -H "X-aws-ec2-metadata-token: $TOKEN" -s http://169.254.169.254/latest/meta-data/local-ipv4)
1316

lib/solana/lib/assets/solana/node-light-rpc-template.sh

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,9 @@ export RUST_LOG=error
88
export RUST_BACKTRACE=full
99
export SOLANA_METRICS_CONFIG=__SOLANA_METRICS_CONFIG__
1010

11+
#See https://github.com/aws-samples/aws-blockchain-node-runners/issues/31
12+
ulimit -n 1000000
13+
1114
TOKEN=$(curl -s -X PUT "http://169.254.169.254/latest/api/token" -H "X-aws-ec2-metadata-token-ttl-seconds: 21600")
1215
export EC2_INTERNAL_IP=$(curl -H "X-aws-ec2-metadata-token: $TOKEN" -s http://169.254.169.254/latest/meta-data/local-ipv4)
1316

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

Lines changed: 7 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -110,13 +110,13 @@ sudo bash -c "cat >/etc/security/limits.d/90-solana-nofiles.conf <<EOF
110110
* - nofile 1000000
111111
EOF"
112112

113-
echo 'Preparing directories and file system for Solana installation'
113+
echo 'Preparing fs for Solana installation'
114114
sudo mkdir /var/solana
115115
sudo mkdir /var/solana/data
116116
sudo mkdir /var/solana/accounts
117117

118118
if [[ "$STACK_ID" != "none" ]]; then
119-
echo "Install and enable CloudFormation helper scripts"
119+
echo "Install CloudFormation helper scripts"
120120
mkdir -p /opt/aws/
121121
pip3 install https://s3.amazonaws.com/cloudformation-examples/aws-cfn-bootstrap-py3-latest.tar.gz
122122
sudo ln -s /usr/local/init/ubuntu/cfn-hup /etc/init.d/cfn-hup
@@ -213,12 +213,9 @@ sudo usermod -aG sudo solana
213213
cd /home/solana
214214
sudo mkdir ./bin
215215

216-
# See details in https://github.com/aws-samples/aws-blockchain-node-runners/issues/31
217216
ln -s /var/solana/data/ledger /home/solana
218-
ulimit -n 1000000
219217

220218
echo "Downloading x86 binaries for version v$SOLANA_VERSION"
221-
222219
sudo wget -q https://github.com/solana-labs/solana/releases/download/v$SOLANA_VERSION/solana-release-x86_64-unknown-linux-gnu.tar.bz2
223220
sudo tar -xjvf solana-release-x86_64-unknown-linux-gnu.tar.bz2
224221
sudo mv solana-release/bin/* ./bin/
@@ -237,22 +234,22 @@ else
237234
fi
238235
if [[ "$SOLANA_NODE_TYPE" == "consensus" ]]; then
239236
if [[ $NODE_IDENTITY_SECRET_ARN == "none" ]]; then
240-
echo "Storing generated node identity to AWS Secrets Manager"
237+
echo "Store node identity to AWS Secrets Manager"
241238
NODE_IDENTITY=$(sudo ./solana-keygen pubkey /home/solana/config/vote-account-keypair.json)
242239
sudo aws secretsmanager create-secret --name "solana-node/"$NODE_IDENTITY --description "Solana Node Identity Secret created for stack $CF_STACK_NAME" --secret-string file:///home/solana/config/validator-keypair.json --region $AWS_REGION
243240
fi
244241
if [[ $VOTE_ACCOUNT_SECRET_ARN == "none" ]]; then
245242
echo "Create Vote Account Secret"
246243
sudo ./solana-keygen new --no-passphrase -o /home/solana/config/vote-account-keypair.json
247244
NODE_IDENTITY=$(sudo ./solana-keygen pubkey /home/solana/config/vote-account-keypair.json)
248-
echo "Storing Vote Account Secret to AWS Secrets Manager"
245+
echo "Store Vote Account Secret to AWS Secrets Manager"
249246
sudo aws secretsmanager create-secret --name "solana-node/"$NODE_IDENTITY --description "Solana Vote Account Secret created for stack $CF_STACK_NAME" --secret-string file:///home/solana/config/vote-account-keypair.json --region $AWS_REGION
250247

251248
if [[ $AUTHORIZED_WITHDRAWER_ACCOUNT_SECRET_ARN == "none" ]]; then
252249
echo "Create Authorized Withdrawer Account Secret"
253250
sudo ./solana-keygen new --no-passphrase -o /home/solana/config/authorized-withdrawer-keypair.json
254251
NODE_IDENTITY=$(sudo ./solana-keygen pubkey /home/solana/config/authorized-withdrawer-keypair.json)
255-
echo "Storing Authorized Withdrawer Account to AWS Secrets Manager"
252+
echo "Store Authorized Withdrawer Account to AWS Secrets Manager"
256253
sudo aws secretsmanager create-secret --name "solana-node/"$NODE_IDENTITY --description "Authorized Withdrawer Account Secret created for stack $CF_STACK_NAME" --secret-string file:///home/solana/config/authorized-withdrawer-keypair.json --region $AWS_REGION
257254

258255
else
@@ -269,13 +266,13 @@ if [[ "$SOLANA_NODE_TYPE" == "consensus" ]]; then
269266
echo "Creating Vote Account on-chain"
270267
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
271268

272-
echo "Deleting Transaction Funding Account Secret from the local disc"
269+
echo "Delete Transaction Funding Account Secret from the local disc"
273270
sudo rm /root/.config/solana/id.json
274271
else
275272
echo "Vote Account not created. Please create it manually: https://docs.solana.com/running-validator/validator-start#create-vote-account"
276273
fi
277274

278-
echo "Deleting Authorized Withdrawer Account from the local disc"
275+
echo "Delete Authorized Withdrawer Account from the local disc"
279276
sudo rm /home/solana/config/authorized-withdrawer-keypair.json
280277
else
281278
echo "Get Vote Account Secret from AWS Secrets Manager"

lib/solana/lib/common-stack.ts

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,16 @@ export class SolanaCommonStack extends cdk.Stack {
3535
resources: [`arn:aws:autoscaling:${region}:${this.AWS_ACCOUNT_ID}:autoScalingGroup:*:autoScalingGroupName/solana-*`],
3636
actions: ["autoscaling:CompleteLifecycleAction"],
3737
}));
38+
39+
instanceRole.addToPolicy(
40+
new iam.PolicyStatement({
41+
resources: [
42+
`arn:aws:s3:::cloudformation-examples`,
43+
`arn:aws:s3:::cloudformation-examples/*`,
44+
],
45+
actions: ["s3:ListBucket", "s3:*Object", "s3:GetBucket*"],
46+
})
47+
);
3848

3949
new cdk.CfnOutput(this, "Instance Role ARN", {
4050
value: instanceRole.roleArn,

0 commit comments

Comments
 (0)