IBM-Blockchain-Archive / car-lease-demo

A demonstration using IBM Blockchain to show how the lifecycle of vehicles can be recorded on a blockchain
Other
169 stars 304 forks source link

HowTo use "Demo" folder #59

Closed andreaturli closed 7 years ago

andreaturli commented 7 years ago

I'd really appreciate a simple readme for Demo folder. I can run correctly docker-compose up from that folder but only the landing page of the web UI looks healthy in my env (localhost:8080)

Is it still a work-in-progress or am I missing something? Thanks

liam-grace commented 7 years ago

Hi @andreaturli , it's still a work in progress, but you may be able to get it working now, but it is untested. If you edit the credentials.json file, and delete 3 of the 4 peers in the peers array, and then change the discovery_host to vp0, and the discovery_port to 7050 and then edit the ca array, changing the discovery_host to fabric_ca and the discovery_port to 7054. You also have to edit the configuration.js file in Server_Side/configurations and change the networkProtocol to http, and the appProtocol to http also.

Let me know if there are any issues with this, but we are currently working on the documentation and implementation of this Thanks

andreaturli commented 7 years ago

Thanks @14gracel for the quick response

I edited credentials.json to

 {
   "peers": [
     {
-      "discovery_host": "d0b0c95d1dd44c4ba2b315a81945ed0b-vp2.us.blockchain.ibm.com",
-      "discovery_port": 30001,
-      "api_host": "d0b0c95d1dd44c4ba2b315a81945ed0b-vp2.us.blockchain.ibm.com",
-      "api_port_tls": 5001,
-      "api_port": 5001,
-      "event_host": "d0b0c95d1dd44c4ba2b315a81945ed0b-vp2.us.blockchain.ibm.com",
-      "event_port": 31001,
-      "type": "peer",
-      "network_id": "d0b0c95d1dd44c4ba2b315a81945ed0b",
-      "container_id": "3272425e3445b33904d22004f0d8ec194e8b2e2dde12d457f8c2aeee9bf63c3f",
-      "id": "d0b0c95d1dd44c4ba2b315a81945ed0b-vp2",
-      "api_url": "http://d0b0c95d1dd44c4ba2b315a81945ed0b-vp2.us.blockchain.ibm.com:5001"
-    },
-    {
-      "discovery_host": "d0b0c95d1dd44c4ba2b315a81945ed0b-vp0.us.blockchain.ibm.com",
-      "discovery_port": 30001,
-      "api_host": "d0b0c95d1dd44c4ba2b315a81945ed0b-vp0.us.blockchain.ibm.com",
-      "api_port_tls": 5001,
-      "api_port": 5001,
-      "event_host": "d0b0c95d1dd44c4ba2b315a81945ed0b-vp0.us.blockchain.ibm.com",
-      "event_port": 31001,
-      "type": "peer",
-      "network_id": "d0b0c95d1dd44c4ba2b315a81945ed0b",
-      "container_id": "9af44d387185ce36ba1ca6b911da6469de4da52822bb3808d9c3c3a630ce8444",
-      "id": "d0b0c95d1dd44c4ba2b315a81945ed0b-vp0",
-      "api_url": "http://d0b0c95d1dd44c4ba2b315a81945ed0b-vp0.us.blockchain.ibm.com:5001"
-    },
-    {
-      "discovery_host": "d0b0c95d1dd44c4ba2b315a81945ed0b-vp3.us.blockchain.ibm.com",
-      "discovery_port": 30001,
-      "api_host": "d0b0c95d1dd44c4ba2b315a81945ed0b-vp3.us.blockchain.ibm.com",
-      "api_port_tls": 5001,
-      "api_port": 5001,
-      "event_host": "d0b0c95d1dd44c4ba2b315a81945ed0b-vp3.us.blockchain.ibm.com",
-      "event_port": 31001,
-      "type": "peer",
-      "network_id": "d0b0c95d1dd44c4ba2b315a81945ed0b",
-      "container_id": "7c5f781c0d85aa2a9e219c0979a3af318f42bf5181bef55410b63be147f3c81c",
-      "id": "d0b0c95d1dd44c4ba2b315a81945ed0b-vp3",
-      "api_url": "http://d0b0c95d1dd44c4ba2b315a81945ed0b-vp3.us.blockchain.ibm.com:5001"
-    },
-    {
-      "discovery_host": "d0b0c95d1dd44c4ba2b315a81945ed0b-vp1.us.blockchain.ibm.com",
-      "discovery_port": 30001,
+      "discovery_host": "vp0",
+      "discovery_port": 7050,

   "ca": {
     "d0b0c95d1dd44c4ba2b315a81945ed0b-ca": {
       "url": "d0b0c95d1dd44c4ba2b315a81945ed0b-ca.us.blockchain.ibm.com:30001",
-      "discovery_host": "d0b0c95d1dd44c4ba2b315a81945ed0b-ca.us.blockchain.ibm.com",
-      "discovery_port": 30001,
+      "discovery_host": "fabric_ca",
+      "discovery_port": 7054,

and Server_Side/configurations/configuration.js into

config.networkProtocol     = 'http';             // The protocol to be used for connecting via rest to the network data peers

//Settings for the nodeJS application server
config.appProtocol = 'http';

when I try docker-compose up I can see

car-lease-demo_1  | ------------------------------------------ Server Up - localhost:8080 ------------------------------------------
car-lease-demo_1  | INFO    Startup complete on port    8080
car-lease-demo_1  |
car-lease-demo_1  | ERROR   Startup OUTPUT: "Failed to enroll registrar with admin 936a7a8f4e"
car-lease-demo_1  | { [Error] code: 2, metadata: Metadata { _internal_repr: {} } }
car-lease-demo_1  | ERROR   Startup OUTPUT: {"code":2,"metadata":{"_internal_repr":{}}}

is it anything else I need to edit?

Thanks again

liam-grace commented 7 years ago

I will be working on this in the coming week, but for now, also change the hfc_protocol to 'grpc' and ensure that you do not have a keyValStore in the application root. The docker implementation is untested, but I will let you know as soon as it is working if these changes to not work

andreaturli commented 7 years ago

thanks!

liam-grace commented 7 years ago

The 'Demo' folder no longer exists, there is now a script Scripts/start.sh that you can run to start the car lease demo locally. You will first have to copy the contents of local-credentials.json to credentials.json, as well as changing the values of config.networkProtocol to http, config.appProtocol to http and config.hfc_protocol to `grpc.

andreaturli commented 7 years ago

thanks I'll give it a try shortly.