Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Indy private #69

Open
wants to merge 39 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 13 commits
Commits
Show all changes
39 commits
Select commit Hold shift + click to select a range
9d0b66e
Website. Bug fixes and addition of gtag manager
vlasonfa Jan 19, 2024
73241d1
Ethereum single node deployemnt option for issue #19
vlasonfa Jan 23, 2024
f435bfa
Single node Ethereum setup - add diagram to the Readme file
vlasonfa Jan 23, 2024
7f8ae91
add Indy Node sample
KatsuyaMatsuoka Jan 18, 2024
bc3c392
Merge branch 'aws-samples:main' into main
KatsuyaMatsuoka Jan 25, 2024
888cb84
Merge remote-tracking branch 'remotes/upstream/main'
fsatsuki Mar 17, 2024
88621a9
Change indy's build procedure to ansible
fsatsuki Mar 18, 2024
2537bdd
Merge branch 'aws-samples:main' into main
fsatsuki Mar 18, 2024
034da99
Merge branch 'main' of https://github.com/KatsuyaMatsuoka/aws-blockch…
fsatsuki Mar 18, 2024
6d9f963
change security group rule fo indy
fsatsuki Mar 18, 2024
4ffb925
Merge pull request #40 from KatsuyaMatsuoka/main
frbrkoala Apr 5, 2024
a0c5a66
Merge branch 'main' into indy-private
vlasonfa Apr 15, 2024
16acd04
Merge branch 'main' into indy-private
vlasonfa Apr 17, 2024
5d48882
Indy. Refactoring
vlasonfa Apr 17, 2024
25436c5
Indy. Added gitignore for python venv
vlasonfa Apr 17, 2024
495062f
Indy. Refactored CDK outputs from constructs for simpler properties e…
vlasonfa Apr 17, 2024
9668f9f
Indy. Refactoring ansible configuration for simplicity and automation
vlasonfa Apr 17, 2024
085528e
Indy. Fixing bugs in ansible inventory template file
vlasonfa Apr 18, 2024
31da2e0
cdk-nag check
fsatsuki Apr 26, 2024
75a2c7b
Merge branch 'aws-samples:main' into cdk-nag
fsatsuki Apr 26, 2024
266b128
Merge pull request #73 from fsatsuki/cdk-nag
frbrkoala May 6, 2024
42e4a85
Indy. Refactoring code and README
vlasonfa May 7, 2024
bec7729
Indy. Debugging initial deployment.
vlasonfa May 7, 2024
8e755b7
Indy. Fixed commands in README
vlasonfa May 8, 2024
9e54a46
fix ansible build failed
fsatsuki May 10, 2024
abd529b
Merge branch 'indy-private' into fix_ansible_build_failed_20240509
fsatsuki May 10, 2024
cdbd9f9
run pre-commit
fsatsuki May 10, 2024
eee2a7c
Merge pull request #77 from fsatsuki/fix_ansible_build_failed_20240509
frbrkoala May 13, 2024
7f87bdf
Indy. Ansible configuration is fixed and working.
vlasonfa May 14, 2024
0088f54
Merge branch 'aws-samples:main' into main
KatsuyaMatsuoka May 16, 2024
3af46e3
Merge branch 'indy-private' into cdk-tests
KatsuyaMatsuoka May 16, 2024
719185c
fix architecture diagram
KatsuyaMatsuoka May 16, 2024
439e031
Merge branch 'aws-samples:main' into cdk-tests
KatsuyaMatsuoka Jul 25, 2024
7ef129d
add cdk unit test
KatsuyaMatsuoka Aug 22, 2024
e2b8690
Merge remote-tracking branch 'origin/cdk-tests' into cdk-tests
KatsuyaMatsuoka Aug 22, 2024
7c8eb39
Revert "Merge branch 'aws-samples:main' into cdk-tests"
KatsuyaMatsuoka Aug 22, 2024
6ad1a67
Merge pull request #117 from KatsuyaMatsuoka/cdk-tests
frbrkoala Aug 23, 2024
b67470e
update doc for indy
KatsuyaMatsuoka Sep 5, 2024
a9faed3
Merge pull request #123 from KatsuyaMatsuoka/indy-private
frbrkoala Sep 30, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -35,3 +35,5 @@ ha-nodes-deploy*.json
*.OLD
.env
.idea

lib/indy/ansible/.venv
201 changes: 201 additions & 0 deletions lib/indy/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,201 @@
# Sample AWS Blockchain Node Runner app for Hyperledger Indy

[View this page in Japanese (日本語)](./README_ja.md)

## Architecture Overview

![Architecture](./doc/assets/Architecture.png)
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Need to add client to the architeture to illustrate how customers can connect and use the nodes deployed by the blueprint

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There are also 3 trustee nodes, but only one is shown on the diagram. Is it correct?


This is a sample of building a Hyperledger Indy network on AWS.
The overall architecture is shown below, processing itself is performed by 4 Stewards (Validator Nodes), and network management is performed with Trustee. It consists of 4 EC2 instances for Steward and 3 EC2 instances for Trustee.

## Solution Walkthrough
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please add a section and responses to the Well Architected checklist. See for example:

### Well-Architected Checklist


### Setup Cloud9

We will use AWS Cloud9 to execute the subsequent commands. Follow the instructions in [Cloud9 Setup](../../docs/setup-cloud9.md)

### Clone this repository and install dependencies

```bash
git clone https://github.com/aws-samples/aws-blockchain-node-runners.git
cd aws-blockchain-node-runners
npm install
```

**NOTE:** In this tutorial we will set all major configuration through environment variables, but you also can modify parameters in `config/config.ts`.

### Deploy Indy Nodes

#### Building resources

1. Install npm dependency packages

```bash
cd lib/indy
pwd
# Make sure you are in aws-blockchain-node-runners/lib/indy
npm install
```

2. Setting up initial AWS Cloud Development Kit (CDK)

The following command is executed only when using AWS CDK for the first time in the region where the deployment will be carried out.

```bash
npx cdk bootstrap
```

3. Deploying resources with CDK

```bash
npx cdk deploy

Outputs:
IndyNetworkStack.AnsibleFileTransferBucketName = 111122223333-ansible-file-transfer-bucket
IndyNetworkStack.steward1steward1InstanceId2F9F8910 = i-1234567890abcdef1
IndyNetworkStack.steward2steward2InstanceId995438F2 = i-1234567890abcdef2
IndyNetworkStack.steward3steward3InstanceIdB5D10BBE = i-1234567890abcdef3
IndyNetworkStack.steward4steward4InstanceIdB3DD7753 = i-1234567890abcdef4
IndyNetworkStack.trustee1trustee1InstanceId8FDDE052 = i-1234567890abcdef5
IndyNetworkStack.trustee2trustee2InstanceIdE12079EA = i-1234567890abcdef6
IndyNetworkStack.trustee3trustee3InstanceId508C4E4C = i-1234567890abcdef7
```

