Skip to content

Commit

Permalink
Merge branch 'develop' into cordaent-2586
Browse files Browse the repository at this point in the history
  • Loading branch information
sownak authored Jul 29, 2024
2 parents df674ba + 9a95ba2 commit 53ec9ea
Show file tree
Hide file tree
Showing 51 changed files with 979 additions and 326 deletions.
23 changes: 15 additions & 8 deletions docs/source/guides/fabric/add-cli.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,29 +22,36 @@ This guide explains how to add a CLI to an existing Hyperledger Fabric network u
1. **Update Configuration File**

- Edit the `network.yaml` file to include the new organization with the following details:
- `peerstatus: new`
- `cli: enabled`
- `org_status: new`
- Organization details (name, MSP ID, etc.)
- Orderer information
- Existing organizations should have `org_status: existing`
- Existing peer(s) with cli deployed should have `peerstatus: existing`
- Refer to the [networkyaml-fabric.md](../networkyaml-fabric.md) guide for details on editing the configuration file.

Snippet from `network.channels` section below:
```yaml
--8<-- "platforms/hyperledger-fabric/configuration/samples/network-fabric-add-organization.yaml:65:139"
--8<-- "platforms/hyperledger-fabric/configuration/samples/network-fabric-add-cli.yaml:57:105"
```

and from `network.organizations` section below:

```yaml
--8<-- "platforms/hyperledger-fabric/configuration/samples/network-fabric-add-organization.yaml:143:155"
..
..
--8<-- "platforms/hyperledger-fabric/configuration/samples/network-fabric-add-organization.yaml:406:414"
..
..
--8<-- "platforms/hyperledger-fabric/configuration/samples/network-fabric-add-cli.yaml:107:122"
..
..
--8<-- "platforms/hyperledger-fabric/configuration/samples/network-fabric-add-cli.yaml:161:161"
--8<-- "platforms/hyperledger-fabric/configuration/samples/network-fabric-add-cli.yaml:171:177"
..
..
--8<-- "platforms/hyperledger-fabric/configuration/samples/network-fabric-add-cli.yaml:203:209"
..
..
```

1. **Run Playbook**
2. **Run Playbook**

Execute the following command to run the `add-cli.yaml` playbook:

Expand Down
28 changes: 14 additions & 14 deletions docs/source/guides/fabric/add-new-peer.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,9 @@ This guide explains how to add a new **general** (non-anchor) peer to an existin
- There is a single Hashicorp Vault and both clusters (as well as ansible controller) can access it.
- Admin User certs have been already generated and stored in Vault (this is taken care of by deploy-network.yaml playbook if you are using Bevel to setup the network).
- The `network.env.type` is different for different clusters.
- The GitOps release directory `gitops.release_dir` is different for different clusters.
- The GitOps release directory `gitops.release_dir` and `gitops.component_dir` are different for different clusters.

1. **Update Configuration File**
2. **Update Configuration File**

- Edit the `network.yaml` file to include the new peer with the following details:
- `peerstatus: new`
Expand All @@ -41,25 +41,25 @@ This guide explains how to add a new **general** (non-anchor) peer to an existin

Snippet from `network.channels` section below:
```yaml
--8<-- "platforms/hyperledger-fabric/configuration/samples/network-fabric-add-peer.yaml:60:87"
--8<-- "platforms/hyperledger-fabric/configuration/samples/network-fabric-add-peer.yaml:57:105"
```

and from `network.organizations` section below:

```yaml
--8<-- "platforms/hyperledger-fabric/configuration/samples/network-fabric-add-peer.yaml:94:103"
..
..
--8<-- "platforms/hyperledger-fabric/configuration/samples/network-fabric-add-peer.yaml:144:144"
--8<-- "platforms/hyperledger-fabric/configuration/samples/network-fabric-add-peer.yaml:153:159"
..
..
--8<-- "platforms/hyperledger-fabric/configuration/samples/network-fabric-add-peer.yaml:187:192"
..
..
--8<-- "platforms/hyperledger-fabric/configuration/samples/network-fabric-add-peer.yaml:107:122"
..
..
--8<-- "platforms/hyperledger-fabric/configuration/samples/network-fabric-add-peer.yaml:161:161"
--8<-- "platforms/hyperledger-fabric/configuration/samples/network-fabric-add-peer.yaml:171:177"
..
..
--8<-- "platforms/hyperledger-fabric/configuration/samples/network-fabric-add-peer.yaml:203:209"
..
..
```

