Skip to content

Commit

Permalink
Merge branch 'master' into merge-identities-to-master
Browse files Browse the repository at this point in the history
  • Loading branch information
cazfletch authored Aug 18, 2017
2 parents d4a4474 + dbeeb24 commit 015ea18
Show file tree
Hide file tree
Showing 12 changed files with 112 additions and 65 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ A description of the purpose of the business network using the Markdown mark-up
A Business Network Definition has a name (limited to basic ASCII alphanumeric characters and `-`), a human-readable description and a version number. The version number for the network should take the form Major.Minor.Micro and
[Semantic Versioning](http://semver.org) principles should be used when incrementing the version number.

The identifier of the network is formed from its name, the `-` character and its version number. A valid identifier is therefore `mybusinessnetwork-0.6.3`.
The identifier of the network is formed from its name, the `-` character and its version number. A valid identifier (and example) is therefore `mybusinessnetwork-1.0.3`.

The metadata for a business network definition is read from `package.json`, meaning that business network definitions may also be valid `npm` packages.

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ excerpt: Queries are used to return data about the blockchain world-state; for e

# Querying business network data

>**Warning**: The status of this feature is experimental. You **must** use Hyperledger Composer v0.8+ with the the HLFv1 runtime to use queries. We welcome feedback and comments while we continue to iterate upon query functionality. The API may change based on the feedback received.
>**Warning**: The status of this feature is experimental. You **must** use Hyperledger Composer v0.8 or greater (preferably 'latest') with the {{site.data.conrefs.hlf_full}} v1.0 GA runtime to use queries. We welcome feedback and comments while we continue to iteratively add query functionality. The API may change, based on the feedback received.
Queries are used to return data about the blockchain world-state; for example, you could write a query to return all drivers over a specified age, or all drivers with a specific name. The composer-rest-server component exposes named queries via the generated REST API.

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ Operating Systems: Ubuntu Linux 14.04 / 16.04 LTS (both 64-bit), or Mac OS 10.12
Docker Engine: Version 17.03 or higher
Docker-Compose: Version 1.8 or higher
Node: 6.x (note version 7 is not supported)
npm: v3.x or v5.v
npm: v3.x or v5.x
git: 2.9.x or higher
Python: 2.7.x
A code editor of your choice, we recommend VSCode.
Expand Down Expand Up @@ -94,7 +94,7 @@ docker rmi $(docker images dev-* -q)
```


1. In a directory of your choice (will assume `~/fabric-tools`) get the zip file that contains the tools
1. In a directory of your choice (will assume `~/fabric-tools`) get the zip file that contains the tools to install {{site.data.conrefs.hlf_full}} v1.0.

mkdir ~/fabric-tools && cd ~/fabric-tools

Expand All @@ -108,13 +108,8 @@ docker rmi $(docker images dev-* -q)

tar xvzf fabric-dev-servers.tar.gz

2. Choose which version of Fabric to use. {{site.data.conrefs.hlf_full}} v1.0 is highly recommended and the default.

To 'unset' a v0.6 export, or to be explicit in using v1 Fabric, use this command

export FABRIC_VERSION=hlfv1

3. If this is the first time, you'll need to download the fabric first. If you have already downloaded then first start the fabric, and create a {{site.data.conrefs.composer_full}} profile. After that you can then choose to stop the fabric, and start it again later. Alternatively to completely clean up you can teardown the {{site.data.conrefs.hlf_full}} and the {{site.data.conrefs.composer_full}} profile.
2. If this is the first time, you'll need to download the fabric runtime first. If you have already downloaded it, then start the fabric environment, and create a {{site.data.conrefs.composer_full}} profile. After that you can then choose to stop the fabric, and start it again later. Alternatively to completely clean up you can teardown the {{site.data.conrefs.hlf_full}} and the {{site.data.conrefs.composer_full}} profile.

All the scripts will be in the directory `~/fabric-tools` A typical sequence for {{site.data.conrefs.composer_full}} use would be

Expand All @@ -137,7 +132,7 @@ docker rmi $(docker images dev-* -q)

![](../assets/img/developer-tools-commands.png).

This diagram explains the order in which the scripts can be run. The version will default to {{site.data.conrefs.hlf_full}} v1.0 if the version command is not run.
This diagram explains the order in which the scripts can be run.

**Downloading Fabric**

Expand Down Expand Up @@ -167,7 +162,7 @@ Issue from the `fabric-tools` directory
./createComposerProfile.sh
```

Note: this create a {{site.data.conrefs.composer_full}} profile specifically to connect to the development fabric you've already started.
Note: this creates a {{site.data.conrefs.composer_full}} profile specifically to connect to the development fabric you've already started.

**Teardown Fabric**

Expand All @@ -176,41 +171,6 @@ Issue from the `fabric-tools` directory
./teardownFabric.sh
```

---

<!--0. Make sure you've started Fabric as in Step 1 above. For example, If this is your first time for exaple:
$ cd ~/fabric-tools
$ ./downloadFabric.sh
$ ./startFabric.sh
$ ./createComposerProfile.sh
1. Clone the sample application into a directory of your choice - BUT not the same directory as in Step 1. (Assume `~/github`)
$ mkdir ~/github && cd ~/github
$ git clone https://github.com/hyperledger/composer-sample-applications
$ cd composer-sample-applications
$ npm install
To see a summary of all the sample applications, there's a simple command that will show summary details of the applications
A useful information node.js script has been created to show the available sample applications
$ node ~/github/composer-sample-applications/info.js
2. When you started fabric you will have chosen which version to use. If you have chosen Fabirc v0.6 you will need to suffix the targets in the npm commands below with `:hlfv06`. Both examples are given below - do not issue both commands!
_Note: this does not change the application source code or the model, purely the name of the Composer profile to use, and the Fabric's admin indentity_
3. Deploy the business network
$ cd packages/digitalproperty-app
$ npm run deployNetwork
$ npm run deployNetwork:hlfv0.6 # if you want to use v0.6
5. Run the sample application
$ npm test
$ npm test:hlfv0.6 # if you want to use v0.6
-->

## What next?

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -291,3 +291,76 @@ The examples are based on the business network that is deployed to Hyperledger F
myorg/my-composer-rest-server

You should now be able to access the persistent and secured REST server using the following URL: [http://localhost:3000/explorer/](http://localhost:3000/explorer/).


## Run the REST server in a Docker Container - with no security (eg. Dev/Test)

These steps will run the REST server in a Docker Container with no security, and therefore no need for persistence of identities. Activity on the REST server will be in the context of the Admin user used to start the REST server. Running the REST server in this way is generally good for experimentation and learning, but is not likely to be appropriate for production use.

1. Pull the Docker Image for the REST Server:

docker pull hyperledger/composer-rest-server

2. Create a new file named `envvars.txt`, with the following contents:
(The values used below will typically work with a Test Fabric created from examples in this documentation, but the value of the `COMPOSER_BUSINESS_NETWORK` will need to be set correctly.)

COMPOSER_CONNECTION_PROFILE=hlfv1
COMPOSER_BUSINESS_NETWORK=<my-network>
COMPOSER_ENROLLMENT_ID=admin
COMPOSER_ENROLLMENT_SECRET=adminpw
COMPOSER_NAMESPACES=never
COMPOSER_SECURITY=false
COMPOSER_CONFIG='{
"connectionProfiles": {
"hlfv1": {
"name": "hlfv1",
"description": "Hyperledger Fabric v1.0",
"type": "hlfv1",
"keyValStore": "/home/composer/.composer-credentials",
"timeout": 300,
"orderers": [
{
"url": "grpc://orderer.example.com:7050"
}
],
"channel": "composerchannel",
"mspID": "Org1MSP",
"ca": {
"url": "http://ca.org1.example.com:7054",
"name": "ca.org1.example.com"
},
"peers": [
{
"requestURL": "grpc://peer0.org1.example.com:7051",
"eventURL": "grpc://peer0.org1.example.com:7053"
}
]
}
}
}'

3. Load the environment variables:

source envvars.txt

4. Start the Docker container:

docker run \
-d \
-e COMPOSER_CONNECTION_PROFILE=${COMPOSER_CONNECTION_PROFILE} \
-e COMPOSER_BUSINESS_NETWORK=${COMPOSER_BUSINESS_NETWORK} \
-e COMPOSER_ENROLLMENT_ID=${COMPOSER_ENROLLMENT_ID} \
-e COMPOSER_ENROLLMENT_SECRET=${COMPOSER_ENROLLMENT_SECRET} \
-e COMPOSER_NAMESPACES=${COMPOSER_NAMESPACES} \
-e COMPOSER_SECURITY=${COMPOSER_SECURITY} \
-e COMPOSER_CONFIG="${COMPOSER_CONFIG}" \
-e COMPOSER_DATASOURCES="${COMPOSER_DATASOURCES}" \
-e COMPOSER_PROVIDERS="${COMPOSER_PROVIDERS}" \
--name resttest \
--network composer_default \
-p 3000:3000 \
hyperledger/composer-rest-server

You should now be able to access the persistent and secured REST server using the following URL: [http://localhost:3000/explorer/](http://localhost:3000/explorer/).

For the REST Server to work in this insecure mode, be sure that the environment variables ``COMPOSER_DATASOURCES`` and ``COMPOSER_PROVIDERS`` are not set to any value. Also note the importance of the part of the docker run command ``--network composer_default`` which enables the REST Server to 'find' the various Fabric Servers.
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ To launch the REST Server simply type:
composer-rest-server
```

You will then be asked to enter a few simple details about your business network.
You will then be asked to enter a few simple details about your business network. An example of consuming a deployed business network is shown below.

```bash

Expand All @@ -35,10 +35,10 @@ You will then be asked to enter a few simple details about your business network
| |__| (_) | | | | | | |_) | (_) \__ \ __/ |
\____\___/|_| |_| |_| .__/ \___/|___/\___|_|
|_|
? Enter your Fabric Connection Profile Name: defaultProfile
? Enter your Fabric Connection Profile Name: hlfv1
? Enter your Business Network Identifier : digitalproperty-network
? Enter your Fabric username : WebAppAdmin
? Enter your secret: DJY27pEnl16d
? Enter your Fabric username : admin
? Enter your secret: adminpw
Loopback Connector for Hyperledger Composer
Models Loaded Now
Browse your REST API at http://0.0.0.0:3000/explorer
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,8 @@ index-order: 102

## Execution Runtimes

{{site.data.conrefs.composer_full}} has been designed to support different pluggable runtimes, and currently has four runtime implementations:

* {{site.data.conrefs.hlf_full}} version 0.6. State is stored on the distributed ledger.
{{site.data.conrefs.composer_full}} has been designed to support different pluggable runtimes, and currently has three runtime implementations:
.
* {{site.data.conrefs.hlf_full}} version 1.0. State is stored on the distributed ledger.
* Web, which executes within a web page, and is used by Playground. State is stored in browser local storage.
* Embedded, which executes within a Node.js process, and is used primarily for unit testing business logic. State is stored in an in-memory key-value store.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ of that participant has been created and placed into a participant registry.
* Command line

```bash
composer identity issue -p hlfv1 -n 'digitalproperty-network' -i admin -s adminpw -u maeid1 -a "resource:net.biz.digitalPropertyNetwork.Person#[email protected]"
composer identity issue -p hlfv1 -n 'digitalproperty-network' -i admin -s adminpw -u maeid1 -a "net.biz.digitalPropertyNetwork.Person#[email protected]"
```

The enrollment secret will be printed to the console.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,20 @@ excerpt: Composer Archive Create CLI

---

The `composer archive create` utility is used to create a business network archive from the contents of a root directory.
The `composer archive create` utility is used to create a business network archive from the contents of a directory.

To create an archive from source flles (ie business network definition project files) present in the current 'working' directory:
```
composer archive create -a <business-network-archive>
```
or

to specify paths (to the source business network definition and specify a destination directory for the archive file (.bna file):

```
composer archive create --sourceType dir --sourceName <dirpath> -a digitalproperty-network.bna
```

### Options
Expand All @@ -30,9 +40,13 @@ Only one of either inputDir or moduleName must be specified.
## Example Output

```
composer archive create -d .
$ pwd
/Users/dselman/dev/temp
composer archive create --sourceType dir --sourceName . -a dist/digitalproperty-network.bna
Creating Business Network Archive
Looking for package.json of Business Network Definition in /Users/dselman/dev/temp
Looking for package.json of Business Network Definition in /Users/dselman/dev/temp/dist
Description:Digital Property Network
Name:digitalproperty-network
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ Example: `lennyid1`
`--participantId, -a`

The fully qualified identifier of the participant that the identity should be issued to.
Example: `resource:net.biz.digitalPropertyNetwork.Person#[email protected]`
Example: `net.biz.digitalPropertyNetwork.Person#[email protected]`

`--issuer, -x`

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ excerpt: Composer Network Deploy CLI
The `composer network deploy` utility is used to deploy a business network archive from local disk to a {{site.data.conrefs.hlf_full}} v1.0 runtime.

```
composer network deploy -a <business-network-archive> -i <enrollment-id> -s <enrollment-secret>
composer network deploy -a <business-network-archive> -p <connection-profile-name> -i <enrollment-id> -s <enrollment-secret>
```

### Options
Expand All @@ -32,8 +32,9 @@ composer network deploy -a <business-network-archive> -i <enrollment-id> -s <enr
## Example Output

```
composer network deploy -a digitalPropertyNetwork.zip -i WebAppAdmin -s DJY27pEnl16d
Deploying business network from archive digitalPropertyNetwork.zip
composer network deploy -a digitalPropertyNetwork.bna -p hlfv1 -i PeerAdmin -s randomString
Deploying business network from archive digitalPropertyNetwork.bna
Business network definition:
Identifier: [email protected]
Description: Digital Property Network
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ The `composer network undeploy` command **permanently disables a business networ
**Please Note**: When using the `undeploy` command with a business network running on {{site.data.conrefs.hlf_full}} v1.0, the business network remains running, but will become unresponsive. The business network **cannot be redeployed or updated once the `undeploy` command has been issued.** This is because the business network is already deployed, but has been set to be unresponsive.

```
composer network undeploy -a <business-network-archive> -i <enrollment-id> -s <enrollment-secret>
composer network undeploy -a <business-network-archive> -n <connection-profile-name> -i <enrollment-id> -s <enrollment-secret>
```

Note that **after undeploy the business network definition can no longer be used**, however the docker container
Expand All @@ -35,7 +35,7 @@ definition must be explicitly stopped and removed if no longer needed.
## Example Output

```
composer network undeploy -n digitalproperty-network -i WebAppAdmin -s DJY27pEnl16d
composer network undeploy -n digitalproperty-network -p hlfv1 -i PeerAdmin -s randomString
Undeploying business network definition. This may take some seconds...
Command completed successfully.
```
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ Options:
`--connectionProfileName, -p`

The connection profile name.
Example: `defaultProfile`
Example: `hlfv1`

`--businessNetworkName, -n`

Expand Down

0 comments on commit 015ea18

Please sign in to comment.