**NOTE:** User data for the Steward instance is created by referring to [the Community Docs](https://github.com/hyperledger/indy-node/blob/main/docs/source/install-docs/AWS-NodeInstall-20.04.md).

#### Building an environment using Ansible

When running on a Mac, set the following environment variables.

> export OBJC_DISABLE_INITIALIZE_FORK_SAFETY=YES


##### Preparing for Ansible

- Create a Python virtual environment and install ansible
```
$cd ansible
$ Python3 -m venv.venv
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

When running python3 -m venv.venv command on Cliud9 instance getting /usr/bin/python3: No module named venv.venv

$source.venv/bin/activate
```

```
$ pip install -r requirements.txt
```

##### Ansible and Session Manager

- In order to achieve SSH access to the EC2 instance using Session Manager, refer to [Install the Session Manager plugin for the AWS CLI](https://docs.aws.amazon.com/systems-manager/latest/userguide/session-manager-working-with-install-plugin.html) and install the Session Manager Plugin. By using the Session Manager, deployment by Ansible to an EC2 instance of a private subnet that cannot be accessed from the internet is possible without setting a security group.

- Installs a ansible plug-in for SSH access to EC2 using the AWS Systems Manager Session Manager.
```
$ ansible-galaxy collection install community.aws
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks redundant. Message says: Starting galaxy collection install process Nothing to do. All requested collections are already installed. If you want to reinstall them, consider using --force.

```

##### Describe instance information to be built in inventory.yml

- Create an indentory file containing information on the EC2 instance that will build the environment. Enter the instance ID described in the CDK output results in the settings column for each node. The value of `indyNetworkStack.ansibleFileTransferBucketName` described in CDK output results is inputted to `ansible_aws_ssm_bucket_name`. When Ansible transfers files to the target host, the Amazon Simple Storage Service (Amazon S3) bucket specified here is used.

```
$ vi inventory/inventory.yml
all:
hosts:
steward1:
ansible_aws_ssm_instance_id: i-1234567890abcdef1
steward2:
ansible_aws_ssm_instance_id: i-1234567890abcdef2
steward3:
ansible_aws_ssm_instance_id: i-1234567890abcdef3
steward4:
ansible_aws_ssm_instance_id: i-1234567890abcdef4
trustee1:
ansible_aws_ssm_instance_id: i-1234567890abcdef5
trustee2:
ansible_aws_ssm_instance_id: i-1234567890abcdef6
trustee3:
ansible_aws_ssm_instance_id: i-1234567890abcdef7
children:
steward:
hosts:
steward[1:4]:
trustee:
hosts:
trustee1

vars:
ansible_connection: aws_ssm
ansible_aws_ssm_region: aa-example-1
ansible_aws_ssm_s3_addressing_style: virtual
ansible_aws_ssm_bucket_name: 111122223333-ansible-file-transfer-bucket
```


##### Ansible parameter settings
Define the parameters referred to by Ansible in the configuration file. Set Indy's network name

```
$ vi inventory/group_vars/all.yml
INDY_NETEORK_NAME: sample-network
```

##### Execute environment construction with Ansible

- Use ansible's `ping` module to confirm that ansible can connect to the instance set in inventory/inventory.yml

```
$ ansible -m ping all -i inventory/inventory.yml
steward2 | SUCCESS => {
"changed": false,
"ping": "pong"
}
steward3 | SUCCESS => {
"changed": false,
"ping": "pong"
}
trustee1 | SUCCESS => {
"changed": false,
"ping": "pong"
}
steward4 | SUCCESS => {
"changed": false,
"ping": "pong"
}
trustee2 | SUCCESS => {
"changed": false,
"ping": "pong"
}
trustee3 | SUCCESS => {
"changed": false,
"ping": "pong"
}
steward1 | SUCCESS => {
"changed": false,
"ping": "pong"
}
```

- Execute Hyperledger Indy environment construction for target EC2 instances defined in `inventory/inventory.yml` in ansible
```
$ ansible-playbook playbook/site.yml
```

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Need to add instructions how customers can use those nodes. The simplest might be to show how to access nodes API from the Cloud9 instance the blueprint was deployed from.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

add instruction on #123


#### reference information

- [Buidling Indy Network](https://github.com/pSchlarb/indy-node/blob/documentationUpdate/docs/source/NewNetwork/NewNetwork.md)
- [Setting up EC2 instances for Indy Node](https://github.com/hyperledger/indy-node/blob/main/docs/source/install-docs/AWS-NodeInstall-20.04.md)
- [Setting up Indy Node](https://github.com/pSchlarb/indy-node/blob/documentationUpdate/docs/source/installation-and-configuration.md)

### Considerations

Matters to be examined in additional development etc. when using this sample are described.

- Change the instance type to M
- Currently, it is a T instance, but in production environments, it is recommended to change to M
- Fix the security group for Node NICs attached to Steward (Validator Node)
- Limit source IPs to node IPs of other nodes (currently open within VPC and can also be accessed by clients)
- Fix Node's private IP
- If necessary, change the subnet to which the node belongs to a public subnet
- Make Steward and Node separate instances
Loading
Loading