Coder Social home page Coder Social logo

corda-deployment's Introduction

Project - Corda Deployment Test

This is a repository for Project Ubin containing collection of scripts to set up a network and perform deployment for Corda workstream.

Getting Started

To get started, clone this repository with:

$ git clone https://github.com/duhd/corda-deployment.git

Set Up New Network

Note: Following steps have been tested in Ubuntu 16.04 LTS

A. Pre-Requisites

You will need the following components set up/installed:

  • Server lists: Hostname OS Cấu hình Site Listen Port
  1. Corda_NetworkMap Ubuntu (Xenial - LTS 16.04) 4 Core; 4 GB RAM; HDD 40GB VNPAY 22;80;443;10002;10003;10004
  2. Corda_Notary Ubuntu (Xenial - LTS 16.04) 32 Core; 16 GB RAM; HDD 40GB VNPAY 22;80;443;10002;10003;10005
  3. Corda_SBV Ubuntu (Xenial - LTS 16.04) 8 Core; 8 GB RAM; HDD 40GB GDS 22;80;443;10002;10003;10006
  4. Corda_VNPAY Ubuntu (Xenial - LTS 16.04) 8 Core; 8 GB RAM; HDD 40GB VNPAY 22;80;443;10002;10003;10007
  5. Codra_BankA Ubuntu (Xenial - LTS 16.04) 32 Core; 16 GB RAM; HDD 40GB VNPAY 22;80;443;10002;10003;10008
  6. Codra_BankB Ubuntu (Xenial - LTS 16.04) 32 Core; 16 GB RAM; HDD 40GB GDS 22;80;443;10002;10003;10009
  7. Codra_BankC Ubuntu (Xenial - LTS 16.04) 32 Core; 16 GB RAM; HDD 40GB GDS 22;80;443;10002;10003;10010
  8. Corda_Operation Ubuntu (Xenial - LTS 16.04) 4 Core; 4 GB RAM; HDD 40GB VNPAY 22;80;443;3128;
  • JDK 8 installed and available on your path.
  • Git

B. Network setup step:

  1. Set up network map
  2. Set up notary
  3. Set up bank nodes

The script configure.sh from corda-deployment repository takes in 5 input parameters:

  • Node type (value: networkmap, notary, node)
  • Virtual machine (VM) username
  • Network Map Name
  • Notary type (default value is "nonValidating")
  • Network Map IP address

1. Set Up Network Map

1. SSH to Network Map virtual machine.

2. Clone corda-deployment repository

$ git clone https://github.com/duhd/corda-deployment.git

3. Determine network map node name (e.q. Network Map)

4. Get virtual machine IP address with following command:

$ hostname -i

5. Execute configure.sh script with:

$ sudo ./configure.sh networkmap <<VM Username>> <<Network Map Name>> nonValidating <<Network Map IP>>

Example:

# Network map name is "Network Map"
# Network map IP address is "10.0.0.47"
# VM username is "corda"

chmod +x configure.sh
sudo ./configure.sh networkmap corda "Network Map" nonValidating 10.0.0.47

Note: Network map IP address is required in the set up of notary node and additional bank nodes

2. Set Up Notary

1. SSH to Notary virtual machine.

2. Clone corda-deployment repository

$ git clone https://github.com/duhd/corda-deployment.git

3. Determine Notary node name (e.g. Notary)

4. Get network map IP Address from the previous step (network map setup).

5. Execute configure.sh script with:

$ sudo ./configure.sh networkmap <<VM Username>> <<Network Map Name>> nonValidating <<Network Map IP>>>

Example:

# Notary name is "Corda_Notary"
# Network map IP address is "10.0.0.47"
# VM username is "corda"
$ chmod +x configure.sh
$ sudo ./configure.sh notary corda "Corda_Notary" nonValidating 10.0.0.47

3. Set Up Bank Nodes

1. SSH to bank nodes virtual machine.

2. Clone corda-deployment repository

$ git clone https://github.com/duhd/corda-deployment.git

3. Determine bank node name (usually the bank SWIFT code).

4. Get network map IP Address from the previous step (network map setup).

5. Go to corda-deployment directory.

6. Verify config.properties to ensure ApproveRedeemURI is configured with the Central Bank domain name.

ApproveRedeemURI=http://<<centralbankdomain>>:9001/meps/redeem

7. Execute configure.sh script with:

$ sudo ./configure.sh notary <<VM Username>> <<Notary Name>> nonValidating <<Network Map IP>>

Example:

# Nodename name is "Corda_BankA"
# Network map IP address is "10.0.0.47"
# VM username is "corda"

$ chmod +x configure.sh
$ sudo ./configure.sh node corda "Corda_BankA" nonValidating 10.0.0.47

Note: do not name the Corda node with a name containing "node".

Central Deployment and Server Admin

A. CorDapp Deployment

1. Copy CorDapp JARs into VM Node 0 into the following directory with SCP/FTP:

/home/corda/corda-deployment/plugin

2. Log in to VM Node 0 using SSH 3. Go to corda-deployment directory

4. Execute manage.sh to deploy CorDapp to all nodes in the network except the Notary and the Network Map. The script assumes that the nodes are named sequentially (e.g. 0 to 12):

$ ./manage.sh deploy 0 12

This step does the following:

  • Delete everything in /app/corda/plugins
  • Copy all files from Node 0's /home/corda/deploy to the target node's /app/corda/plugins folder
  • Restart Corda and webserver in the node
  • Repeat for selected Nodes

Note: 0 and 12 in Step 4 represents the range of nodes. If you only require deployment on nodes 2-4, change the parameters to "deploy 2 4".

B. Restart All Nodes

1. Log in to VM Node 0 using SSH 2. Go to corda-deployment directory 3. Execute manage.sh to restart all nodes in the network (e.g. Node 0 - Node 12):

$ ./manage.sh restart 0 12

Note: 0 and 12 in Step 3 represents the range of nodes. If you only require deployment on nodes 2-4, change the parameters to "deploy 2 4".

C. Stop All Nodes

1. Log in to VM Node 0 using SSH 2. Go to corda-deployment directory 3. Execute manage.sh to stop all nodes in the network (e.g. Node 0 - Node 12):

$ ./manage.sh stop 0 12

Note: 0 and 12 in Step 3 represents the range of nodes. If you only require deployment on nodes 2-4, change the parameters to "deploy 2 4".

D. Clear All Data in Vault

1. Log in to VM Node 0 using SSH 2. Check that you are in /home/corda 3. Go to corda-deployment 4. Stop all Corda nodes (node 0 to 12) using:

$ ./manage.sh stop 0 12

5. Clear all data in network (node 0 to 12) - note that the data is not recoverable:

$ ./manage.sh reset 0 12

6. Restart all nodes 0 to 12:

$ ./manage.sh restart 0 12

E. Update Node Names

1. Stop the Corda server and webserver 2. Go to /app/corda 3. Update node.conf with command:

$ vi node.conf

4. Change myLegalName in "O" key :

"O=BANKA, L=Hanoi, C=Vietnam"

5. Delete the certificates folder. The certificates will be regenerated automatically upon Corda server start up 6. To purge the old entries in the Network Map, login to the h2 DB of the Network Map (nm0) and delete the old entries in NODE_NETWORK_MAP_NODES table

Note:

As of Corda v1.0, 'CN' / Common Name field in the X500 is no longer supported. It is used only for services identity. In addition, words such as "node" is blacklisted in CordaX500Name and therefore should not be used.

License

Copyright 2017 The Association of Banks in Singapore

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

 http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.