forked from hyperledger-cacti/cacti
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(connector-corda): support corda 5 RC via TS/HTTP (no JVM)
1. Update of Corda Cli from 'Corda V5.0.0.0-devpreview-1.0' to 'Corda V5.0.0.0' 2. Update the test samples from 'corda5-solarsystem-contracts-demo' to 'CSDE-cordapp-template-kotlin' Fixes hyperledger-cacti#1480 Co-authored-by: jagpreetsinghsasan [email protected] Signed-off-by: john.h.o.mantaring <[email protected]>
- Loading branch information
1 parent
97f17e0
commit 2376c3f
Showing
5 changed files
with
83 additions
and
91 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,84 +1,71 @@ | ||
FROM cruizba/ubuntu-dind:20.10.9 | ||
FROM docker:20.10.3-dind | ||
|
||
WORKDIR / | ||
RUN apk update | ||
RUN apk add py-pip python3-dev libffi-dev openssl-dev gcc libc-dev make | ||
|
||
RUN apt update | ||
RUN apt -y upgrade | ||
# Need curl for healthchecks | ||
RUN apk add --no-cache curl | ||
|
||
# # Install git so we can check out the corda5-solarsystem-contracts-demo repo of Corda | ||
RUN apt install -y git | ||
# Need to run shell script run.sh for Corda CLI | ||
RUN apk add --no-cache bash | ||
|
||
# Need curl to run healthchecks | ||
RUN apt install -y curl | ||
# The file binary is used to inspect exectubles when debugging container image issues | ||
RUN apk add --no-cache file | ||
RUN apk add --no-cache ca-certificates | ||
RUN apk add --no-cache tzdata | ||
RUN apk add --no-cache gnupg | ||
|
||
RUN export DEBIAN_FRONTEND=noninteractive \ | ||
&& apt-get -y install --no-install-recommends openjdk-11-jdk | ||
#----------------- INSTALLING CORDA CDSE PREREQUISITES -------------------- | ||
#-------------------------------------------------------------------------- | ||
|
||
# jq is needed by the /download-frozen-image-v2.sh script to pre-fetch docker images without docker. | ||
RUN apt install -y jq | ||
# Installing Zulu11 JDK | ||
RUN wget -P /etc/apk/keys/ \ | ||
https://cdn.azul.com/public_keys/[email protected] | ||
RUN echo "https://repos.azul.com/zulu/alpine" | tee -a /etc/apk/repositories | ||
RUN apk update | ||
RUN apk add --no-cache zulu11-jdk | ||
|
||
# Get the utility script that can pre-fetch the container images without | ||
# a functioning Docker daemon available which we do not have at image build | ||
# time so have to resort to manually get the images instead of just saying | ||
# "docker pull my/cool-image..." etc. | ||
# The reason to jump trough these hoops is to avoid DockerHub rate limiting issues | ||
RUN curl -sSL https://raw.githubusercontent.com/moby/moby/dedf8528a51c6db40686ed6676e9486d1ed5f9c0/contrib/download-frozen-image-v2.sh > /download-frozen-image-v2.sh | ||
RUN chmod +x /download-frozen-image-v2.sh | ||
RUN mkdir -p /etc/corda/corda-dev/ | ||
RUN /download-frozen-image-v2.sh /etc/corda/corda-dev/ corda/corda-dev:5.0.0-devpreview-1.0 | ||
# Installing Corda CLI | ||
RUN mkdir /platform-jars && \ | ||
wget -O /platform-jars/binary.tar.gz \ | ||
https://download.corda.net/c5-release-pack/E0b6f4f8-8907-47ae-b3cd-7f25ff756c2f-5.0.0-GA/platform-jars-5.0.0.tar.gz | ||
|
||
RUN curl https://download.corda.net/corda-cli/1.0.0-DevPreview/get-corda-cli.sh > /get-corda-cli.sh | ||
RUN chmod +x /get-corda-cli.sh | ||
RUN /get-corda-cli.sh | ||
RUN cd /platform-jars/ && \ | ||
tar -xvzf binary.tar.gz && \ | ||
cp net/corda/cli/deployment/corda-cli-installer/5.0.0.0/corda-cli-installer-5.0.0.0.zip . && \ | ||
unzip corda-cli-installer-5.0.0.0.zip -d corda-cli-installer && \ | ||
corda-cli-installer/./install.sh | ||
ENV PATH="$PATH:~/.corda/cli" | ||
|
||
RUN curl https://download.corda.net/cordapp-builder/5.0.0-DevPreview-1.0/cordapp-builder-installer.jar --output /cordapp-builder-installer.jar | ||
RUN java -jar /cordapp-builder-installer.jar | ||
#-------------------------------------------------------------------------- | ||
#-------------------------------------------------------------------------- | ||
|
||
RUN git clone https://github.com/corda/corda5-solarsystem-contracts-demo.git | ||
WORKDIR /corda5-solarsystem-contracts-demo | ||
# Installing CORDA CDSE | ||
RUN apk add --no-cache git | ||
RUN git clone https://github.com/corda/CSDE-cordapp-template-kotlin.git | ||
|
||
# Placing the ARG here instead of the top may seem like bad form, but it has | ||
# better build performance this way when we change the ARG's value it will | ||
# not spend 5 to 10 minutes installing the OS level dependencies on the top of | ||
# the image definition file because the cached layers will be the same for those. | ||
ARG SOLARSYSTEM_DEMO_SHA=a3be5ad48d249be7f71c5f15074c874dc0d09b41 | ||
RUN git checkout ${SOLARSYSTEM_DEMO_SHA} | ||
RUN cd CSDE-cordapp-template-kotlin/ && \ | ||
git checkout release/corda-5-0 | ||
|
||
RUN /root/bin/corda-cli/bin/corda-cli network config docker-compose solar-system | ||
RUN chmod +x gradlew | ||
RUN ./gradlew build | ||
RUN apk add --no-cache supervisor | ||
## Exposing the required ports 5005, 5432 and 8888 for CSDE | ||
## and 9001 for supervisor. Currently commented because of "--network host" being used to run the container | ||
# EXPOSE 5005 | ||
# EXPOSE 5432 | ||
# EXPOSE 8888 | ||
|
||
RUN /root/bin/corda-cli/bin/corda-cli network deploy -n solar-system -f solar-system.yaml > docker-compose.yaml | ||
# EXPOSE 9001 | ||
|
||
RUN sed -i 's+corda/corda-dev:latest+corda/corda-dev:5.0.0-devpreview-1.0+g' /corda5-solarsystem-contracts-demo/docker-compose.yaml | ||
COPY supervisord.conf /etc/supervisord.conf | ||
|
||
RUN /root/.local/lib/cordapp-builder/bin/cordapp-builder create --cpk contracts/build/libs/corda5-solar-system-contracts-demo-contracts-1.0-SNAPSHOT-cordapp.cpk --cpk workflows/build/libs/corda5-solar-system-contracts-demo-workflows-1.0-SNAPSHOT-cordapp.cpk -o solar-system.cpb | ||
COPY start-services.sh /start-services.sh | ||
RUN chmod +x /start-services.sh | ||
|
||
# OpenSSH server | ||
EXPOSE 22 | ||
WORKDIR /CSDE-cordapp-template-java/ | ||
|
||
# supervisord web ui/dashboard | ||
EXPOSE 9001 | ||
|
||
# earth-node RPC | ||
EXPOSE 12112 | ||
|
||
# mars-node RPC | ||
EXPOSE 12116 | ||
|
||
# pluto-node RPC | ||
EXPOSE 12119 | ||
|
||
# notary-node RPC | ||
EXPOSE 12122 | ||
|
||
COPY ./start-services.sh /start-services.sh | ||
|
||
COPY ./supervisor/ /etc/supervisor/conf.d/ | ||
# Extend the parent image's entrypoint | ||
# https://superuser.com/questions/1459466/can-i-add-an-additional-docker-entrypoint-script | ||
ENTRYPOINT ["/usr/bin/supervisord"] | ||
CMD ["--nodaemon"] | ||
CMD ["--configuration", "/etc/supervisord.conf", "--nodaemon"] | ||
|
||
# Add our healthcheck script that determines when do we consider the container healthy | ||
COPY healthcheck.sh / | ||
HEALTHCHECK --interval=2s --timeout=5s --start-period=30s --retries=180 CMD /healthcheck.sh | ||
#RUN ~/bin/corda-cli/bin/corda-cli package install -n solar-system solar-system.cpb | ||
HEALTHCHECK --interval=10s --timeout=5s --start-period=100s --retries=1000 CMD [ -f 5vNodeSetupdone.txt ] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
# Instructions to compile and run the new Corda v5.0 test network | ||
|
||
To create an image of the dockerfile run: | ||
`DOCKER_BUILDKIT=1 docker build ./tools/docker/corda-all-in-one/corda-v5 -t newcordaimg` | ||
|
||
To run the AIO, execute: | ||
`docker run -it --rm --privileged -v /var/run/docker.sock:/var/run/docker.sock --network host -d newcordaimg` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,14 @@ | ||
#!/bin/bash | ||
set -e | ||
|
||
# Load the cached container images into the Docker Daemon before launching | ||
# the Docker Compose network. This is the preferred workaround to synchronizing | ||
# different processes of a supervisord configuration | ||
tar -cC '/etc/corda/corda-dev/' . | docker load | ||
|
||
# Now that the images are cached **and** loaded to the daemon, we can start the | ||
# corda network via the docker-compose file and it will not need to download | ||
# anything from DockerHub (if it does, that's a bug) | ||
supervisorctl start corda5-solarsystem-contracts-demo-network | ||
cd /CSDE-cordapp-template-kotlin/ | ||
while true; do | ||
echo "Waiting for startCorda to execute..." | ||
if ./gradlew listVNodes | grep "X500"; then | ||
echo "Starting v5NodeSetup..."; | ||
./gradlew 5-vNodeSetup | ||
break; | ||
fi | ||
sleep 5; | ||
done | ||
touch 5vNodeSetupdone.txt |
23 changes: 10 additions & 13 deletions
23
...5-solarsystem-contracts-demo-network.conf → ...orda-all-in-one/corda-v5/supervisord.conf
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters