Cordapp migration from open source to enterprise - corda

We are looking for migration of Corda open source to Enterprise. As part of this migration we need to deploy the Cordapp which was there in the open source to Enterprise. Are there any document available for reference on the challenges or issues faced during Cordapp deployment.

When you want to upgrade from Corda OS to Corda Enterprise you have to consider following items:
1. Corda Node Upgrade
2. Corda Database Upgrade
3. CorDapp Upgrade
4. Corda Constraint Migration (if you are not using Signature Constraints)
For Corda node and CordDapp upgrade refer to this [blog][1].
For Database migration refer to [this][2] and [this][3] blog.
For Corda Constarint migration refer to [this][4] blog.
There are also some videos which show you how to perform the migration. take a look here-
1. https://www.youtube.com/watch?v=rWyJRaoWNhc&t=1186s
2. https://www.youtube.com/watch?v=gs6yGZnDW5g
3. https://www.youtube.com/watch?v=0BKUUY4Tg20&t=84s
4. https://www.youtube.com/watch?v=69un7I-Amwc&t=622s
If you face any difficulty you can get in touch with me on [slack][5].
[1]: https://medium.com/corda/contract-upgrades-and-constraints-in-corda-425055a9a47f
[2]: https://medium.com/corda/cordapp-database-upgrade-migration-development-perspective-c2931e28b9b4
[3]: https://medium.com/corda/cordapp-database-upgrade-migration-production-perspective-5f655838492d
[4]: https://medium.com/corda/unconstraint-signature-constraint-migration-e95a66789eab
[5]: https://join.slack.com/t/cordaledger/shared_invite/zt-qg4fft35-ldb97HIf74gImY9XuGybUg

Related

How to update the state and schema in Cordapp?

In corda dev mode,
For Example I have created a state with 3 Params, also with Schema for the state.
I have build the project and running it.
Due to the business need to need to 2 more params.
Below are the points I have understood from the corda docs.
Change the state.
Change the schema
Change the contract
Contract and state upgrade flow
I understood the existing states are updated with the new contract constraint.
Will the schema's gets updated by itself during the start of the node by giving {runMigrations=true}
Need help.
Firstly runMigrations property is used only for Corda Enterprise and not for Corda Open Source.
Take a look at the node configs available in enterprise and open source.
https://docs.corda.net/docs/corda-enterprise/4.3/corda-configuration-file.html#database-properties-ref
https://docs.corda.net/docs/corda-os/4.3/corda-configuration-file.html
Performing state upgrades is handled differently in open source and enterprise.
In Enterprise version, the tables are created as liquibase tables and liquibase is used to perform autotmatic database migration.
In Open source, liquibase is not used and tables are created as hibernate entities.
To do a state upgrade, you can add the three new params to your state, build the new jar, replace the old jar with the new one, and hibernate will take care of adding these new columns to the table. One more point on this is that even Hibernate advises not to use Hibernate to modify schema/data migration, so I would recommend you to create your own sql script and run it on the database. (This is done automatically by liquibase in the enterprise)
With corda 4 using signature constraints upgrade is easy, replace old jar with new jar(new jar has to be signed with the same signature used fro signing old jar), start the node. So you do not have to do the complex contract upgrade process.

What is the current version of the corda accounts library?

I cannot create a new AccountInfo. I have set up the corda accounts library to version 1.0-RC01 and am running into:
java.lang.NoClassDefFoundError: com/r3/corda/lib/accounts/contracts/states/AccountInfo
Accounts SDK is still at the development stage. There is no guarantee of functional stability. We also did not release any official "versions" with the account SDK.

How to get config file for Cordapp?

How to get config file for Cordapp in Java like in sample?
serviceHub.getAppContext().config
After getAppContext() i can't find anything about config file.
This feature is not available in Corda 3. As of this answer, it is only part of the unstable master branch. It will be included in a future release of Corda.
However, you can implement this manually for now as follows: How to provide a CorDapp with custom config in Corda?.

Is mariadb-java-client 2.2.3 compatible with MySQL 8.0?

I'm using mariadb-java-client 2.2.3 to connect to a MySQL server 8.0.11. I'm also using spring-boot 2.0.2. for the application.
On application startup, I'm getting the following execption:
java.sql.SQLException: (conn=9) Unknown system variable 'tx_isolation'
at org.mariadb.jdbc.internal.util.exceptions.ExceptionMapper.get(ExceptionMapper.java:198) ~[mariadb-java-client-2.2.3.jar:na]
at org.mariadb.jdbc.internal.util.exceptions.ExceptionMapper.getException(ExceptionMapper.java:110) ~[mariadb-java-client-2.2.3.jar:na]
at org.mariadb.jdbc.MariaDbStatement.executeExceptionEpilogue(MariaDbStatement.java:228) ~[mariadb-java-client-2.2.3.jar:na]
at org.mariadb.jdbc.MariaDbStatement.executeInternal(MariaDbStatement.java:334) ~[mariadb-java-client-2.2.3.jar:na]
at org.mariadb.jdbc.MariaDbStatement.executeQuery(MariaDbStatement.java:505) ~[mariadb-java-client-2.2.3.jar:na]
at org.mariadb.jdbc.MariaDbConnection.getTransactionIsolation(MariaDbConnection.java:859) ~[mariadb-java-client-2.2.3.jar:na]
According to the MySQL link below, the system variable 'tx_isolation' that was previously deprecated has now been removed. 'transaction_isolation' should be used instead.
https://dev.mysql.com/doc/relnotes/mysql/8.0/en/news-8-0-3.html
Is there a workaround for this issue?
Thanks.
There is no workaround for the moment. Issue has been created on https://jira.mariadb.org/browse/CONJ-604 to handle that for next version 2.2.5.
Currently, MySQL 8.0 is not supported (some tests even freeze the server), so waiting version to be more stable (and a working docker image to test properly with CI).
For people who switch from MySql to MariaDb on their existing SpringBoot project, and face the same issue:
Upgrading mariadb-java-client to 2.6.0+, in your pom.xml solve the issue (most tutorial on the net has 2.1).

FlyWay: Why are schemas not created when setInitOnMigrate is set?

Scenario:
Existing database with one schema, the transport schema.
2 migration files where version 1 is the initial / base version. Version 2 adds a table to the management schema (but does not create that schema, I want FlyWay to do that).
Using FlyWay API (in Java application)
//...
flyway.setSchemas("transport", "management");
flyway.setInitVersion("1");
flyway.setInitOnMigrate(true);
flyway.migrate();
migration version 2 fails because the management schema has not being created. This succeeds as expected on a clean database.
I get the same problem when executing migrations via the maven plugin.
<configuration>
...
<schemas>
<schema>transport</schema>
<schema>management</schema>
</schemas>
</configuration>
...
mvn flyway:init -Dflyway.initVersion=1 -Dflyway.initDescription="Base version"
mvn flyway:migrate
Seems like if you are using FlyWay with an existing database, you then lose the ability to have FlyWay manage additional schemas.
This is currently not supported. At this point it is an all or nothing deal. Please file a feature request in the issue tracker.

Resources