-
Notifications
You must be signed in to change notification settings - Fork 24
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
ES-1992: migrate to corda runtime plugin #122
Changes from 11 commits
65457dc
a92f663
d085180
fdc2284
a93e52f
cc51ed1
0716005
9b36681
909a209
6b91e3c
55ecbbd
c861d12
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,5 @@ | ||
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile | ||
|
||
import static org.gradle.api.JavaVersion.VERSION_17 | ||
|
||
plugins { | ||
|
@@ -6,40 +8,45 @@ plugins { | |
id 'org.jetbrains.kotlin.plugin.jpa' | ||
id 'java' | ||
id 'maven-publish' | ||
id 'net.corda.plugins.csde' | ||
id 'net.corda.gradle.plugin' | ||
} | ||
|
||
allprojects { | ||
group 'com.r3.developers.csdetemplate' | ||
group 'com.r3.developers.cordapptemplate' | ||
version '1.0-SNAPSHOT' | ||
|
||
def javaVersion = VERSION_17 | ||
|
||
// Configure the CSDE | ||
csde { | ||
// Configure Corda runtime gradle plugin | ||
cordaRuntimeGradlePlugin { | ||
notaryVersion = cordaNotaryPluginsVersion | ||
notaryCpiName = "NotaryServer" | ||
corDappCpiName = "MyCorDapp" | ||
cpiUploadTimeout = "30000" | ||
vnodeRegistrationTimeout = "60000" | ||
cordaProcessorTimeout = "300000" | ||
workflowsModuleName = "workflows" | ||
cordaClusterURL = "https://localhost:8888" | ||
cordaRestUser = "admin" | ||
cordaRestPasswd ="admin" | ||
composeFilePath = "config/combined-worker-kafka-compose.yaml" | ||
networkConfigFile = "config/static-network-config.json" | ||
r3RootCertFile = "config/r3-ca-key.pem" | ||
corDappCpiName = "MyCorDapp" | ||
notaryCpiName = "NotaryServer" | ||
cordaRpcUser = "admin" | ||
cordaRpcPasswd ="admin" | ||
workflowsModuleName = workflowsModule | ||
csdeWorkspaceDir = "workspace" | ||
notaryVersion = cordaNotaryPluginsVersion | ||
combinedWorkerVersion = combinedWorkerJarVersion | ||
postgresJdbcVersion = "42.4.3" | ||
cordaDbContainerName = "CSDEpostgresql" | ||
cordaBinDir = "${System.getProperty("user.home")}/$cordaBinariesDirectory" | ||
cordaCliBinDir = "${System.getProperty("user.home")}/$cordaCliBinariesDirectory" | ||
cpiUploadTimeout = cpiUploadDefault | ||
cordaProcessorTimeout = processorTimeout | ||
vnodeRegistrationTimeout = vnodeRegistrationTimeoutDefault | ||
skipTestsDuringBuildCpis = this.skipTestsDuringBuildCpis | ||
skipTestsDuringBuildCpis = "false" | ||
cordaRuntimePluginWorkspaceDir = "workspace" | ||
cordaBinDir = "${System.getProperty("user.home")}/.corda/corda5" | ||
cordaCliBinDir = "${System.getProperty("user.home")}/.corda/cli" | ||
|
||
// Alternatively, you can use a Database-only combined worker: | ||
// composeFilePath = "config/combined-worker-compose.yaml" | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We have an example of a Database-only compose file in the plugin's readme; the link to the readme was added to this repo's README. The question is - do we still want to provide a no-kafka example here in the template repo, including this comment and the compose yaml file in the config? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We should steer people to the Kafka enabled version, as it's quicker. We then offer the db only version to those who need it. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think it's fine to just have the Kafka version here. The non-Kafka version remains documented with the Gradle plugin. |
||
|
||
// Only need to supply these if you want to use an unpublished version | ||
artifactoryUsername = findProperty('cordaArtifactoryUsername') ?: System.getenv('CORDA_ARTIFACTORY_USERNAME') | ||
artifactoryPassword = findProperty('cordaArtifactoryPassword') ?: System.getenv('CORDA_ARTIFACTORY_PASSWORD') | ||
} | ||
|
||
// Declare the set of Kotlin compiler options we need to build a CorDapp. | ||
tasks.withType(org.jetbrains.kotlin.gradle.tasks.KotlinCompile).configureEach { | ||
tasks.withType(KotlinCompile).configureEach { | ||
kotlinOptions { | ||
allWarningsAsErrors = false | ||
|
||
|
@@ -85,20 +92,6 @@ allprojects { | |
password = findProperty('cordaArtifactoryPassword') ?: System.getenv('CORDA_ARTIFACTORY_PASSWORD') | ||
} | ||
} | ||
maven { | ||
// Quasar & Antlr | ||
url = "$artifactoryContextUrl/corda-dependencies-dev" | ||
authentication { | ||
basic(BasicAuthentication) | ||
} | ||
credentials { | ||
username = findProperty('cordaArtifactoryUsername') ?: System.getenv('CORDA_ARTIFACTORY_USERNAME') | ||
password = findProperty('cordaArtifactoryPassword') ?: System.getenv('CORDA_ARTIFACTORY_PASSWORD') | ||
} | ||
mavenContent { | ||
snapshotsOnly() | ||
} | ||
} | ||
} | ||
|
||
tasks.withType(Test).configureEach { | ||
|
@@ -110,7 +103,7 @@ allprojects { | |
publishing { | ||
publications { | ||
maven(MavenPublication) { | ||
artifactId "corda-CSDE-kotlin-sample" | ||
artifactId "corda-dev-template-kotlin-sample" | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'm not sure if this is being used anywhere; publishing is disabled in the pipeline There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I can't really see why it would ever be published. |
||
groupId project.group | ||
artifact jar | ||
} | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
version: '2' | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Let's just have the Kafka version... |
||
services: | ||
postgresql: | ||
image: postgres:14.10 | ||
restart: unless-stopped | ||
tty: true | ||
environment: | ||
- POSTGRES_USER=postgres | ||
- POSTGRES_PASSWORD=password | ||
- POSTGRES_DB=cordacluster | ||
ports: | ||
- 5432:5432 | ||
|
||
corda: | ||
image: corda-os-docker.software.r3.com/corda-os-combined-worker:5.2.0.0-RC02 | ||
depends_on: | ||
- postgresql | ||
environment: | ||
JAVA_TOOL_OPTIONS: -agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=*:5005 | ||
command: [ | ||
"-mbus.busType=DATABASE", | ||
"-spassphrase=password", | ||
"-ssalt=salt", | ||
"-ddatabase.user=user", | ||
"-ddatabase.pass=password", | ||
"-ddatabase.jdbc.url=jdbc:postgresql://postgresql:5432/cordacluster", | ||
"-ddatabase.jdbc.directory=/opt/jdbc-driver/" | ||
] | ||
ports: | ||
- 8888:8888 | ||
- 7004:7004 | ||
- 5005:5005 |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,72 @@ | ||
version: '2' | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I've got some ideas for improvements we can make with this file but they can wait for another day. |
||
services: | ||
postgresql: | ||
image: postgres:14.10 | ||
restart: unless-stopped | ||
tty: true | ||
environment: | ||
- POSTGRES_USER=postgres | ||
- POSTGRES_PASSWORD=password | ||
- POSTGRES_DB=cordacluster | ||
ports: | ||
- 5432:5432 | ||
|
||
kafka: | ||
image: confluentinc/cp-kafka:latest | ||
ports: | ||
- 9092:9092 | ||
environment: | ||
KAFKA_NODE_ID: 1 | ||
CLUSTER_ID: ZDFiZmU3ODUyMzRiNGI3NG | ||
KAFKA_PROCESS_ROLES: broker,controller | ||
KAFKA_CONTROLLER_QUORUM_VOTERS: 1@kafka:9093 | ||
KAFKA_LISTENERS: PLAINTEXT://0.0.0.0:9092,DOCKER_INTERNAL://0.0.0.0:29092,CONTROLLER://0.0.0.0:9093 | ||
KAFKA_ADVERTISED_LISTENERS: PLAINTEXT://localhost:9092,DOCKER_INTERNAL://kafka:29092 | ||
KAFKA_LISTENER_SECURITY_PROTOCOL_MAP: PLAINTEXT:PLAINTEXT,DOCKER_INTERNAL:PLAINTEXT,CONTROLLER:PLAINTEXT | ||
KAFKA_INTER_BROKER_LISTENER_NAME: DOCKER_INTERNAL | ||
KAFKA_CONTROLLER_LISTENER_NAMES: CONTROLLER | ||
KAFKA_OFFSETS_TOPIC_REPLICATION_FACTOR: 1 | ||
KAFKA_DEFAULT_REPLICATION_FACTOR: 1 | ||
KAFKA_TRANSACTION_STATE_LOG_REPLICATION_FACTOR: 1 | ||
KAFKA_TRANSACTION_STATE_LOG_MIN_ISR: 1 | ||
KAFKA_AUTO_CREATE_TOPICS_ENABLE: "true" | ||
|
||
kafka-create-topics: | ||
image: openjdk:17-jdk | ||
depends_on: | ||
- kafka | ||
volumes: | ||
- ${CORDA_CLI:-~/.corda/cli}:/opt/corda-cli | ||
working_dir: /opt/corda-cli | ||
command: [ | ||
"java", | ||
"-jar", | ||
"corda-cli.jar", | ||
"topic", | ||
"-b=kafka:29092", | ||
"create", | ||
"connect" | ||
] | ||
|
||
corda: | ||
image: corda-os-docker.software.r3.com/corda-os-combined-worker-kafka:5.2.0.0-RC02 | ||
depends_on: | ||
- postgresql | ||
- kafka | ||
- kafka-create-topics | ||
environment: | ||
JAVA_TOOL_OPTIONS: -agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=*:5005 | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This piece is missing in the examples provided in the plugin's readme. |
||
command: [ | ||
"-mbus.busType=KAFKA", | ||
"-mbootstrap.servers=kafka:29092", | ||
"-spassphrase=password", | ||
"-ssalt=salt", | ||
"-ddatabase.user=user", | ||
"-ddatabase.pass=password", | ||
"-ddatabase.jdbc.url=jdbc:postgresql://postgresql:5432/cordacluster", | ||
"-ddatabase.jdbc.directory=/opt/jdbc-driver/" | ||
] | ||
ports: | ||
- 8888:8888 | ||
- 7004:7004 | ||
- 5005:5005 |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
package com.r3.developers.csdetemplate.utxoexample.contracts | ||
package com.r3.developers.cordapptemplate.utxoexample.contracts | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. rename package - change There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Works for me There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Ditto |
||
|
||
import com.r3.developers.csdetemplate.utxoexample.states.ChatState | ||
import com.r3.developers.cordapptemplate.utxoexample.states.ChatState | ||
import net.corda.v5.base.exceptions.CordaRuntimeException | ||
import net.corda.v5.ledger.utxo.Command | ||
import net.corda.v5.ledger.utxo.Contract | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
previously this was the name of the repository; now it is a specific branch name where the code would live, and the target repo name