Skip to content

Commit f52c00e

Browse files
committed
feat(tools): corda AIO start/stop per node #686
With this change the users of the Corda AIO image can decide which nodes to launch (A,B,C,Notary) exactly. Adds scripts to launch individual nodes as needed. Before this we could only launch all the nodes at once which did not work out well because it caused race conditions in the cordapp jar deployment code. This revision is tagged in the container registry as: hyperledger/cactus-corda-4-6-all-in-one-obligation:2021-03-19-feat-686 Fixes #686 Signed-off-by: Peter Somogyvari <[email protected]>
1 parent 529dcaf commit f52c00e

File tree

7 files changed

+92
-29
lines changed

7 files changed

+92
-29
lines changed

tools/docker/corda-all-in-one/Dockerfile

+8-3
Original file line numberDiff line numberDiff line change
@@ -96,8 +96,8 @@ EXPOSE 10014
9696
# Corda IOU Web GUIs for Node A,B,C
9797
# EXPOSE 10009 10012 10015
9898

99-
# Jolokia
100-
# EXPOSE 7005 7006 7007 7008
99+
# Jolokia for Party A,B,C and Notary
100+
EXPOSE 7005 7006 7007 7008
101101

102102
# P2P messaging (localhost bound), RPC, admin RPC
103103
# EXPOSE 10002 10003 10103
@@ -106,10 +106,13 @@ EXPOSE 10014
106106
# EXPOSE 10013 10014 10114
107107

108108
COPY supervisord.conf /etc/supervisord.conf
109-
COPY run-corda-network.sh /
110109
COPY run-party-a-server.sh /
111110
COPY run-party-b-server.sh /
112111
COPY run-party-c-server.sh /
112+
COPY run-party-a-node.sh /
113+
COPY run-party-b-node.sh /
114+
COPY run-party-c-node.sh /
115+
COPY run-notary-node.sh /
113116
COPY healthcheck.sh /
114117

115118
# By default we only run the absolute minimum which is a single party's node.
@@ -126,6 +129,8 @@ ENV PARTY_B_WEB_SRV_ENABLED="false"
126129
ENV PARTY_C_NODE_ENABLED="true"
127130
ENV PARTY_C_WEB_SRV_ENABLED="false"
128131

132+
ENV NOTARY_NODE_ENABLED="true"
133+
129134
# Extend the parent image's entrypoint
130135
# https://superuser.com/questions/1459466/can-i-add-an-additional-docker-entrypoint-script
131136
ENTRYPOINT ["/usr/bin/supervisord"]

tools/docker/corda-all-in-one/run-corda-network.sh

-19
This file was deleted.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
#!/bin/sh
2+
set -e
3+
4+
if [ "$NOTARY_NODE_ENABLED" = "true" ]
5+
then
6+
java \
7+
-Dcapsule.jvm.args="-agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=5008 -javaagent:drivers/jolokia-jvm-1.6.0-agent.jar=port=7008,logHandlerClass=net.corda.node.JolokiaSlf4jAdapter" \
8+
-Dname=Notary \
9+
-jar \
10+
/samples-kotlin/Advanced/obligation-cordapp/build/nodes/Notary/corda.jar
11+
else
12+
sleep infinity
13+
fi
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
#!/bin/sh
2+
set -e
3+
4+
if [ "$PARTY_A_NODE_ENABLED" = "true" ]
5+
then
6+
java -Dcapsule.jvm.args="-agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=5005 -javaagent:drivers/jolokia-jvm-1.6.0-agent.jar=port=7005,logHandlerClass=net.corda.node.JolokiaSlf4jAdapter" -Dname=ParticipantA -jar /samples-kotlin/Advanced/obligation-cordapp/build/nodes/ParticipantA/corda.jar
7+
else
8+
sleep infinity
9+
fi
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
#!/bin/sh
2+
set -e
3+
4+
if [ "$PARTY_B_NODE_ENABLED" = "true" ]
5+
then
6+
java -Dcapsule.jvm.args="-agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=5006 -javaagent:drivers/jolokia-jvm-1.6.0-agent.jar=port=7006,logHandlerClass=net.corda.node.JolokiaSlf4jAdapter" -Dname=ParticipantB -jar /samples-kotlin/Advanced/obligation-cordapp/build/nodes/ParticipantB/corda.jar
7+
else
8+
sleep infinity
9+
fi
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
#!/bin/sh
2+
set -e
3+
4+
if [ "$PARTY_C_NODE_ENABLED" = "true" ]
5+
then
6+
java \
7+
-Dcapsule.jvm.args="-agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=5007 -javaagent:drivers/jolokia-jvm-1.6.0-agent.jar=port=7007,logHandlerClass=net.corda.node.JolokiaSlf4jAdapter" \
8+
-Dname=ParticipantC \
9+
-jar \
10+
/samples-kotlin/Advanced/obligation-cordapp/build/nodes/ParticipantC/corda.jar
11+
else
12+
sleep infinity
13+
fi

