Can we deploy multiple services in one Corda Node? - corda

We have developed few apps in corda. Just wondering if we can deploy the different corda apps on a single node. Is it possible to do if yes then how we can proceed with this.
Currently when we deploy our application, it opens each node and run the service- state,flow for each nodes.

Yes, a node can have several CorDapps running at once. You build and install them as follows:
Run the following Gradle task from the root of your project to build the CorDapp JAR:
Unix/Mac OSX: ./gradlew jar
Windows: gradlew.bat jar
Copy the CorDapp JAR from the build/libs folder to the plugins/cordapps folder of your node
Repeat for each CorDapp
At runtime, your node will loads all the CorDapp JARs in its plugins/cordapps folder.

Related

How to create CorDapp jar file without redeploying nodes?

We are using Corda Version 4 for our application.
We understand that the command gradlew.bat deployNodes creates following jars -
CorDapp (contracts, states, flows)
Corda platform
Dependencies
When any change is made in the contract/states/flows code, we had to run the command gradlew.bat deployNodes each time. Due to this the "Corda platform" and "Dependencies" jars always get recreated and consequently increases development time.
Does Corda platform provides alternative way to Only create "CorDapp" jar file and not the remaining ones?
You can use following cmd to generate only jar files
./gradlew build
this will generate jar files in you build/lib folder

How to create the corda.jar?

When I build the corda project locally, I find a corda-4.1-corda.jar. Is that basically the same as the corda.jar file produced when node directories are generated by the cordformation plugin? Can I replace the latter by the former, after renaming it, in a deployment?
Once your dependencies are set correctly, you can build your CorDapp JAR(s) using the Gradle jar task
Unix/Mac OSX: ./gradlew jar
Windows: gradlew.bat jar
Run ./gradlew clean build -x test from the root directory. Once the process finishes, the jar is produced in the corda/node/capsule/build/libs/ directory as corda-<version>.jar.

How Cordapps are getting deployed with corda.jar while running corda nodes?

We are defining the nodes configuration in build.gradle.
After running the gradle deployNodes task, based on the configuration in build directory/nodes- Folders are getting created in their names.
Each node is having the following files:
Corda.jar
network-parameters
persistence.mv.db
node.conf
certificates
drivers
logs
cordapps
These the following questions I have,
What is the runnodes.jar does - means how corda.jar is started and how cordapps are deployed on top of that?
If I change the node.conf, then runnodes will it affect the node.conf or Do I need to build the corda.jar again ?
Where the p2paddress of other nodes are shared with each node.
Suppose If I want to deploy the nodes in different EC2 instances, Do I need to mention the p2paddress with correct ec2 ipaddress of each nodes on build.gradle or I can do it dynamically?
runnodes goes to each node's folder and starts it by running the Corda JAR (by running something like java -jar corda.jar). When the Corda JAR starts, it scans the cordapps folder for CorDapps and loads them into the node
If you stop a node and modify the node.conf file, the changes will apply when you next run the node. There is no need to redeploy
It depends:
If you're running in development mode, the bootstrapper is run when you first deploy the nodes to copy each node's nodeInfo (a file containing its name, public keys, addresses, etc.) to the other nodes. If you modify one of the nodes' addresses in its node.conf file, you need to re-run the bootstrapper. See the instructions here
If you're running outside of development mode, you need to provide a network map server (as described here) that will distribute information on the network's nodes to each node

Issue in deployment of cord app

I checked https://docs.corda.net/deploying-a-node.html for deploying in windows server. I can see deploying nodes using NSSM Manager.
When I deploy nodes, how it will access my application which is placed as a jar under /opt/corda /CordaApp.jar
Also, When I run nssm.bat file under each nodes, my cmd is going on running with the first cmd and not stopping. Nothing proceed after that.
There is a typo in the docs. Where it says:
Create a directory called plugins in /opt/corda and save your CorDapp jar file to it. Alternatively, download one of our sample CorDapps to the plugins directory
It should read instead:
Create a directory called plugins in C:\Corda\ and save your CorDapp jar file to it. Alternatively, download one of our sample CorDapps to the plugins directory
This was fixed by the following PR: https://github.com/corda/corda/pull/2607.

Deploying binaries from Bamboo to Nexus repository

Firstly I am new to Nexus. So please bear if it is too noob a question. Let me first explain how our current build/deployment process works.
HOW WE DO IT AT PRESENT:
We have a project that is Maven based. There is a parent POM.xml and two module pom.xmls Each child module POM.xmls create a JAR file each when built. Currently I am doing the build/ deployments manually. I checkout code from SVN to my local machine. I run mvn clean install. I have created a bash script to bundle the 2 Jar files + few other resources (Present just in SVN repo and gets downloaded to local) into a tar.gzip file. Now I SCP this to the app server. Run install scripts that deploys the tar.gzip file.
HOW WE WANT TO DO IT:
We plan to automate the build in Bamboo (Which I have already done). Then the built artifact needs to be uploaded to a Nexus repository (Due to security issues, the SCP task in Bamboo does not work because of establishing SSH connectivity from Bamboo Server to App Server).
MY FIRST HURDLE:
I have created a Bash Script task in Bamboo which does the bundling ( 2 Jars from each child Module POM + resources) to a tar.gzip. This tar.gzip is prersent in a path a/b/c/d on my bamboo machine.
How do I upload this tar.gzip to Nexus Repository?
MY CONFUSION:
I have read about uploading artifacts to Nexus. But I understand it if just 1 jar/ear/war file is created from the build. But we want the bundle. So if I make changes to settings.xml & POM.xml to configure the upload to NEXUS, each JAR file will be uploaded into separate paths in Nexus. And then I have to configure separately to upload the resource files (Not part of build). Is my understanding correct? Please let me know how to proceed with this?
Thanks in advance!!!
Use the Maven Assembly Plugin to create an assembly that contains your artifacts and resources, and then your regular maven deploy will deploy it into Nexus.

Resources