Deployment
- Reading time: 3 mins
- Discuss on Slack
Now that you have the JAR, the question arises where do you deploy it. To deploy your CorDapp JAR you need to create a Corda network.You could run this locally or on the cloud.
Setting up your Corda network locally
Depending on your preference, you could either do it manually or use Cordform or Dockerform gradle plug-ins.The docs provide a detailed instructions for the same.
Setting up your Corda node on the cloud
Depending on your preferred cloud provider, you can follow the steps below :
Node Explorer
With your Corda node running, how about you connect to it? The Node Explorer is a very useful tool that allows you to see all sorts of information about your node, for instance installed CorDapps and finalized transactions, and to start @StartableByRPC
flows whose constructor parameter types are compatible. You can see a video about its capabilities here.
Download it now.
Next, find the RPC username and password in /opt/corda/node.conf
. Then on the Node Explorer, connect with these parameters:
The rest of the GUI is self-explanatory.
The bootstrapper
For the audacious, you may consider creating a Testnet from scratch. This is in effect what you did in one click when running deployNodes
on your local machine. Now, with the bootstrapper you can accomplish the same and then distribute the created files to separate machines, i.e. VM’s.
Have a look at the documentation about how to generate the required network map files.
Deploy your CorDapp
You have a running Corda server with the CorDapps that came in by default. Now you want to put yours in.You already packaged the signed JAR and it is ready to be dropped in your node.
- First, stop the Corda runtime of your node. Either:
- With
sudo systemctl stop corda
in your VM’s terminal. - Or kill or CTRL-C the
corda.jar
process.
- Then add the new CorDapp JAR file(s) in the
cordapps
folder of your node. - Start the node. Either:
- With
sudo systemctl start corda
. - Or
sudo /opt/corda/run-corda/sh
. - Or
sudo -u corda java -jar /opt/corda/corda.jar
in a screen session.
Confirm success, for instance, by listing, in the node shell, the flows available.
Remove a CorDapp
Once you remove a contracts or flows CorDapp from your node, you will no longer be able to use the related states or flows. Note though, that a deleted contracts CorDapp may still be present in the attachments store, and may be downloaded again from another node as part of the verification of a transaction history.
To remove a CorDapp from your node:
- Make sure that there are no running flows that use the to-be-deleted CorDapp, by draining your node. If the flow on your node is a result of responding to a flow from another node, the initator flow must be killed as well. Otherwise it will be stuck waiting for your node’s response.
- Stop the Corda runtime of your node.
- Remove the CorDapp’s jar file from the
cordapps
folder. - Start the node.
Docker
R3 provides an official Docker image for Corda. You can find detailed instructions about running Corda with Docker here.
You can also watch an instructional video.