1. **Run Playbook**
3. **Run Playbook**

Execute the following command to run the `add-peer.yaml` playbook:

Expand Down
14 changes: 8 additions & 6 deletions docs/source/guides/networkyaml-fabric.md
Original file line number Diff line number Diff line change
Expand Up @@ -165,6 +165,7 @@ Each `organization` field under `participants` field of the channel contains the
| org_status | `new` (for inital setup) or `existing` (for add new org) |
| ordererAddress | URL of the orderer this peer connects to, including port |
| peer.name | Name of the peer |
| peer.type | Type can be `anchor` and `nonanchor` for Peer |
| peer.gossipAddress | Gossip address of the peer, including port |
| peer.peerAddress | External address of the peer, including port |

Expand Down Expand Up @@ -242,7 +243,7 @@ The `vault` field under each organization contains
For gitops fields the snapshot from the sample configuration file with the example values is below

```yaml
--8<-- "platforms/hyperledger-fabric/configuration/samples/network-fabricv2.yaml:203:215"
--8<-- "platforms/hyperledger-fabric/configuration/samples/network-fabricv2.yaml:203:216"
```

The gitops field under each organization contains
Expand All @@ -253,6 +254,7 @@ The gitops field under each organization contains
| git_url | SSH or HTTPs url of the repository where flux should be synced |
| branch | Branch of the repository where the Helm Charts and value files are stored |
| release_dir | Relative path where flux should sync files |
| component_dir | Relative path where values files are stored.files |
| chart_source | Relative path where the helm charts are stored |
| git_repo | Gitops git repo URL https URL for git push like "github.com/hyperledger/bevel.git" |
| username | Username which has access rights to read/write on repository |
Expand All @@ -263,7 +265,7 @@ The gitops field under each organization contains
For Hyperledger Fabric, you can also generate different user certificates and pass the names and attributes in the specific section for `users`. This is only applicable if using Fabric CA. An example is below:

```yaml
--8<-- "platforms/hyperledger-fabric/configuration/samples/network-fabricv2.yaml:338:344"
--8<-- "platforms/hyperledger-fabric/configuration/samples/network-fabricv2.yaml:340:346"
```

The fields under `user` are
Expand All @@ -279,7 +281,7 @@ The services field for each organization under `organizations` section of Fabric
Each organization will have a CA service under the service field. The snapshot of CA service with example values is below

```yaml
--8<-- "platforms/hyperledger-fabric/configuration/samples/network-fabricv2.yaml:217:225"
--8<-- "platforms/hyperledger-fabric/configuration/samples/network-fabricv2.yaml:218:226"
```

The fields under `ca` service are
Expand All @@ -295,7 +297,7 @@ The fields under `ca` service are
Example of peer service. Below is a snapshot of the peer service with example values.

```yaml
--8<-- "platforms/hyperledger-fabric/configuration/samples/network-fabricv2.yaml:354:387"
--8<-- "platforms/hyperledger-fabric/configuration/samples/network-fabricv2.yaml:356:389"
```

The fields under `peer` service are
Expand Down Expand Up @@ -342,7 +344,7 @@ The chaincodes section contains the list of chaincode for the peer, the fields u
The organization with orderer type will have concensus service. The snapshot of consensus service with example values is below

```yaml
--8<-- "platforms/hyperledger-fabric/configuration/samples/network-fabricv2.yaml:227:228"
--8<-- "platforms/hyperledger-fabric/configuration/samples/network-fabricv2.yaml:228:229"
```

The fields under `consensus` service are
Expand All @@ -357,7 +359,7 @@ The fields under `consensus` service are
Example of ordering service. The snapshot of orderers service with example values is below

```yaml
--8<-- "platforms/hyperledger-fabric/configuration/samples/network-fabricv2.yaml:229:253"
--8<-- "platforms/hyperledger-fabric/configuration/samples/network-fabricv2.yaml:230:254"
```