tools/docker/corda-all-in-one/supervisord.conf

+40-7
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,9 @@ supervisor.rpcinterface_factory = supervisor.rpcinterface:make_main_rpcinterface
1010
[supervisorctl]
1111
serverurl=http://127.0.0.1:9001
1212

13+
[inet_http_server]
14+
port = 0.0.0.0:9001
15+
1316
[program:sshd]
1417
command=/usr/sbin/sshd -D -ddd
1518
autostart=true
@@ -30,10 +33,44 @@ stdout_logfile_maxbytes=0
3033
stderr_logfile=/dev/stderr
3134
stderr_logfile_maxbytes=0
3235

33-
[program:corda-network]
34-
command=/run-corda-network.sh
36+
[program:corda-a]
37+
directory=/samples-kotlin/Advanced/obligation-cordapp/build/nodes/ParticipantA/
38+
command=/run-party-a-node.sh
3539
autostart=true
36-
autorestart=unexpected
40+
autorestart=false
41+
exitcodes=0
42+
stdout_logfile=/dev/stdout
43+
stdout_logfile_maxbytes=0
44+
stderr_logfile=/dev/stderr
45+
stderr_logfile_maxbytes=0
46+
47+
[program:corda-b]
48+
directory=/samples-kotlin/Advanced/obligation-cordapp/build/nodes/ParticipantB
49+
command=/run-party-b-node.sh
50+
autostart=true
51+
autorestart=false
52+
exitcodes=0
53+
stdout_logfile=/dev/stdout
54+
stdout_logfile_maxbytes=0
55+
stderr_logfile=/dev/stderr
56+
stderr_logfile_maxbytes=0
57+
58+
[program:corda-c]
59+
directory=/samples-kotlin/Advanced/obligation-cordapp/build/nodes/ParticipantC
60+
command=/run-party-c-node.sh
61+
autostart=true
62+
autorestart=false
63+
exitcodes=0
64+
stdout_logfile=/dev/stdout
65+
stdout_logfile_maxbytes=0
66+
stderr_logfile=/dev/stderr
67+
stderr_logfile_maxbytes=0
68+
69+
[program:corda-n]
70+
directory=/samples-kotlin/Advanced/obligation-cordapp/build/nodes/Notary
71+
command=/run-notary-node.sh
72+
autostart=true
73+
autorestart=false
3774
exitcodes=0
3875
stdout_logfile=/dev/stdout
3976
stdout_logfile_maxbytes=0
@@ -69,7 +106,3 @@ stdout_logfile=/dev/stdout
69106
stdout_logfile_maxbytes=0
70107
stderr_logfile=/dev/stderr
71108
stderr_logfile_maxbytes=0
72-
73-
[inet_http_server]
74-
port = 0.0.0.0:9001
75-

0 commit comments

Comments
 (0)