Skip to content

Commit

Permalink
Add application identity/gateway information (resolves #241) (#247)
Browse files Browse the repository at this point in the history
Signed-off-by: Simon Stone <[email protected]>
  • Loading branch information
Simon Stone authored May 26, 2020
1 parent 9ca88e1 commit 3d40df8
Show file tree
Hide file tree
Showing 5 changed files with 65 additions and 304 deletions.
24 changes: 12 additions & 12 deletions docs/source/tutorials/building.rst
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,7 @@ Here are the Ansible playbooks that were executed by the script above:
::

ansible-playbook 01-create-ordering-organization-components.yml --extra-vars "@ordering-org-vars.yml"
ansible-playbook 01-create-ordering-organization-components.yml --extra-vars "@ordering-org-vars.yml" --extra-vars "@common-vars.yml"

| This playbook creates the components for the ordering organization `Ordering Org`. It makes use of the Ansible role `ordering_organization <../roles/ordering_organization.html>`_ to set up the certificate authority, organization (MSP) and ordering service for this organization, along with the administrator identities for this organization.
Expand All @@ -184,7 +184,7 @@ Here are the Ansible playbooks that were executed by the script above:
::

ansible-playbook 02-create-endorsing-organization-components.yml --extra-vars "@org1-vars.yml"
ansible-playbook 02-create-endorsing-organization-components.yml --extra-vars "@org1-vars.yml" --extra-vars "@common-vars.yml"

| This playbook creates the components for the endorsing organization `Org1`. It makes use of the Ansible role `endorsing_organization <../roles/endorsing_organization.html>`_ to set up the certificate authority, organization (MSP) and peer for this organization, along with the administrator identities for this organization.
Expand All @@ -195,7 +195,7 @@ Here are the Ansible playbooks that were executed by the script above:
::

ansible-playbook 03-export-organization.yml --extra-vars "@org1-vars.yml"
ansible-playbook 03-export-organization.yml --extra-vars "@org1-vars.yml" --extra-vars "@common-vars.yml"

| This playbook uses the Ansible module `organization_info <../modules/organization_info.html>`_ to export the organization `Org1` to a file. This is so that `Org1` can pass this file to the ordering organization `Ordering Org`. `Ordering Org` can then import this file into their IBM Blockchain Platform console, so they can add `Org1` into the consortium for the ordering service.
Expand All @@ -208,7 +208,7 @@ Here are the Ansible playbooks that were executed by the script above:
::

ansible-playbook 04-import-organization.yml --extra-vars "@ordering-org-vars.yml"
ansible-playbook 04-import-organization.yml --extra-vars "@ordering-org-vars.yml" --extra-vars "@common-vars.yml"

| This playbook uses the Ansible module `external_organization <../modules/external_organization.html>`_ to import the organization `Org1` from a file. This file was passed to `Ordering Org` by `Org1`, so that `Ordering Org` could add `Org1` into the consortium for the ordering service.
Expand All @@ -221,7 +221,7 @@ Here are the Ansible playbooks that were executed by the script above:
::

ansible-playbook 05-add-organization-to-consortium.yml --extra-vars "@ordering-org-vars.yml"
ansible-playbook 05-add-organization-to-consortium.yml --extra-vars "@ordering-org-vars.yml" --extra-vars "@common-vars.yml"

| This playbook adds the organization `Org1` into the consortium for the ordering service. It uses the Ansible modules `channel_config <../modules/channel_config.html>`_ and `consortium_member <../modules/consortium_member.html>`_ to update the system channel configuration, which contains the list of consortium members.
Expand All @@ -232,7 +232,7 @@ Here are the Ansible playbooks that were executed by the script above:
::

ansible-playbook 06-export-ordering-service.yml --extra-vars "@ordering-org-vars.yml"
ansible-playbook 06-export-ordering-service.yml --extra-vars "@ordering-org-vars.yml" --extra-vars "@common-vars.yml"

| This playbook uses the Ansible module `ordering_service_info <../modules/ordering_service_info.html>`_ to export the ordering service to a file. This is so that `Ordering Org` can pass this file to the organization `Org1`. `Org1` can then import this file into their IBM Blockchain Platform console, so they can start to create channels on the ordering service.
Expand All @@ -245,7 +245,7 @@ Here are the Ansible playbooks that were executed by the script above:
::

ansible-playbook 07-import-ordering-service.yml --extra-vars "@org1-vars.yml"
ansible-playbook 07-import-ordering-service.yml --extra-vars "@org1-vars.yml" --extra-vars "@common-vars.yml"

| This playbook uses the Ansible module `external_ordering_service <../modules/external_ordering_service.html>`_ to import the ordering service from a file. This file was passed to `Org1` by `Ordering Org`, so that `Org1` could start to create channels on the ordering service.
Expand All @@ -258,7 +258,7 @@ Here are the Ansible playbooks that were executed by the script above:
::

ansible-playbook 08-create-channel.yml --extra-vars "@org1-vars.yml"
ansible-playbook 08-create-channel.yml --extra-vars "@org1-vars.yml" --extra-vars "@common-vars.yml"

| This playbook creates a channel called `mychannel` on the ordering service. The channel contains a single organization, `Org1`. The policies for this channel are supplied in policy files:
Expand All @@ -276,7 +276,7 @@ Here are the Ansible playbooks that were executed by the script above:
::

ansible-playbook 09-join-peer-to-channel.yml --extra-vars "@org1-vars.yml"
ansible-playbook 09-join-peer-to-channel.yml --extra-vars "@org1-vars.yml" --extra-vars "@common-vars.yml"

| This playbook uses the Ansible module `channel_block <../modules/channel_block.html>`_ to fetch the genesis block for the channel, before using the Ansible module `peer_channel <../modules/peer_channel.html>`_ to join the peer `Org1 Peer` to the channel.
Expand All @@ -287,7 +287,7 @@ Here are the Ansible playbooks that were executed by the script above:
::

ansible-playbook 10-add-anchor-peer-to-channel.yml --extra-vars "@org1-vars.yml"
ansible-playbook 10-add-anchor-peer-to-channel.yml --extra-vars "@org1-vars.yml" --extra-vars "@common-vars.yml"

| This playbook updates the organization (MSP) definition for `Org1` in the channel `mychannel` to specify that the peer `Org1 Peer` is an anchor peer for the channel. It uses the Ansible modules `channel_config <../modules/channel_config.html>`_ and `channel_member <../modules/channel_member.html>`_ to update the channel configuration.
Expand All @@ -300,7 +300,7 @@ Finally, there are also two Ansible playbooks that can be used to destroy the ne
::

ansible-playbook 97-delete-endorsing-organization-components.yml --extra-vars "@org1-vars.yml"
ansible-playbook 97-delete-endorsing-organization-components.yml --extra-vars "@org1-vars.yml" --extra-vars "@common-vars.yml"

| This playbook deletes the components for the endorsing organization `Org1`. It makes use of the Ansible role `endorsing_organization <../roles/endorsing_organization.html>`_ to remove the certificate authority, organization (MSP) and peer for this organization, along with the administrator identities for this organization.
Expand All @@ -313,7 +313,7 @@ Finally, there are also two Ansible playbooks that can be used to destroy the ne
::

ansible-playbook 99-delete-ordering-organization-components.yml --extra-vars "@ordering-org-vars.yml"
ansible-playbook 99-delete-ordering-organization-components.yml --extra-vars "@ordering-org-vars.yml" --extra-vars "@common-vars.yml"

| This playbook deletes the components for the ordering organization `Ordering Org`. It makes use of the Ansible role `ordering_organization <../roles/ordering_organization.html>`_ to remove up the certificate authority, organization (MSP) and ordering service for this organization, along with the administrator identities for this organization.
Expand Down
48 changes: 43 additions & 5 deletions docs/source/tutorials/deploying.rst
Original file line number Diff line number Diff line change
Expand Up @@ -43,10 +43,26 @@ If you have installed the collection by building a Docker image, then run the sc

docker run --rm -v "$PWD:/tutorials" mydockerorg/ansible /tutorials/deploy_smart_contract.sh

Exploring the network
---------------------

The Ansible playbooks that you just ran installed the FabCar smart contract onto the peers `Org1 Peer` and `Org2 Peer`. The Ansible playbooks also instantiated the FabCar smart contract on the channel `mychannel`.

At this point, the FabCar smart contract is deployed and ready for applications to connect to the network and submit transactions. An application that wishes to connect to the network requires two things: an identity and a connection profile. The connection profile is a JSON document that provides the application with a list of endpoints or URLs that the application can use to connect to the network.

The Ansible playbooks registered an application identity for each organization. The organization `Org1` has an application identity named `org1app`, with an enrollment secret of `org1apppw`. The organization `Org2` has an application identity named `org2app`, with an enrollment secret of `org2apppw`. You can use this information to enroll the identity against the respective organizations certificate authority, `Org1 CA` or `Org2 CA`.

The Ansible playbooks created a connection profile for each organization. These connection profiles are created on disk, as JSON files in the same directory as the playbooks. The connection profiles are:

- `Org1 Gateway.json`
- `Org2 Gateway.json`

An application that uses one of the available Fabric SDKs (Go, Java, or Node.js) can use the identity and connection profile for an organization to connect to the network and submit a transaction. You could also try using the `IBM Blockchain Platform extension for Visual Studio Code <https://marketplace.visualstudio.com/items?itemName=IBMBlockchain.ibm-blockchain-platform>`_ to connect to the network and submit a transaction.

Exploring the playbooks
-----------------------

When you ran the script `join_network.sh`, you ran multiple Ansible playbooks. Each Ansible playbook performed a different part of joining the network. This section will explain which organization ran each Ansible playbook, and what each of the playbooks did.
When you ran the script `deploy_smart_contract.sh`, you ran multiple Ansible playbooks. Each Ansible playbook performed a different part of deploying the smart contract. This section will explain which organization ran each Ansible playbook, and what each of the playbooks did.

Here are the Ansible playbooks that were executed by the script above:

Expand All @@ -57,7 +73,7 @@ Here are the Ansible playbooks that were executed by the script above:
::

ansible-playbook 18-install-chaincode.yml --extra-vars "@org1-vars.yml"
ansible-playbook 18-install-chaincode.yml --extra-vars "@org1-vars.yml" --extra-vars "@common-vars.yml"

| This playbook uses the Ansible module `installed_chaincode <../modules/installed_chaincode.html>`_ to install the FabCar smart contract onto the peer `Org1 Peer`.
Expand All @@ -68,7 +84,7 @@ Here are the Ansible playbooks that were executed by the script above:
::

ansible-playbook 19-install-chaincode.yml --extra-vars "@org2-vars.yml"
ansible-playbook 19-install-chaincode.yml --extra-vars "@org2-vars.yml" --extra-vars "@common-vars.yml"

| This playbook uses the Ansible module `installed_chaincode <../modules/installed_chaincode.html>`_ to install the FabCar smart contract onto the peer `Org2 Peer`.
Expand All @@ -79,6 +95,28 @@ Here are the Ansible playbooks that were executed by the script above:
::

ansible-playbook 20-instantiate-chaincode.yml --extra-vars "@org1-vars.yml"
ansible-playbook 20-instantiate-chaincode.yml --extra-vars "@org1-vars.yml" --extra-vars "@common-vars.yml"

| This playbook uses the Ansible module `instantiated_chaincode <../modules/instantiated_chaincode.html>`_ to instantiate the FabCar smart contract on the channel `mychannel`.
* `21-register-application.yml <https://github.com/IBM-Blockchain/ansible-collection/blob/master/tutorial/21-register-application.yml>`_

| Organization: Org1
| Command:
::

ansible-playbook 21-register-application.yml --extra-vars "@org1-vars.yml" --extra-vars "@common-vars.yml"

| This playbook uses the Ansible module `registered_identity <../modules/registered_identity.html>`_ to register a new identity in the certificate authority `Org1 CA`. This playbook also uses the Ansible module `connection_profile <../modules/connection_profile.html>`_ to create a connection profile for the organization `Org1`. The identity and the connection profile can be used by the organizations FabCar applications to interact with the network and smart contract.
* `22-register-application.yml <https://github.com/IBM-Blockchain/ansible-collection/blob/master/tutorial/22-register-application.yml>`_

| Organization: Org2
| Command:
::

ansible-playbook 22-register-application.yml --extra-vars "@org1-vars.yml" --extra-vars "@common-vars.yml"

| This playbook uses the Ansible module `instantiated_chaincode <../modules/instantiated_chaincode.html>`_ to instantiate the FabCar smart contract on the channel `mychannel`.
| This playbook uses the Ansible module `registered_identity <../modules/registered_identity.html>`_ to register a new identity in the certificate authority `Org2 CA`. This playbook also uses the Ansible module `connection_profile <../modules/connection_profile.html>`_ to create a connection profile for the organization `Org2`. The identity and the connection profile can be used by the organizations FabCar applications to interact with the network and smart contract.
16 changes: 8 additions & 8 deletions docs/source/tutorials/joining.rst
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ Here are the Ansible playbooks that were executed by the script above:
::

ansible-playbook 11-create-endorsing-organization-components.yml --extra-vars "@org2-vars.yml"
ansible-playbook 11-create-endorsing-organization-components.yml --extra-vars "@org2-vars.yml" --extra-vars "@common-vars.yml"

| This playbook creates the components for the endorsing organization `Org2`. It makes use of the Ansible role `endorsing_organization <../roles/endorsing_organization.html>`_ to set up the certificate authority, organization (MSP) and peer for this organization, along with the administrator identities for this organization.
Expand All @@ -151,7 +151,7 @@ Here are the Ansible playbooks that were executed by the script above:
::

ansible-playbook 12-export-organization.yml --extra-vars "@org2-vars.yml"
ansible-playbook 12-export-organization.yml --extra-vars "@org2-vars.yml" --extra-vars "@common-vars.yml"

| This playbook uses the Ansible module `organization_info <../modules/organization_info.html>`_ to export the organization `Org2` to a file. This is so that `Org2` can pass this file to the endorsing organization `Org1`. `Org1` can then import this file into their IBM Blockchain Platform console, so they can add `Org2` into the existing channel `mychannel`.
Expand All @@ -164,7 +164,7 @@ Here are the Ansible playbooks that were executed by the script above:
::

ansible-playbook 13-import-organization.yml --extra-vars "@org1-vars.yml"
ansible-playbook 13-import-organization.yml --extra-vars "@org1-vars.yml" --extra-vars "@common-vars.yml"

| This playbook uses the Ansible module `external_organization <../modules/external_organization.html>`_ to import the organization `Org2` from a file. This file was passed to `Org1` by `Org2`, so that `Org1` could add `Org2` into the existing channel `mychannel`.
Expand All @@ -177,7 +177,7 @@ Here are the Ansible playbooks that were executed by the script above:
::

ansible-playbook 14-add-organization-to-channel.yml --extra-vars "@org1-vars.yml"
ansible-playbook 14-add-organization-to-channel.yml --extra-vars "@org1-vars.yml" --extra-vars "@common-vars.yml"

| This playbook adds the organization `Org2` into the existing channel `Org1`. The channel now contains two organizations, `Org1` and `Org2`. The policies for this channel are updated, using new policies that are supplied in policy files:
Expand All @@ -195,7 +195,7 @@ Here are the Ansible playbooks that were executed by the script above:
::

ansible-playbook 15-import-ordering-service.yml --extra-vars "@org2-vars.yml"
ansible-playbook 15-import-ordering-service.yml --extra-vars "@org2-vars.yml" --extra-vars "@common-vars.yml"

| This playbook uses the Ansible module `external_ordering_service <../modules/external_ordering_service.html>`_ to import the ordering service from a file. This file was passed to `Org2` by `Org1`, so that `Org2` could start to join channels on the ordering service.
Expand All @@ -208,7 +208,7 @@ Here are the Ansible playbooks that were executed by the script above:
::

ansible-playbook 16-join-peer-to-channel.yml --extra-vars "@org2-vars.yml"
ansible-playbook 16-join-peer-to-channel.yml --extra-vars "@org2-vars.yml" --extra-vars "@common-vars.yml"

| This playbook uses the Ansible module `channel_block <../modules/channel_block.html>`_ to fetch the genesis block for the channel, before using the Ansible module `peer_channel <../modules/peer_channel.html>`_ to join the peer `Org2 Peer` to the channel.
Expand All @@ -219,7 +219,7 @@ Here are the Ansible playbooks that were executed by the script above:
::

ansible-playbook 17-add-anchor-peer-to-channel.yml --extra-vars "@org2-vars.yml"
ansible-playbook 17-add-anchor-peer-to-channel.yml --extra-vars "@org2-vars.yml" --extra-vars "@common-vars.yml"

| This playbook updates the organization (MSP) definition for `Org2` in the channel `mychannel` to specify that the peer `Org2 Peer` is an anchor peer for the channel. It uses the Ansible modules `channel_config <../modules/channel_config.html>`_ and `channel_member <../modules/channel_member.html>`_ to update the channel configuration.
Expand All @@ -232,7 +232,7 @@ Finally, there is one Ansible playbook that can be used to destroy the network c
::

ansible-playbook 98-delete-endorsing-organization-components.yml --extra-vars "@org2-vars.yml"
ansible-playbook 98-delete-endorsing-organization-components.yml --extra-vars "@org2-vars.yml" --extra-vars "@common-vars.yml"

| This playbook deletes the components for the endorsing organization `Org2`. It makes use of the Ansible role `endorsing_organization <../roles/endorsing_organization.html>`_ to remove the certificate authority, organization (MSP) and peer for this organization, along with the administrator identities for this organization.
Expand Down
2 changes: 1 addition & 1 deletion galaxy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
---
namespace: ibm
name: blockchain_platform
version: 0.0.21
version: 0.0.22
readme: README.md
authors:
- Simon Stone
Expand Down
Loading

0 comments on commit 3d40df8

Please sign in to comment.