The fields under `orderer` service are
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,6 @@ apiVersion: v1
name: besu-cacti-connector
description: "Hyperledger Besu: Deploys Cactus Besu Connector"
type: application
version: 1.0.0
version: 1.1.0
# For Cactus release 1.1.3
appVersion: "1.1.3"
2 changes: 1 addition & 1 deletion platforms/hyperledger-besu/charts/besu-genesis/Chart.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
apiVersion: v1
name: besu-genesis
description: "Hyperledger Besu: Genesis generator"
version: 1.0.0
version: 1.1.0
appVersion: latest
keywords:
- bevel
Expand Down
2 changes: 1 addition & 1 deletion platforms/hyperledger-besu/charts/besu-node/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
apiVersion: v1
name: besu-node
description: Hyperledger Besu nodes for a POA network
version: 1.0.1
version: 1.1.0
appVersion: latest
keywords:
- bevel
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
apiVersion: v1
name: besu-propose-validator
description: "besu: Proposes to add or remove a validator with the specified address."
version: 1.0.1
version: 1.1.0
appVersion: latest
keywords:
- bevel
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
apiVersion: v1
name: besu-tessera-node
description: "Hyperledger Besu: Deploys Tessera transaction manager nodes"
version: 1.0.1
version: 1.1.0
# Tessera version
appVersion: '21.7.3'
keywords:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
apiVersion: v1
name: besu-tlscert-gen
description: "Hyperledger Besu: Generates and stores TLS certificates for nodes and tessera"
version: 1.0.0
version: 1.1.0
appVersion: latest
keywords:
- bevel
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
#
# SPDX-License-Identifier: Apache-2.0
##############################################################################################
{{- if eq .Values.peer.type "anchor" }}
{{- if and (eq .Values.peer.type "anchor") (not .Values.peer.addPeerValue) }}
apiVersion: batch/v1
kind: Job
metadata:
Expand Down
2 changes: 1 addition & 1 deletion platforms/hyperledger-fabric/configuration/add-cli.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
loop: "{{ network.organizations }}"
loop_control:
loop_var: org
when: org.type == "peer" and org.org_status == "new"
when: org.services.peers is defined and org.services.peers | length > 0 and org.org_status == "new"

vars: #These variables can be overriden from the command line
privilege_escalate: false #Default to NOT escalate to root privledges
Expand Down
107 changes: 15 additions & 92 deletions platforms/hyperledger-fabric/configuration/add-peer.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -25,76 +25,7 @@
file:
path: "./build"
state: absent
# Create Namespaces and Vault-rbac kubernetes-value files for new organization
- include_role:
name: "create/namespace"
vars:
component_name: "{{ item.name | lower }}-net"
component_type_name: "{{ item.type | lower }}"
kubernetes: "{{ item.k8s }}"
release_dir: "{{playbook_dir}}/../../../{{item.gitops.release_dir}}/{{ item.name | lower }}"
loop: "{{ network['organizations'] }}"

# Setup script for Vault and OS Package Manager
- name: "Setup script for Vault and OS Package Manager"
include_role:
name: "{{ playbook_dir }}/../../shared/configuration/roles/setup/scripts"
vars:
namespace: "{{ org.name | lower }}-net"
kubernetes: "{{ org.k8s }}"
loop: "{{ network['organizations'] }}"
loop_control:
loop_var: org
when: org.org_status == 'new'

# Setup Vault-Kubernetes accesses and Regcred for docker registry for new organization
- include_role:
name: "{{ playbook_dir }}/../../shared/configuration/roles/setup/vault_kubernetes"
vars:
name: "{{ org.name | lower }}"
component_name: "{{ org.name | lower }}-vaultk8s-job"
component_type: "{{ org.type | lower }}"
component_ns: "{{ org.name | lower }}-net"
component_auth: "{{ network.env.type }}{{ name }}"
kubernetes: "{{ org.k8s }}"
vault: "{{ org.vault }}"
gitops: "{{ org.gitops }}"
reset_path: "platforms/hyperledger-fabric/configuration"
loop: "{{ network['organizations'] }}"
loop_control:
loop_var: org
when: org.org_status == 'new'

