The following commands provide a step-by-step guide for installing and configuring a Wax Node along with other necessary tools and dependencies. The process also includes the installation and setup of AWS CLI and the AWS Systems Manager (SSM) plugin for managing AWS resources, as well as the deployment of the Wax Node infrastructure using the AWS Cloud Development Kit (CDK).
Wax Node CDK Environment Setup
Operating System : Ubuntu 20.04 LTS
Minimum CPU : 4 cores
Minimum RAM : 16GiB
Minimum Storage: 20GiB
- Switch to superuser mode:
sudo su
- Update and upgrade the system packages:
apt update -y && apt upgrade -y
- Install essential utilities: curl and unzip:
apt install -y curl unzip jq
- Add Node.js 18.x repository and install Node.js:
curl -fsSL https://deb.nodesource.com/setup_18.x | sudo -E bash -
apt-get install -y nodejs
- Check the installed versions of Node.js and npm:
npm -v
node --version
- Install AWS CLI:
curl "https://awscli.amazonaws.com/awscli-exe-linux-x86_64.zip" -o "awscliv2.zip"
unzip awscliv2.zip
./aws/install
- Install AWS Systems Manager (SSM) plugin:
curl "https://s3.amazonaws.com/session-manager-downloads/plugin/latest/ubuntu_64bit/session-manager-plugin.deb" -o "session-manager-plugin.deb"
dpkg -i session-manager-plugin.deb
session-manager-plugin
- Install the AWS Cloud Development Kit (CDK) globally:
npm install -g aws-cdk
- Install a specific version of npm (10.1.0): (if prompted)
npm install -g [email protected]
- Check the installed version of the CDK:
cdk version
- Install TypeScript globally:
npm i -g typescript
- Install AWS CDK globally (again, for redundancy):
npm i -g aws-cdk
- Configure AWS access keys:
- Provide aws access keys For better results please have access key with following permissions policies "AdministratorAccess"
- Note : provide region while configuring to avoid any conflicts
aws configure
- Clone the Wax AWS CDK repository:
git clone https://github.com/worldwide-asset-exchange/wax-aws-cdk.git
cd wax-aws-cdk
- This project relies on wax-node to start the node. To deploy the API node, execute the following command. Choose any one of the desired set of environment variables from the below to execute.
export AWS_ACCOUNT_ID=`aws sts get-caller-identity | jq -r .Account`
export AWS_REGION=eu-central-1
export START_FROM_SNAPSHOT=true
export AWS_ACCOUNT_ID=`aws sts get-caller-identity | jq -r .Account`
export AWS_REGION=eu-central-1
export ENABLE_SHIP_NODE=true
export AWS_ACCOUNT_ID=`aws sts get-caller-identity | jq -r .Account`
export AWS_REGION=eu-central-1
export START_FROM_SNAPSHOT=true
export ENABLE_SHIP_NODE=true
- Install project dependencies:
npm install
- Generate CloudFormation templates:
cdk synth
- Bootstrap the AWS environment:
cdk bootstrap aws://$AWS_ACCOUNT_ID/$AWS_REGION
- Build the project:
npm run build
- Deploy the Wax Node infrastructure using CDK:
npx cdk deploy
These commands provide a comprehensive guide for setting up a Wax Node, configuring AWS CLI and SSM, and deploying the necessary infrastructure for the Wax Node using CDK. Be sure to replace the provided access key and secret access key with your own credentials, and adapt any other parameters to your specific use case as needed.
Monitoring
Go to CloudWatch > Log groups >/waxnode/ > logs
echo Link: https://$AWS_REGION.console.aws.amazon.com/cloudwatch/home?region=$AWS_REGION#logsV2:log-groups/log-group/\$252Fwaxnode\$252F/log-events/logs
export INSTANCE_ID=`aws ec2 describe-instances --filters "Name=tag:aws:cloudformation:stack-name,Values=WaxNodeCdkStack" | jq -r '.[]|.[] |.Instances[].InstanceId'`
export GRAFANA_IP=`aws ec2 describe-instances --instance-ids $INSTANCE_ID | jq -r ".[]|.[]|.Instances[]|.NetworkInterfaces[].Association.PublicIp"`
List of ports opened for wax nodes ( which are accessible via the VPC CIDR block by default and are not publically open)
Port 8888 - API port for API / Ship node
Port 9876 - P2P port for API node
Port 8080 - Websocket for SHIP node
Port 80 - HTTP Port for access the apis on 8888 and also grafana monitoring
aws ec2 authorize-security-group-ingress --group-id `aws ec2 describe-instances --instance-ids $INSTANCE_ID | jq -r ".[]|.[]|.Instances[]|.SecurityGroups[].GroupId"` --ip-permissions IpProtocol=tcp,FromPort=80,ToPort=80,IpRanges='[{CidrIp='0.0.0.0/0',Description="wideopen"}]'
echo http://$GRAFANA_IP/monitoring/
- Can be found in the following file.
cat /root/.grafanapassword
aws ssm start-session --target i-$INSTANCE_ID --document-name SSM-WaxNodeCdkConfiguration
sudo tail -f /var/log/cloud-init-output.log
- Note: it might take up to 30 minutes for the node to start up and few days for the node to sync to the newest block.
- check log status
tail -f /var/log/wax/logs.log
curl http://localhost:8888/v1/chain/get_info | jq
# Check node status
curl http://`wget -q -O - http://169.254.169.254/latest/meta-data/public-ipv4`:8888/v1/chain/get_info | jq
- More info about Wax Node here
npm run build
compile typescript to jsnpm run watch
watch for changes and compilenpm run test
perform the jest unit testscdk deploy
deploy this stack to your default AWS account/regioncdk diff
compare deployed stack with current statecdk synth
emits the synthesized CloudFormation template