Upgrading to Contour 8.0
This guide is for upgrading from Contour v7.0 to Contour v8.0, with assumption that Contour v7.0 is running on the recommended Corda Enterprise version (CE4.8).
Contour releases strive to be backwards compatible, and use Liquibase for the Database schema versioning. With Corda Enterprise and Springboot supporting Liquibase, upgrading a Contour node is fairly straightforward.
- Corda Open Source (OS) doesn't support Liquibase. Therefore, if a node is running on Corda OS, the nodes needs to be upgraded to CE first, before upgrading Contour version.
Upgrading Contour consistis of the following steps:
- Stop the node
- [IMPORTANT] Back up the node directories AND database
- Upgrade Contour Cordapps
- Upgrade Contour Web Apps
Step 1. Stop the node
Stop the node in the sequence that:
- Stop the Contour Web Application, e.g.
systemctl stop contour.service
if using systemd - Drain the Corda node
- Connect to the Corda Shell using the command
ssh -p [sshd portNumber] [rpc username]@[host, e.g. localhost]
- e.g.
ssh -p 2222 cordau@localhost
- e.g.
- Key in rpc userpassword as specified in the Corda
node.conf
- Run the command
run setFlowsDrainingModeEnabled enabled: true
to do a flow drain - Run the command
run stateMachinesSnapshot
to check that there is no in-flight flows- If the result is empty list
[]
, it means all flows have completed, proceed to stop the Corda node - If the result is not an empty list, which means there are some in-flight flows as listed in the result, wait until these flows complete, and/or investigate why they are stuck and whether safe to kill.
- If the result is empty list
- Connect to the Corda Shell using the command
- Once all flows have completed, stop the Corda node, e.g.
systemctl stop corda.service
if using systemd
Step 2. Backup the node
[IMPORTANT] Any upgrade, especially database schema migration, come with risk. Thus, it's very important that the node is back up before upgrading. With backup, a node can be restored fairly easily.
- Backup the Contour Web App folder directory, e.g.
cp -R api-service/ api-service-<version>-backup/
; - Backup the Corda folder directory, e.g.
cp -R corda/ corda-<version>-backup/
; - Backup the Contour Web App database and Corda database, Backup recommendations.
Reference to restore a corda node: Backup and restoration of a Corda node
Step 3. Upgrade Contour Cordapps
Contour v8.0 runs on Corda Enterprise (CE) 4.8.6, same as Contour v7.0.
3.1. Replace Cordapps Jars
Under the corda > cordapps directory, e.g. /opt/corda/cordapps
:
- Delete the old version jars
- All the
Flow
jars:rm contour-cordapp-<oldversion>.jar
- All the
Contracts and States
jar:rm contour-cordapp-contracts-and-states-<oldversion>.jar
- All the
- Copy & paste in all the new version jars from Contour release package,
contour-<version>/corda/cordapps/
.- All the
Flow
jars:contour-cordapp-<newversion>.jar
contour-business-tools-<newversion>.jar
corda-tools-metering-collector-<newversion>.jar
- All the
Contracts and States
jar:contour-cordapp-contracts-and-states-<newversion>.jar
- All the
3.2. Update Cordapp config
The following two (2) flow jars require configurations:
contour-cordapp-<newversion>.jar
corda-tools-metering-collector-<newversion>.jar
Corda will automaticially match each flow jar to its configuration under the corda > cordapps > config directory (e.g. /opt/corda/cordapps/config
), based on the flow jar name. Therefore, the configuration files must be named correctly, matching to the flow jar name. i.e.
contour-cordapp-<newversion>.conf
forcontour-cordapp-<newversion>.jar
corda-tools-metering-collector-<newversion>.conf
forcorda-tools-metering-collector-<newversion>.jar
Therefore, the steps to update the configuration will be:
- Rename the config file name for flow jar
contour-cordapp-<newversion>.jar
to match the new version, i.e. fromcontour-cordapp-<oldversion>.conf
tocontour-cordapp-8.0.0.conf
.- No change in the
contour-cordapp-<version>.conf
in v8.0.0 required, compared to v7.0.0. - Refer to Contour Corda Config for more details about the configuration parameters
- No change in the
- No change for config file name for flow jar
corda-tools-metering-collector-<version>.jar
- No change in the
contour-cordapp-<version>.conf
in v8.0.0 required, compared to v7.0.0. - Refer to Contour Corda Config for more details about the configuration parameters
- No change in the
3.3. Update the database
Start the node with the run-migration-scripts
sub-command with --core-schemas
and --app-schemas
.
- Command:
java -jar corda-4.8.6.jar run-migration-scripts --core-schemas --app-schemas
The node will perform any automatic data migrations required, which may take some time. If the migration process is interrupted it can be continued simply by starting the node again, without harm. The node will stop automatically when migration is complete.
3.4. Start Corda in the normal way
Start the Corda in the normal way, e.g.
java -jar corda-4.8.6.jar --base-directory /opt/corda --config-file /opt/corda/node.conf
; orsystemctl start corda.service
if using systemd
3.5. Undrain the node
You may now do any checks that you wish to perform, read the logs, and so on. When you are ready, use this command at the Corda shell: run setFlowsDrainingModeEnabled enabled: false
Step 4. Upgrade Contour WebApp
4.1. Replace Web App
Under the contour webapp directory, e.g. /opt/api-services
:
- Delete the old version jar and static asset
- Sprint Boot jar:
rm contour-service-<oldversion>.jar
; and - Static asset folder:
rm -rf static/
- Sprint Boot jar:
- Copy & paste in the new version of Contour web app jar and static asset folder from Contour release package,
contour-<version>/api-service/
- Sprint Boot jar:
contour-service-<newversion>.jar
and - Static asset folder:
static/
- Sprint Boot jar:
4.2. Update WebApp configuration
Update the Contour Web APP (Spring Boot) configuration (if necessary)
- The new field to add in the application.properties file when upgrading from
7.0
to8.0
:contour.pdf.renderer=openhtmltopdf
- Add
spring.resources.add-mappings=false
in application.properties file if it's not there - Refer to Contour WebApp Config for more details about the configuration parameters
4.3. Start Contour Web App
Start the Contour web app as normal, e.g.
java -jar contour-service-<newversion>.jar -Dspring.profiles.active=local,CentralPortal,hascorda,prod,auth
; orsystemctl start contour.service
if using systemd
Spring Boot will handle the Liquibase database schema migration.