# Create Storageclass for new organization
- include_role:
name: "{{ playbook_dir }}/../../../platforms/shared/configuration/roles/setup/storageclass"
vars:
org_name: "{{ org.name | lower }}"
sc_name: "{{ org_name }}-bevel-storageclass"
region: "{{ org.k8s.region | default('eu-west-1') }}"
loop: "{{ network['organizations'] }}"
loop_control:
loop_var: org

# Create Organization crypto materials for new organization
- include_role:
name: "create/ca_tools/peer"
vars:
component_name: "{{ item.name | lower}}-net"
component: "{{ item.name | lower}}"
component_type: "{{ item.type | lower}}"
component_services: "{{ item.services }}"
orderer_org: "{{ item.orderer_org | lower }}"
sc_name: "{{ component }}-bevel-storageclass"
kubernetes: "{{ item.k8s }}"
vault: "{{ item.vault }}"
ca: "{{ item.services.ca }}"
docker_url: "{{ network.docker.url }}"
gitops: "{{ item.gitops }}"
values_dir: "{{playbook_dir}}/../../../{{item.gitops.release_dir}}/{{ item.name | lower }}"
loop: "{{ network['organizations'] }}"
when: item.type == 'peer'

# This role fetches block 0 and joins peers of new organizaion to the channel
- include_role:
name: "create/new_peer/update_block"
Expand All @@ -106,22 +37,26 @@

# This role creates the value file for peers of organisations and write couch db credentials
# to the vault.
- include_role:
- name: Create all peers
include_role:
name: "create/peers"
vars:
build_path: "./build"
namespace: "{{ item.name | lower}}-net"
component_type: "{{ item.type | lower}}"
component_services: "{{ item.services }}"
vault: "{{ item.vault }}"
git_protocol: "{{ item.gitops.git_protocol }}"
git_url: "{{ item.gitops.git_url }}"
git_branch: "{{ item.gitops.branch }}"
namespace: "{{ org.name | lower}}-net"
component_type: "{{ org.type | lower}}"
component_services: "{{ org.services }}"
kubernetes: "{{ org.k8s }}"
vault: "{{ org.vault }}"
git_protocol: "{{ org.gitops.git_protocol }}"
git_url: "{{ org.gitops.git_url }}"
git_branch: "{{ org.gitops.branch }}"
docker_url: "{{ network.docker.url }}"
charts_dir: "{{ item.gitops.chart_source }}"
values_dir: "{{playbook_dir}}/../../../{{item.gitops.release_dir}}/{{ item.name | lower }}"
charts_dir: "{{ org.gitops.chart_source }}"
values_dir: "{{playbook_dir}}/../../../{{org.gitops.release_dir}}/{{ org.name | lower }}"
loop: "{{ network['organizations'] }}"
when: item.type == 'peer'
loop_control:
loop_var: org
when: org.services.peers is defined and org.services.peers | length > 0

# This role fetches block 0 and joins peers of new organizaion to the channel
- include_role:
Expand All @@ -132,18 +67,6 @@
docker_url: "{{ network.docker.url }}"
loop: "{{ network['channels'] }}"

# Create CLI pod for peers with cli option enabled
- name: Create CLI pod for each peer when enabled
include_role:
name: "create/cli_pod"
vars:
peers: "{{ org.services.peers }}"
docker_url: "{{ network.docker.url }}"
loop: "{{ network.organizations }}"
loop_control:
loop_var: org
when: org.type == "peer"

vars: #These variables can be overriden from the command line
privilege_escalate: false #Default to NOT escalate to root privledges
install_os: "linux" #Default to linux OS
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@
git_url: "{{ org.gitops.git_url }}"
git_branch: "{{ org.gitops.branch }}"
charts_dir: "{{ org.gitops.chart_source }}"
values_dir: "{{playbook_dir}}/../../../{{org.gitops.release_dir}}/{{ org.name | lower }}"
values_dir: "{{playbook_dir}}/../../../{{org.gitops.component_dir}}/{{ org.name | lower }}"
provider: "{{ org.cloud_provider }}"
vault: "{{ org.vault }}"
kubernetes: "{{ org.k8s }}"
Expand Down
Loading

0 comments on commit 53ec9ea

Please sign in to comment.