Currently I am working on a corda project with 3+1 (notary node) and spring boot webserver for RPC RESTAPIs on windows. Now I want to deploy these node on a ubuntu VM and the spring boot project as well. As of now I am running deploynode gradle task to generate the nodes. So while deploying the nodes on different machines how do we do? And how do we integrate ans deploy the corresponding spring webserver? Can someone explain with detail description.
1 Answers
There are few methods to install and run Corda nodes in a network on different machines.
Below are some steps on how to setup corda nodes using cordite Network Map service.
Pre-reqs :
Node directories in respective machines. So in your case, it is 4 folders including notary in respective machines. (Node directories can be found after ./gradlew clean deploynodes in /build/nodes)
Cordite NetworkMap service
Running Cordite nw map service :
Please refer https://gitlab.com/cordite/network-map-service/blob/master/FAQ.md for more details.
- Docker Method.
docker run -p 8080:8080 -e NMS_STORAGE_TYPE=file cordite/network-map
Steps to register and run Nodes :
- Get into notary directory
- 1a. Remove unnecessary folders formed by deploy task
rm -rf network-parameters nodeInfo-* persistence.mv.db certificates additional-node-infos
- 1b. Edit node.conf to provide compatability zone (where network app is installed) , add below lines in node.conf assuming that network map is running in 8080 and devMode=true
compatibilityZoneURL="http://localhost:8080"
devModeOptions.allowCompatibilityZone=true
- 1c . Change p2p adress of node in node.conf to where the node is hosted
p2pAddress="hostip:port"
- 1d . Perform an initial registration of node
java -jar corda.jar --initial-registration --network-root-truststore ~/tmp/network-truststore.jks --network-root-truststore-password trustpass
- 1a. Remove unnecessary folders formed by deploy task
- Get into notary directory
- Designate notary
- 2a. Change directory to notary node
- 2b. Get the token to access the api
TOKEN=`curl -X POST "http://localhost:8080//admin/api/login" -H "accept: text/plain" -H "Content-Type: application/json" -d "{ \"user\": \"sa\", \"password\": \"admin\"}"`
- 2c. Assign nodeInfo to a variable
NODEINFO=`ls nodeInfo*`
- 2d. Inovke the endpoint which designates this node as notary (below is endpoint for non-validating notary)
curl -X POST -H "Authorization: Bearer $TOKEN" -H "accept: text/plain" -H "Content-Type: application/octet-stream" --data-binary @$NODEINFO http://localhost:8080//admin/api/notaries/validating
- Stop the notary, execute below in node shell (node will automatically stop if it is 4.0)
bye
- Delete the network parameters as it is changed
rm network-parameters
- Start the node again
java -jar corda.jar
- Designate notary
- Register and start other nodes
- Repeat steps 1a-1c for each node to register the node.
- Start the node
java -jar corda.jar
- Register and start other nodes
- Check out network map if nodes are registered.
- In browser open localost:8080/
- Check out network map if nodes are registered.