Skip to content

Commit

Permalink
Release fixes (hyperledger-archives#2744)
Browse files Browse the repository at this point in the history
* Fix problem with VERSION docker build variable not getting through
to the npm install command

Signed-off-by: James Taylor <[email protected]>

* Update Playground Link

Update the link to the tutorial

Signed-off-by: Caroline Church <[email protected]>

* fixes of name connection profile, TSL -> TLS, s -> z.

Signed-off-by: EdProsser <[email protected]>

* The admin connection needs to be able to take the card for both of the deploy and the network admin card,

The CLI, manually creates it's boot strap transactions - but the std adminAPI doesn't. So the start options that are passed in need to contain the card to be used for the network admin

let card-for-the-network-admin = new IdCard(...)
adminConnection.start({card:card-for-the-network-admin});
adminConnection.deploy({card:card-for-the-network-admin});

Signed-off-by: Matthew B White <[email protected]>
  • Loading branch information
jt-nti authored Nov 16, 2017
1 parent 92020f2 commit f0815dc
Show file tree
Hide file tree
Showing 10 changed files with 34 additions and 36 deletions.
23 changes: 10 additions & 13 deletions packages/composer-admin/lib/adminconnection.js
Original file line number Diff line number Diff line change
Expand Up @@ -461,6 +461,7 @@ class AdminConnection {
* @private
* @param {BusinessNetworkDefinition} businessNetworkDefinition The business network definition.
* @param {Object} [startOptions] The options for starting the business network.
* @param {Object} [startOptions.card] The card to be used as the NetworkAdmin
* @return {Promise} A promise that will be fufilled with the JSON for the start transaction.
*/
_buildStartTransaction(businessNetworkDefinition, startOptions = {}) {
Expand All @@ -473,11 +474,13 @@ class AdminConnection {
return Promise.resolve()
.then(()=>{

if (startOptions.card){
return startOptions.card.getCredentials();
} else {
if (!startOptions.card){
LOG.entry(method,'Should be using card based approach');
// todo in the future throw new Error('A card to use for the NetworkAdmin must be given');
return this._getCurrentIdentity();
}
return startOptions.card.getCredentials();

})
.then((identity) => {

Expand Down Expand Up @@ -552,25 +555,20 @@ class AdminConnection {
* });
* @param {BusinessNetworkDefinition} businessNetworkDefinition - The business network to start
* @param {Object} [startOptions] connector specific start options
* startOptions.card the card to use for the NetworkAdmin
* @return {Promise} A promise that will be fufilled when the business network has been
* deployed.
*/
start(businessNetworkDefinition, startOptions = {}) {
start(businessNetworkDefinition, startOptions ) {
const method = 'start';
LOG.entry(method, businessNetworkDefinition, startOptions);
Util.securityCheck(this.securityContext);

// a card should exist in the security context from the connect call
// use this in the start options
startOptions.card = this.securityContext.card;

// Build the start transaction.
return this._buildStartTransaction(businessNetworkDefinition, startOptions)
.then((startTransactionJSON) => {

// Now we can start the business network.
return this.connection.start(this.securityContext, businessNetworkDefinition.getName(), JSON.stringify(startTransactionJSON), startOptions);

})
.then(() => {
LOG.exit(method);
Expand All @@ -593,16 +591,15 @@ class AdminConnection {
* });
* @param {BusinessNetworkDefinition} businessNetworkDefinition - The business network to deploy
* @param {Object} deployOptions connector specific deployment options
* deployOptions.card the card to use for the NetworkAdmin
* @return {Promise} A promise that will be fufilled when the business network has been
* deployed.
*/
deploy(businessNetworkDefinition, deployOptions = {}) {
deploy(businessNetworkDefinition, deployOptions ) {
const method = 'deploy';
LOG.entry(method, businessNetworkDefinition, deployOptions);
Util.securityCheck(this.securityContext);

deployOptions.card = this.securityContext.card;

// Build the start transaction.
return this._buildStartTransaction(businessNetworkDefinition, deployOptions)
.then((startTransactionJSON) => {
Expand Down
8 changes: 4 additions & 4 deletions packages/composer-admin/test/adminconnection.js
Original file line number Diff line number Diff line change
Expand Up @@ -324,7 +324,7 @@ describe('AdminConnection', () => {
adminConnection.securityContext = mockSecurityContext;
let businessNetworkDefinition = new BusinessNetworkDefinition('[email protected]');
sinon.stub(adminConnection, '_buildStartTransaction').resolves({ start: 'json' });
return adminConnection.start(businessNetworkDefinition)
return adminConnection.start(businessNetworkDefinition, {card: mockAdminIdCard})
.then(() => {
sinon.assert.calledOnce(adminConnection._buildStartTransaction);
sinon.assert.calledWith(adminConnection._buildStartTransaction, businessNetworkDefinition, {card: mockAdminIdCard});
Expand All @@ -338,7 +338,7 @@ describe('AdminConnection', () => {
adminConnection.securityContext = mockSecurityContext;
let businessNetworkDefinition = new BusinessNetworkDefinition('[email protected]');
sinon.stub(adminConnection, '_buildStartTransaction').resolves({ start: 'json' });
return adminConnection.start(businessNetworkDefinition, {opt: 1})
return adminConnection.start(businessNetworkDefinition, {card: mockAdminIdCard,opt: 1})
.then(() => {
sinon.assert.calledOnce(adminConnection._buildStartTransaction);
sinon.assert.calledWith(adminConnection._buildStartTransaction, businessNetworkDefinition, {card: mockAdminIdCard,opt: 1});
Expand Down Expand Up @@ -382,7 +382,7 @@ describe('AdminConnection', () => {
adminConnection.securityContext = mockSecurityContext;
let businessNetworkDefinition = new BusinessNetworkDefinition('[email protected]');
sinon.stub(adminConnection, '_buildStartTransaction').resolves({ start: 'json' });
return adminConnection.deploy(businessNetworkDefinition)
return adminConnection.deploy(businessNetworkDefinition,{card:mockAdminIdCard})
.then(() => {
sinon.assert.calledOnce(adminConnection._buildStartTransaction);
sinon.assert.calledWith(adminConnection._buildStartTransaction, businessNetworkDefinition, {card:mockAdminIdCard});
Expand All @@ -396,7 +396,7 @@ describe('AdminConnection', () => {
adminConnection.securityContext = mockSecurityContext;
let businessNetworkDefinition = new BusinessNetworkDefinition('[email protected]');
sinon.stub(adminConnection, '_buildStartTransaction').resolves({ start: 'json' });
return adminConnection.deploy(businessNetworkDefinition, {opt: 1})
return adminConnection.deploy(businessNetworkDefinition, {opt: 1,card:mockAdminIdCard})
.then(() => {
sinon.assert.calledOnce(adminConnection._buildStartTransaction);
sinon.assert.calledWith(adminConnection._buildStartTransaction, businessNetworkDefinition, {opt: 1,card:mockAdminIdCard});
Expand Down
6 changes: 3 additions & 3 deletions packages/composer-cli/docker/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,9 @@ RUN deluser --remove-home node && \
addgroup -g 1000 composer && \
adduser -u 1000 -G composer -s /bin/sh -D composer && \
apk add --no-cache make gcc g++ python git libc6-compat && \
su -c 'npm config set prefix ''/home/composer/.npm-global''' - composer && \
su -c 'npm install --production -g composer-cli@${VERSION}' - composer && \
su -c 'npm cache clean --force' - composer && \
su -c "npm config set prefix '/home/composer/.npm-global'" - composer && \
su -c "npm install --production -g composer-cli@${VERSION}" - composer && \
su -c "npm cache clean --force" - composer && \
rm -rf /home/composer/.config /home/composer/.node-gyp /home/composer/.npm && \
apk del make gcc g++ python git

Expand Down
6 changes: 3 additions & 3 deletions packages/composer-playground/docker/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,9 @@ RUN deluser --remove-home node && \
addgroup -g 1000 composer && \
adduser -u 1000 -G composer -s /bin/sh -D composer && \
apk add --no-cache make gcc g++ python git libc6-compat && \
su -c 'npm config set prefix ''/home/composer/.npm-global''' - composer && \
su -c 'npm install --production -g pm2 composer-playground@${VERSION}' - composer && \
su -c 'npm cache clean --force' - composer && \
su -c "npm config set prefix '/home/composer/.npm-global'" - composer && \
su -c "npm install --production -g pm2 composer-playground@${VERSION}" - composer && \
su -c "npm cache clean --force" - composer && \
rm -rf /home/composer/.config /home/composer/.node-gyp /home/composer/.npm && \
apk del make gcc g++ python git

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
Playground v{{ playgroundVersion }}
</div>
<div class="footer-item">
<a href="https://hyperledger.github.io/composer/tutorials/playground-guide.html" target="_blank">Tutorial</a>
<a href="https://hyperledger.github.io/composer/tutorials/playground-tutorial.html" target="_blank">Tutorial</a>
</div>
<div class="footer-item">
<a href="https://hyperledger.github.io/composer/introduction/introduction.html" target="_blank">Docs</a>
Expand Down
6 changes: 3 additions & 3 deletions packages/composer-rest-server/docker/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,9 @@ RUN deluser --remove-home node && \
addgroup -g 1000 composer && \
adduser -u 1000 -G composer -s /bin/sh -D composer && \
apk add --no-cache make gcc g++ python git libc6-compat && \
su -c 'npm config set prefix ''/home/composer/.npm-global''' - composer && \
su -c 'npm install --production -g pm2 composer-rest-server@${VERSION}' - composer && \
su -c 'npm cache clean --force' - composer && \
su -c "npm config set prefix '/home/composer/.npm-global'" - composer && \
su -c "npm install --production -g pm2 composer-rest-server@${VERSION}" - composer && \
su -c "npm cache clean --force" - composer && \
rm -rf /home/composer/.config /home/composer/.node-gyp /home/composer/.npm && \
apk del make gcc g++ python git

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ A Connection Profile is used by {{site.data.conrefs.composer_full}} to connect t
Create a connection profile for {{site.data.conrefs.hlf_full}} v1.0, use the following format:

{
"name": "hlfv1"
"type": "hlfv1",
"orderers": [
{
Expand Down Expand Up @@ -80,6 +81,7 @@ A Connection Profile is used by {{site.data.conrefs.composer_full}} to connect t
_Please note: The simplified version of the connection profile will only work if the relevant certificate authority has no name defined. If the certificate authority has a defined name, it must be specified._

{
"name": "hlfv1"
"type": "hlfv1",
"orderers": [
"grpc://localhost:7050"
Expand All @@ -104,6 +106,7 @@ A Connection Profile is used by {{site.data.conrefs.composer_full}} to connect t
"maxRecvSize": 15
}

- `name` is a name used to refer to the connection profile, and is required.
- `type` defines the version of {{site.data.conrefs.hlf_full}} that you will connect to. To connect to {{site.data.conrefs.hlf_full}} v1.0 is must be `hlfv1`.
- `ca` defines the url of a {{site.data.conrefs.hlf_full}} certificate authority to connect to. If your certificate authority requires a name, it must be defined as a property of `ca` as shown in the first {{site.data.conrefs.hlf_full}} v1.0 example above.
- `trustedRoots` and `verify` options for the Certificate Authority are described here https://fabric-sdk-node.github.io/global.html#TLSOptions
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,11 @@ sidebar: sidebars/accordion-toc0.md
excerpt: "This tutorial will walk you through the steps required to configure Composer for connection with a running Hyperledger Fabric instance."
---

# Deploying a {{site.data.conrefs.composer_full}} blockchain business network to {{site.data.conrefs.hlf_full}} for a single organisation
# Deploying a {{site.data.conrefs.composer_full}} blockchain business network to {{site.data.conrefs.hlf_full}} for a single organization

In the [development environment](../installing/development-tools.html), a simple {{site.data.conrefs.hlf_full}} network is created for you (`fabric-dev-servers`), along with all of the {{site.data.conrefs.composer_full}} configuration that you need in order to deploy a blockchain business network.

This tutorial will demonstrate the steps that an administrator needs to take in order to deploy a blockchain business network to an instance of {{site.data.conrefs.hlf_full}}, including how to generate the necessary {{site.data.conrefs.composer_full}} configuration.

This tutorial focuses on the steps required to deploy a blockchain business network to an instance of {{site.data.conrefs.hlf_full}} for a single organisation. A subsequent tutorial will demonstrate how to deploy a blockchain business network to an instance of {{site.data.conrefs.hlf_full}} for multiple organisations.
This tutorial will demonstrate the steps that an administrator needs to take in order to deploy a blockchain business network to an instance of {{site.data.conrefs.hlf_full}} for a single organization, including how to generate the necessary {{site.data.conrefs.composer_full}} configuration. A subsequent tutorial will demonstrate how to deploy a blockchain business network to an instance of {{site.data.conrefs.hlf_full}} for multiple organizations.

## Prerequisites

Expand Down Expand Up @@ -57,9 +55,9 @@ The configuration for `configtxgen` is stored in the file:

You can find more information about these configuration tools, what they do, and how to use them by reading the {{site.data.conrefs.hlf_full}} documentation.

#### Organisations
#### Organizations

The simple {{site.data.conrefs.hlf_full}} network is made up of a single organisation called `Org1`. The organisation uses the domain name `org1.example.com`. Additionally, the Membership Services Provider (MSP) for this organisation is called `Org1MSP`. In this tutorial, you will deploy a blockchain business network that only the organisation `Org1` can interact with.
The simple {{site.data.conrefs.hlf_full}} network is made up of a single organization called `Org1`. The organization uses the domain name `org1.example.com`. Additionally, the Membership Services Provider (MSP) for this organization is called `Org1MSP`. In this tutorial, you will deploy a blockchain business network that only the organization `Org1` can interact with.

#### Network components

Expand All @@ -79,7 +77,7 @@ This tutorial will run {{site.data.conrefs.composer_full}} commands on the Docke

#### Users

The organisation `Org1` is configured with a user named `[email protected]`. This user is an administrator. Administrators for an organisation have the permission to install the code for a blockchain business network onto their organisation's peers, and can also have the permission to start the blockchain business network, depending on configuration. In this tutorial, you will deploy a blockchain business network by acting as the user `[email protected]`.
The organization `Org1` is configured with a user named `[email protected]`. This user is an administrator. Administrators for an organization have the permission to install the code for a blockchain business network onto their organization's peers, and can also have the permission to start the blockchain business network, depending on configuration. In this tutorial, you will deploy a blockchain business network by acting as the user `[email protected]`.

The user `[email protected]` has a set of certificates and private key files stored in the directory:

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -193,7 +193,7 @@ Deploying a business network to the {{site.data.conrefs.hlf_full}} requires the

5. Select **Yes** when asked whether to enable event publication.

6. Select **No** when asked whether to enable TSL security.
6. Select **No** when asked whether to enable TLS security.

The generated API is connected to the deployed blockchain and business network.

Expand Down
2 changes: 1 addition & 1 deletion packages/composer-website/jekylldocs/tutorials/queries.md
Original file line number Diff line number Diff line change
Expand Up @@ -202,7 +202,7 @@ We will now integrate the newly updated business network with queries added, and

6. Select **Yes** when asked whether to enable event publication.

7. Select **No** when asked whether to enable TSL security.
7. Select **No** when asked whether to enable TLS security.

## Step Six: Test the REST APIs and create some data

Expand Down

0 comments on commit f0815dc

Please sign in to comment.