Last active
March 4, 2019 03:47
-
-
Save horeaporutiu/542609da6179645161947bcd4e11b34f to your computer and use it in GitHub Desktop.
Deploy Hyperledger Composer blockchain network to IBM Cloud - YouTube tutorial
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-------------------------------------------------------------------------------------------------------------- | |
--------------------------commands for Part 1 in YouTube tutorial starts here--------------------------------- | |
-------------------------------------------------------------------------------------------------------------- | |
//first need to clone directory to get all the needed files to deploy our blockchain network. All smart contract files are in contract directory | |
$ git clone https://github.com/IBM/blockchainbean.git | |
//install dependencies that we will use later | |
$ npm install -g [email protected] | |
$ npm install -g @ampretia/composer-wallet-cloudant | |
//create new file in the blockchainbean directory you just cloned | |
$ touch cardstore-cloudant.json | |
//populate the cardstore-cloudant.json with the following json, and fill out the json with the service credentials from your Cloudant service | |
{ "composer": | |
{ "wallet": | |
{ "type": "@ampretia/composer-wallet-cloudant", | |
"options": { | |
"database":"composer-wallets", | |
"username": "xxxxxxxxx-bluemix", | |
"password": "xxxxxxxx", | |
"host": "xxxxxxxx-bluemix.cloudant.com", | |
"port": 443, | |
"url": | |
"https:/xxxxxxxx-bluemix:xxxxxx-bluemix.cloudant.com" | |
} | |
} | |
} | |
} | |
//save the file after you filled in the username, password, host, and url | |
//add our cloudant credentials as a env variable | |
export NODE_CONFIG=$(cat cardstore-cloudant.json) | |
-------------------------------------------------------------------------------------------------------------- | |
--------------------------commands for Part 2 in YouTube tutorial starts here--------------------------------- | |
-------------------------------------------------------------------------------------------------------------- | |
//create certificate authority card | |
$ composer card create -f ca.card -p connection-profile.json -u admin -s <your-enrollSecret> | |
//import card | |
$ composer card import -f ca.card -c ca | |
//request pub/private key pairs from Certificate Authority. Save them in credentials directory | |
$ composer identity request --card ca --path ./credentials | |
//create and import business card for admin | |
$ composer card create -f adminCard.card -p connection-profile.json -u admin \ | |
-c ./credentials/admin-pub.pem -k ./credentials/admin-priv.pem \ | |
--role PeerAdmin --role ChannelAdmin | |
$ composer card import -f adminCard.card -c adminCard | |
//install the business network | |
$ composer archive create -t dir -n . | |
//rename file to be blockchainbean.bna | |
$ mv blockchainbean@*.bna blockchainbean.bna | |
//install business network | |
$ composer network install -c adminCard -a blockchainbean.bna | |
//start business netowrk, this may take some time | |
$ composer network start -c adminCard -n blockchainbean -V 1.0.0 \ | |
-A admin -C ./credentials/admin-pub.pem -f delete_me.card | |
//create card for network admin | |
composer card create -n blockchainbean -p ./connection-profile.json \ | |
-u admin -c ./credentials/admin-pub.pem -k ./credentials/admin-priv.pem | |
//import card | |
$ composer card import -f [email protected]' | |
//login to cloud foundry, enter your email and password for ibm cloud, if you are IBM employee, use -sso option | |
$ cf login | |
//push blockchainbean app using composer-rest-server docker image. If you get error that name is taken, use a different name other than blockcheanbean | |
$ cf push blockchainbean --docker-image ibmblockchain/composer-rest-server:0.19.5 \ | |
-c "composer-rest-server -c admin@blockchainbean -n never -w true" \ | |
-i 1 -m 256M --no-start --no-manifest | |
//use cloudant-store.json as env variable so that we can write our credentials in our database | |
$ cf set-env blockchainbean NODE_CONFIG "${NODE_CONFIG}" | |
//start our app, if error, check logs | |
$ cf start blockchainbean | |
//go to browser at http://blockchainbean.mybluemix.net/explorer/ and that is your app | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
$ cf start agr********-network Failed to start the app
Starting app agr*-network in org [email protected] / space dev as ma***@gmail.com...
Waiting for app to start... Start unsuccessful
TIP: use 'cf logs agr****-network --recent' for more information FAILED
$ cf logs agr****-network --recent
Retrieving logs for app agr*-network in org [email protected] / space dev as ma***@gmail.com...
2019-03-04T02:56:19.40+0100 [API/1] OUT Created app with guid cd60c8ca-7baa-46e8-8348-5acd9e114d4a 2019-03-04T02:58:52.02+0100 [API/1] OUT Creating build for app with guid cd60c8ca-7baa-46e8-8348-5acd9e114d4a 2019-03-04T02:58:52.11+0100 [API/1] OUT Updated app with guid cd60c8ca-7baa-46e8-8348-5acd9e114d4a ({"state"=>"STARTED"}) 2019-03-04T02:58:52.48+0100 [STG/0] OUT Cell 992133cb-d246-4748-9a9f-cd0d29faf481 creating container for instance ca26dc12-b77b-428a-9e62-c5cdba4f854a 2019-03-04T02:58:53.27+0100 [STG/0] OUT Cell 992133cb-d246-4748-9a9f-cd0d29faf481 successfully created container for instance ca26dc12-b77b-428a-9e62-c5cdba4f854a 2019-03-04T02:58:53.97+0100 [STG/0] OUT Staging... 2019-03-04T02:58:54.16+0100 [STG/0] OUT Staging process started ... 2019-03-04T02:58:55.65+0100 [STG/0] OUT Staging process finished 2019-03-04T02:58:55.66+0100 [STG/0] OUT Exit status 0 2019-03-04T02:58:55.66+0100 [STG/0] OUT Staging Complete 2019-03-04T02:58:55.91+0100 [STG/0] OUT Cell 992133cb-d246-4748-9a9f-cd0d29faf481 stopping instance ca26dc12-b77b-428a-9e62-c5cdba4f854a 2019-03-04T02:58:55.91+0100 [STG/0] OUT Cell 992133cb-d246-4748-9a9f-cd0d29faf481 destroying container for instance ca26dc12-b77b-428a-9e62-c5cdba4f854a 2019-03-04T02:58:55.99+0100 [API/10] OUT Creating droplet for app with guid cd60c8ca-7baa-46e8-8348-5acd9e114d4a 2019-03-04T02:58:56.62+0100 [STG/0] OUT Cell 992133cb-d246-4748-9a9f-cd0d29faf481 successfully destroyed container for instance ca26dc12-b77b-428a-9e62-c5cdba4f854a 2019-03-04T02:58:56.64+0100 [CELL/0] OUT Cell aed14390-a691-4cd1-93f9-b905a5f6c2df creating container for instance 0c16cd40-cbfe-4b94-6056-9d0f 2019-03-04T02:59:22.59+0100 [CELL/0] OUT Cell aed14390-a691-4cd1-93f9-b905a5f6c2df successfully created container for instance 0c16cd40-cbfe-4b94-6056-9d0f 2019-03-04T02:59:22.59+0100 [API/11] OUT Updated app with guid cd60c8ca-7baa-46e8-8348-5acd9e114d4a ({"command"=>"PRIVATE DATA HIDDEN", "disk_quota"=>1024, "docker_image"=>"ibmblockchain/composer-rest-server:0.19.5", "health_check_http_endpoint"=>"", "health_check_type"=>"port", "instances"=>1, "memory"=>256, "name"=>"agr*-network", "space_guid"=>"e9b97e58-40e9-4404-8e80-45dd381f57f7", "state"=>"STOPPED"}) 2019-03-04T02:59:22.61+0100 [CELL/0] OUT Cell aed14390-a691-4cd1-93f9-b905a5f6c2df destroying container for instance 0c16cd40-cbfe-4b94-6056-9d0f 2019-03-04T02:59:26.32+0100 [CELL/0] OUT Cell aed14390-a691-4cd1-93f9-b905a5f6c2df successfully destroyed container for instance 0c16cd40-cbfe-4b94-6056-9d0f 2019-03-04T03:10:03.72+0100 [API/1] OUT Updated app with guid cd60c8ca-7baa-46e8-8348-5acd9e114d4a ({"state"=>"STARTED"}) 2019-03-04T03:10:04.07+0100 [CELL/0] OUT Cell 9a42bc6c-48d6-41a5-9bd7-d5d00d0c7d28 creating container for instance 8d0dd752-614e-4920-583c-6df6 2019-03-04T03:10:23.57+0100 [CELL/0] OUT Cell 9a42bc6c-48d6-41a5-9bd7-d5d00d0c7d28 successfully created container for instance 8d0dd752-614e-4920-583c-6df6 2019-03-04T03:10:24.05+0100 [CELL/0] OUT Starting health monitoring of container 2019-03-04T03:10:28.22+0100 [APP/PROC/WEB/0] OUT Discovering types from business network definition ... 2019-03-04T03:10:28.23+0100 [APP/PROC/WEB/0]
8d0dd752-614e-4920-583c-6df6 2019-03-04T03:10:33.77+0100 [CELL/0] OUT Cell 9a42bc6c-48d6-41a5-9bd7-d5d00d0c7d28 destroying container for instance 8d0dd752-614e-4920-583c-6df6 2019-03-04T03:10:33.78+0100 [API/14] OUT App instance exited with guid cd60c8ca-7baa-46e8-8348-5acd9e114d4a payload: {"instance"=>"8d0dd752-614e-4920-583c-6df6", "index"=>0, "reason"=>"CRASHED", "exit_description"=>"APP/PROC/WEB: Exited with status 1", "crash_count"=>1, "crash_timestamp"=>1551665433724300899, "version"=>"a43e2d6c-1bcc-464f-a7a3-29bb0de95fc7"} 2019-03-04T03:10:34.11+0100 [PROXY/0] OUT Exit status 137 2019-03-04T03:10:34.36+0100 [CELL/0] OUT Cell 9a42bc6c-48d6-41a5-9bd7-d5d00d0c7d28 successfully destroyed container for instance 8d0dd752-614e-4920-583c-6df6 2019-03-04T03:10:34.92+0100 [CELL/0] OUT Cell 9423bbfb-fd2c-46f6-8c1a-0126c8584550 creating container for instance 8a481977-ec6c-4af2-58ad-1e47 2019-03-04T03:11:46.85+0100 [CELL/0] OUT Cell 9423bbfb-fd2c-46f6-8c1a-0126c8584550 successfully created container for instance 8a481977-ec6c-4af2-58ad-1e47 2019-03-04T03:11:47.42+0100 [CELL/0] OUT Starting health monitoring of container 2019-03-04T03:11:52.75+0100 [APP/PROC/WEB/0] OUT Discovering types from business network definition ... 2019-03-04T03:11:52.77+0100 [APP/PROC/WEB/0] ERR Connection fails: Error: Card not found: admin@agr-network 2019-03-04T03:11:52.77+0100 [APP/PROC/WEB/0] ERR It will be retried for the next request. 2019-03-04T03:11:52.77+0100 [APP/PROC/WEB/0] OUT Exception: Error: Card not found: admin@agr-network 2019-03-04T03:11:52.77+0100 [APP/PROC/WEB/0] ERR { Error: Card not found: admin@agr-network 2019-03-04T03:11:52.77+0100 [APP/PROC/WEB/0] ERR at store.get.then.catch (/home/composer/.npm-global/lib/node_modules/@ibmblockchain/composer-rest-server/node_modules/composer-common/lib/cardstore/walletbackedcardstore.js:74:27) 2019-03-04T03:11:52.77+0100 [APP/PROC/WEB/0] ERR at 2019-03-04T03:11:52.77+0100 [APP/PROC/WEB/0] ERR cause: 2019-03-04T03:11:52.77+0100 [APP/PROC/WEB/0] ERR { Error: ENOENT: no such file or directory, stat '/home/composer/.composer/cards/admin@agr-network' 2019-03-04T03:11:52.77+0100 [APP/PROC/WEB/0] ERR errno: -2, 2019-03-04T03:11:52.77+0100 [APP/PROC/WEB/0] ERR code: 'ENOENT', 2019-03-04T03:11:52.77+0100 [APP/PROC/WEB/0] ERR syscall: 'stat', 2019-03-04T03:11:52.77+0100 [APP/PROC/WEB/0] ERR path: '/home/composer/.composer/cards/admin@agr***-network' } }
2019-03-04T03:18:07.64+0100 [APP/PROC/WEB/0] OUT Discovering types from business network definition ...
2019-03-04T03:18:09.11+0100 [APP/PROC/WEB/0] ERR Connection fails: Error: Error trying to ping. SyntaxError: Unexpected end of JSON input
2019-03-04T03:18:09.11+0100 [APP/PROC/WEB/0] ERR It will be retried for the next request.
2019-03-04T03:18:09.11+0100 [APP/PROC/WEB/0] OUT Exception: Error: Error trying to ping. SyntaxError: Unexpected end of JSON input
2019-03-04T03:18:09.11+0100 [APP/PROC/WEB/0] ERR Error: Error trying to ping. SyntaxError: Unexpected end of JSON input
2019-03-04T03:18:09.11+0100 [APP/PROC/WEB/0] ERR at _checkRuntimeVersions.then.catch (/home/composer/.npm-global/lib/node_modules/@ibmblockchain/composer-rest-server/node_modules/composer-connector-hlfv1/lib/hlfconnection.js:790:34)
2019-03-04T03:18:09.11+0100 [APP/PROC/WEB/0] ERR at
2019-03-04T03:18:09.18+0100 [APP/PROC/WEB/0] OUT Exit status 1
2019-03-04T03:18:09.19+0100 [CELL/SSHD/0] OUT Exit status 0
I created the card for network admin
imported card
logged into cloud foundry
pushed agr****-network app using composer-rest-server docker image.
used cloudant-store.json as env variable so that we can write our credentials in our database But It says Card not found.
What am I overlooking?
Thank you.