Skip to content

Commit dd686fd

Browse files
committed
update readme
1 parent dc6637d commit dd686fd

File tree

1 file changed

+87
-42
lines changed

1 file changed

+87
-42
lines changed

lib/allora/README.md

Lines changed: 87 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,11 @@
22

33
| Contributed by |
44
|:--------------------:|
5-
| [@vladupshot](https://github.com/vladupshot), [@allora-rc](https://github.com/allora-rc) |
5+
| [@clementupshot](https://github.com/clementupshot), [@allora-rc](https://github.com/allora-rc) |
66

77
[Allora](https://www.allora.network/) is a self-improving decentralized Artificial Intelligence (AI) network. The primary goal of the network is to be the marketplace for intelligence. In other words, Allora aims to incentivize data scientists (workers) to provide high-quality inferences as requested by consumers. Inferences include predictions of arbitrary future events or difficult computations requiring specialized knowledge.
88

9-
The Allora Network brings together
9+
The Allora Network brings together:
1010

1111
- [Consumers](https://docs.allora.network/devs) who pay for and acquire inferences or expertise to be revealed
1212
- [Workers](https://v2.docs.allora.network/datasci) who reveal inferences
@@ -17,65 +17,110 @@ With these ingredients, the Allora Network is able to continuously learn and imp
1717

1818
Allora Worker nodes are the interfaces between data scientists' models and the Allora Network. A worker node is a machine-intelligent application registered on the Allora chain that provides inference/prediction on a particular topic it's subscribed to and gets rewarded based on the inference quality.
1919

20-
This blueprint is designed to assist in deploying a single Allora [Worker Node](https://v2.docs.allora.network/datasci) on AWS. It is intended for use in development, testing, or Proof of Concept (PoC) purposes.
20+
This blueprint is designed to assist in deploying a single Allora [Worker Node](https://v2.docs.allora.network/datasci) on AWS. It is intended for use in development, testing, or Proof of Concept (PoC) environments.
2121

2222
## Overview of Deployment Architecture
2323

2424
### Single Worker Node Setup
2525
![Single Worker Node Deployment](./doc/assets/Architecture-Single-Allora-Worker-Node.png)
2626

27-
1. The Allora worker node is deployed in the Default VPC. An Internet Gateway.
28-
2. The Woeker is used by dApps or development tools internally from within the Default VPC. JSON RPC API is not exposed to the Internet directly to protect nodes from unauthorized access.
29-
3. The Allora Worker Node uses all required secrets locally. Optionally, AWS Secrets Manager as secure backup.
30-
The Stacks node sends various monitoring metrics for both EC2 and Stacks nodes to Amazon CloudWatch.
27+
The AWS Cloud Development Kit (CDK) is used to deploy a single Allora Worker Node. The CDK application deploys the following infrastructure:
28+
29+
- Virtual Private Cloud (VPC)
30+
- Internet Gateway (IGW) to allow inbound requests for inferences from consumers and outbound responses from the worker node revealing inferences
31+
- Public subnet that has a direct route to the IGW
32+
- Security Group (SG) with TCP Port 9010 open inbound allowing requests for inferences to be routed to the Allora Worker Node
33+
- Single Amazon Elastic Compute Cloud (EC2) instance (the Allora Worker Node) assigned to the public subnet
34+
- Elastic IP Address (EIP) associated with the EC2 instance to maintain consistent IP addressing across instance restarts
3135

32-
This blueprint creates a setup where the Allora worker node is supported by a side node providing inferences. They communicate through an endpoint so the worker will request inferences to the side node (the Inference Server). This makes an ultra-light worker node.
36+
The Allora Worker Node is accessed by the user internally and is not exposed to the Internet to protect the node from unauthorized access. A user can gain access to the EC2 Instance using AWS Session Manager.
3337

34-
## Worke Node System Requirements
38+
Multiple processes run on the Allora Worker Node (EC2 instance):
39+
40+
- Docker container with the worker node logic that handles communnication bet
41+
- Docker container running the model server that reveal inferences to consumers
42+
43+
Allora Public Head Nodes publish the Allora chain requests (requests for inferences from consumers) to Allora worker nodes. When a worker node is initialized, it starts with an environment variable called BOOT_NODES, which helps handle the connection and communications between worker nodes and the head nodes.
44+
45+
The worker node (docker container) will call the function that invokes custom logic that handles. The request-response is a bidirectional flow from the Allora chain (inference requests from consumers) to the public head nodes to the worker node and finally to the model server that reveals inferences.
46+
47+
48+
## Worker Node System Requirements
3549

3650
- Operating System: Any modern Linux operating system
3751
- CPU: Minimum of 1/2 core
3852
- Memory: 2 to 4 GB
39-
- Storage: SSD or NVMe with at least 5GB of space.
53+
- Storage: SSD or NVMe with at least 5GB of space
54+
55+
## Setup Instructions
56+
57+
### Setup Cloud9
58+
59+
We will use AWS Cloud9 to execute the subsequent commands. Follow the instructions in [Cloud9 Setup](../../docs/setup-cloud9.md).
60+
61+
### Clone this repository and install dependencies
62+
63+
```bash
64+
git clone https://github.com/aws-samples/aws-blockchain-node-runners.git
65+
cd aws-blockchain-node-runners
66+
npm install
67+
```
68+
69+
### Deploy single worker node
70+
71+
1. Make sure you are in the root directory of the cloned repository
72+
73+
2. Configure your setup
74+
75+
Create your own copy of `.env` file and edit it to update with your AWS Account ID and Region:
76+
```bash
77+
# Make sure you are in aws-blockchain-node-runners/lib/allora
78+
cd lib/allora
79+
npm install
80+
pwd
81+
cp ./sample-configs/.env-sample-full .env
82+
nano .env
83+
```
84+
> NOTE:
85+
> Example configuration parameters are set in the local `.env-sample` file. You can find more examples inside `sample-configs` directory.
86+
87+
> IMPORTANT:
88+
> All AWS CDK v2 deployments use dedicated AWS resources to hold data during deployment. Therefore, your AWS account and Region must be [bootstrapped](https://docs.aws.amazon.com/cdk/v2/guide/bootstrapping.html) to create these resources before you can deploy. If you haven't already bootstrapped, issue the following command:
89+
> ```bash
90+
> cdk bootstrap aws://ACCOUNT-NUMBER/REGION
91+
> ```
92+
93+
3. Deploy Allora Worker Node
4094
41-
## Additional materials
95+
```bash
96+
pwd
97+
# Make sure you are in aws-blockchain-node-runners/lib/allora
98+
npx cdk deploy allora-single-node --json --outputs-file single-node-deploy.json
99+
```
42100
43-
<details>
101+
## Clear up and undeploy everything
44102
45-
<summary>Well-Architected Checklist</summary>
103+
1. Undeploy worker node and common components
46104
105+
```bash
106+
# Setting the AWS account id and region in case local .env file is lost
107+
export AWS_ACCOUNT_ID=<your_target_AWS_account_id>
108+
export AWS_REGION=<your_target_AWS_region>
47109
48-
This is the Well-Architected checklist for Allora Worker Nodes implementation of the AWS Blockchain Node Runner app. This checklist takes into account questions from the [AWS Well-Architected Framework](https://aws.amazon.com/architecture/well-architected/) which are relevant to this workload. Please feel free to add more checks from the framework if required for your workload.
110+
pwd
111+
# Make sure you are in aws-blockchain-node-runners/lib/allora
49112
50-
| Pillar | Control | Question/Check | Remarks |
51-
|:------------------------|:----------------------------------|:---------------------------------------------------------------------------------|:-----------------|
52-
| Security | Network protection | Are there unnecessary open ports in security groups? | |
53-
| | | Traffic inspection | AWS WAF could be implemented for traffic inspection. Additional charges will apply. |
54-
| | Compute protection | Reduce attack surface | This solution uses Canonical, Ubuntu, 24.04 LTS. You may choose to run hardening scripts on it. |
55-
| | | Enable people to perform actions at a distance | This solution uses AWS Systems Manager for terminal session, not ssh ports. |
56-
| | Data protection at rest | Use encrypted Amazon Elastic Block Store (Amazon EBS) volumes | This solution uses encrypted Amazon EBS volumes. |
57-
| | Data protection in transit | Use TLS | |
58-
| | Authorization and access control | Use instance profile with Amazon Elastic Compute Cloud (Amazon EC2) instances | This solution uses AWS Identity and Access Management (AWS IAM) role instead of IAM user. |
59-
| | | Following principle of least privilege access | In the node, root user is not used (using special user "ubuntu" instead). |
60-
| | Application security | Security focused development practices | cdk-nag is being used with documented suppressions. |
61-
| Cost optimization | Service selection | Use cost effective resources | |
62-
| | Cost awareness | Estimate costs | |
63-
| Reliability | Resiliency implementation | Withstand component failures | This solution currently does not have high availability and is deployed to a single availability zone. |
64-
| | Data backup | How is data backed up? | The data is not specially backed up. The node will have to re-sync its state from other nodes in the Allora network to recover. |
65-
| | Resource monitoring | How are workload resources monitored? | |
66-
| Performance efficiency | Compute selection | How is compute solution selected? | |
67-
| | Storage selection | How is storage solution selected? | |
68-
| | Architecture selection | How is the best performance architecture selected? | |
69-
| Operational excellence | Workload health | How is health of workload determined? | |
70-
| Sustainability | Hardware & services | Select most efficient hardware for your workload | |
71-
</details>
72-
<details>
113+
# Undeploy Single Node
114+
npx cdk destroy allora-single-node
115+
```
73116
74-
<summary>Recommended Infrastructure</summary>
117+
2. Follow these steps to delete the Cloud9 instance in [Cloud9 Setup](../../docs/setup-cloud9.md)
75118
119+
Navigate to the AWS Cloud9 service in your Management Console, then select the environment you have created. On the top right, click **Delete** button and follow the instructions.
76120
77-
| Usage pattern | Ideal configuration | Primary option on AWS | Config reference |
78-
|---------------------------------------------------|--------------------------------------------------------------------------------------------------------------------------|------------------------------------------------------------------------|-------------------------------------------------------|
79-
| 1/ Fullnode | 8 vCPU, 32 GB RAM, Data volume: EBS gp3 2TB, 7K IOPS, 400 MB/s throughput | `m6a.2xlarge` EBS gp3 volumes about 2000 GB(7000 IOPS, 400 MBps/s throughput) | [.env-sample-full](./sample-configs/.env-sample-full) |
80-
</details>
121+
3. Delete the instance profile and IAM role
81122
123+
```bash
124+
aws iam delete-instance-profile --instance-profile-name Cloud9-Developer-Access
125+
aws iam delete-role --role-name Cloud9-Developer-Access
126+
```

0 commit comments

Comments
 (0)