Skip to content

Commit 959b048

Browse files
Brad McDermottfixanoid
Brad McDermott
authored andcommitted
Adds cakeshop to Vagrantfile, init scripts, optional start script, ad… (#208)
1 parent 594779e commit 959b048

14 files changed

+288
-2
lines changed

Vagrantfile

+2
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,8 @@ Vagrant.configure(2) do |config|
2222
config.vm.network "forwarded_port", guest: 9086, host: 9086
2323
config.vm.network "forwarded_port", guest: 9087, host: 9087
2424

25+
# Cakeshop
26+
config.vm.network "forwarded_port", guest: 8999, host: 8999
2527

2628
config.vm.provider "virtualbox" do |v|
2729
v.memory = 6144

docker-compose.yml

+36
Original file line numberDiff line numberDiff line change
@@ -203,6 +203,30 @@ x-tx-manager-def:
203203
exit 1
204204
;;
205205
esac
206+
x-cakeshop-def:
207+
&cakeshop-def
208+
image: "${CAKESHOP_DOCKER_IMAGE:-quorumengineering/cakeshop:0.11.0-RC2}"
209+
expose:
210+
- "8999"
211+
restart: "no"
212+
healthcheck:
213+
test: ["CMD", "wget", "--spider", "--proxy=off", "http://localhost:8999/actuator/health"]
214+
interval: 5s
215+
timeout: 5s
216+
retries: 20
217+
start_period: 5s
218+
entrypoint:
219+
- /bin/sh
220+
- -c
221+
- |
222+
DDIR=/qdata/cakeshop/local
223+
rm -rf $${DDIR}
224+
mkdir -p $${DDIR}
225+
DOCKER_IMAGE="${CAKESHOP_DOCKER_IMAGE:-quorumengineering/cakeshop:0.11.0-RC2}"
226+
cp /examples/cakeshop/application.properties.template $${DDIR}/application.properties
227+
cp /examples/cakeshop/7nodes_docker.json $${DDIR}/7nodes.json
228+
java -Xms128M -Xmx128M -Dcakeshop.config.dir=/qdata/cakeshop -Dlogging.path=/qdata/logs/cakeshop -jar /opt/cakeshop/cakeshop.war
229+
;;
206230
services:
207231
node1:
208232
<< : *quorum-def
@@ -407,6 +431,17 @@ services:
407431
ipv4_address: 172.16.239.107
408432
environment:
409433
- NODE_ID=7
434+
cakeshop:
435+
<< : *cakeshop-def
436+
hostname: cakeshop
437+
ports:
438+
- "8999:8999"
439+
volumes:
440+
- cakeshopvol:/qdata
441+
- ./examples/7nodes:/examples:ro
442+
networks:
443+
quorum-examples-net:
444+
ipv4_address: 172.16.239.186
410445
networks:
411446
quorum-examples-net:
412447
name: quorum-examples-net
@@ -423,3 +458,4 @@ volumes:
423458
"vol5":
424459
"vol6":
425460
"vol7":
461+
"cakeshopvol":

examples/7nodes/README.md

+4
Original file line numberDiff line numberDiff line change
@@ -191,3 +191,7 @@ MISCELLANEOUS OPTIONS:
191191
Additional samples can be found in `quorum-examples/examples/7nodes/samples` for you to use and edit. You can also create your own contracts to help you understand how the nodes in a Quorum network work together.
192192

193193
Check out some of the other examples highlighting and showcasing the functionality offered by the Quorum platform. An up-to-date list can be found in the [Quorum Documentation](https://docs.goquorum.com/en/latest/Getting%20Started/Quorum-Examples/) site.
194+
195+
## Adding Cakeshop
196+
197+
[Cakeshop](https://github.com/jpmorganchase/cakeshop) is our Monitoring and Development dashboard for Quorum networks. It allows to you see the current status of the network and inspect transactions, as well as compile and deploy solidity contracts. To run an instance of Cakeshop alongside of the 7nodes example, run `./cakeshop-start.sh` and then go to http://localhost:8999 in your browser to see the UI.

examples/7nodes/cakeshop-init.sh

+11
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
#!/bin/bash
2+
set -u
3+
set -e
4+
5+
echo "[*] Cleaning up cakeshop data directory"
6+
rm -rf qdata/cakeshop
7+
mkdir -p qdata/cakeshop/local
8+
9+
echo "[*] Copying cakeshop config to data directory"
10+
cp cakeshop/application.properties.template qdata/cakeshop/local/application.properties
11+
cp cakeshop/7nodes.json qdata/cakeshop/local/7nodes.json

examples/7nodes/cakeshop-start.sh

+63
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
#!/bin/bash
2+
# Start Cakeshop instance
3+
4+
set -u
5+
set -e
6+
7+
defaultCakeshopJarExpr="/home/vagrant/cakeshop/cakeshop.war"
8+
set +e
9+
defaultCakeshopJar=`find ${defaultCakeshopJarExpr} 2>/dev/null`
10+
set -e
11+
if [[ "${CAKESHOP_JAR:-unset}" == "unset" ]]; then
12+
cakeshopJar=${defaultCakeshopJar}
13+
else
14+
cakeshopJar=${CAKESHOP_JAR}
15+
fi
16+
17+
jvmParams="-Dcakeshop.config.dir=qdata/cakeshop -Dlogging.path=qdata/logs/cakeshop"
18+
19+
if [ ! -f qdata/cakeshop/local/application.properties ]; then
20+
echo "ERROR: could not find qdata/cakeshop/application.properties. Please run one of the init scripts first."
21+
exit 1
22+
fi
23+
24+
if [ "${cakeshopJar}" == "" ]; then
25+
echo "ERROR: unable to find Cakeshop war file using CAKESHOP_JAR envvar, or using ${defaultCakeshopJarExpr}"
26+
exit 1
27+
elif [ ! -f "${cakeshopJar}" ]; then
28+
echo "ERROR: unable to find Cakeshop war file: ${cakeshopJar}"
29+
exit 1
30+
fi
31+
32+
echo "[*] Starting Cakeshop"
33+
34+
currentDir=`pwd`
35+
CMD="java $jvmParams -jar ${cakeshopJar}"
36+
echo "$CMD 2>&1 &"
37+
${CMD} > /dev/null 2>&1 &
38+
sleep 1
39+
40+
DOWN=true
41+
k=10
42+
while ${DOWN}; do
43+
sleep 1
44+
echo "Waiting until Cakeshop is running..."
45+
DOWN=false
46+
set +e
47+
result=$(curl -s http://localhost:8999/actuator/health)
48+
set -e
49+
if [ ! "${result}" == "{\"status\":\"UP\"}" ]; then
50+
echo "Cakeshop is not yet listening on http"
51+
DOWN=true
52+
fi
53+
54+
k=$((k - 1))
55+
if [ ${k} -le 0 ]; then
56+
echo "Cakeshop is taking a long time to start. Look at the Cakeshop logs in qdata/logs/ for help diagnosing the problem."
57+
fi
58+
59+
sleep 5
60+
done
61+
62+
echo "Cakeshop started at http://localhost:8999/"
63+
exit 0

examples/7nodes/cakeshop/7nodes.json

+37
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
[
2+
{
3+
"name": "node1",
4+
"rpcUrl": "http://localhost:22000",
5+
"transactionManagerUrl": "http://localhost:9001/partyinfo"
6+
},
7+
{
8+
"name": "node2",
9+
"rpcUrl": "http://localhost:22001",
10+
"transactionManagerUrl": "http://localhost:9002/partyinfo"
11+
},
12+
{
13+
"name": "node3",
14+
"rpcUrl": "http://localhost:22002",
15+
"transactionManagerUrl": "http://localhost:9003/partyinfo"
16+
},
17+
{
18+
"name": "node4",
19+
"rpcUrl": "http://localhost:22003",
20+
"transactionManagerUrl": "http://localhost:9004/partyinfo"
21+
},
22+
{
23+
"name": "node5",
24+
"rpcUrl": "http://localhost:22004",
25+
"transactionManagerUrl": "http://localhost:9005/partyinfo"
26+
},
27+
{
28+
"name": "node6",
29+
"rpcUrl": "http://localhost:22005",
30+
"transactionManagerUrl": "http://localhost:9006/partyinfo"
31+
},
32+
{
33+
"name": "node7",
34+
"rpcUrl": "http://localhost:22006",
35+
"transactionManagerUrl": "http://localhost:9007/partyinfo"
36+
}
37+
]
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
[
2+
{
3+
"name": "node1",
4+
"rpcUrl": "http://host.docker.internal:22000",
5+
"transactionManagerUrl": "http://host.docker.internal:9001/partyinfo"
6+
},
7+
{
8+
"name": "node2",
9+
"rpcUrl": "http://host.docker.internal:22001",
10+
"transactionManagerUrl": "http://host.docker.internal:9002/partyinfo"
11+
},
12+
{
13+
"name": "node3",
14+
"rpcUrl": "http://host.docker.internal:22002",
15+
"transactionManagerUrl": "http://host.docker.internal:9003/partyinfo"
16+
},
17+
{
18+
"name": "node4",
19+
"rpcUrl": "http://host.docker.internal:22003",
20+
"transactionManagerUrl": "http://host.docker.internal:9004/partyinfo"
21+
},
22+
{
23+
"name": "node5",
24+
"rpcUrl": "http://host.docker.internal:22004",
25+
"transactionManagerUrl": "http://host.docker.internal:9005/partyinfo"
26+
},
27+
{
28+
"name": "node6",
29+
"rpcUrl": "http://host.docker.internal:22005",
30+
"transactionManagerUrl": "http://host.docker.internal:9006/partyinfo"
31+
},
32+
{
33+
"name": "node7",
34+
"rpcUrl": "http://host.docker.internal:22006",
35+
"transactionManagerUrl": "http://host.docker.internal:9007/partyinfo"
36+
}
37+
]
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
cakeshop.database.vendor=hsqldb
2+
cakeshop.hibernate.hbm2ddl.auto=update
3+
cakeshop.hibernate.jdbc.batch_size=20
4+
cakeshop.jdbc.pass=sdk
5+
cakeshop.jdbc.user=sdk
6+
cakeshop.mvc.async.pool.queue.max=2000
7+
cakeshop.mvc.async.pool.threads.core=250
8+
cakeshop.mvc.async.pool.threads.max=1000
9+
cakeshop.initialnodes=qdata/cakeshop/local/7nodes.json
10+
cakeshop.selected_node=1
11+
contract.poll.delay.millis=5000
12+
contract.registry.addr=
13+
endpoints.actuator.enabled=true
14+
geth.auto.start=false
15+
geth.auto.stop=false
16+
geth.bootnode.address=
17+
geth.bootnode.key=
18+
geth.bootnodes.list=
19+
geth.consensus.mode=raft
20+
geth.cors.enabled=false
21+
geth.cors.url=
22+
geth.cred1=admin
23+
geth.cred2=$2a$10$dbGiTnfK/w8MhcpIj3XgROYXRsFMlEYJRWoUYArkr8aSPypUFV25G
24+
geth.db.enabled=true
25+
geth.identity=bradmcdermott
26+
geth.istanbul.url=
27+
geth.log=/logs
28+
geth.mining=true
29+
geth.networkid=1006
30+
geth.node.port=30303
31+
geth.params.extra=
32+
geth.raft.blocktime=100
33+
geth.raft.network.id=
34+
geth.raft.port=50401
35+
geth.release.url=
36+
geth.rpcapi.list=admin,db,eth,debug,miner,net,shh,txpool,personal,web3
37+
geth.startup.mode=standalone
38+
geth.tools.url=
39+
geth.transaction_manager.peers=http\://localhost\:9102
40+
geth.transaction_manager.url=http\://localhost\:9102
41+
geth.unlock.timeout=5000
42+
geth.url=http\://localhost\:8102
43+
geth.verbosity=
44+
geth.vote.contract.addr=0x0000000000000000000000000000000000000020
45+
log4j.rootLogger=DEBUG, stdout
46+
management.context-path=/manage
47+
management.security.enabled=false
48+
nodejs.binary=node
49+
security.basic.enabled=false
50+
security.ignored=/**
51+
server.compression.enabled=true
52+
server.compression.mime-types=application/json,application/xml,text/html,text/xml,text/plain
53+
server.port=8999
54+
spring.main.banner-mode=off
55+
spring.mvc.view.prefix=/WEB-INF/jsp/
56+
spring.mvc.view.suffix=.jsp

examples/7nodes/clique-init.sh

+3
Original file line numberDiff line numberDiff line change
@@ -62,3 +62,6 @@ done
6262

6363
#Initialise Tessera configuration
6464
./tessera-init.sh
65+
66+
#Initialise Cakeshop configuration
67+
./cakeshop-init.sh

examples/7nodes/istanbul-init.sh

+3
Original file line numberDiff line numberDiff line change
@@ -82,3 +82,6 @@ done
8282

8383
#Initialise Tessera configuration
8484
./tessera-init.sh
85+
86+
#Initialise Cakeshop configuration
87+
./cakeshop-init.sh

examples/7nodes/raft-init.sh

+3
Original file line numberDiff line numberDiff line change
@@ -70,3 +70,6 @@ done
7070

7171
#Initialise Tessera configuration
7272
./tessera-init.sh
73+
74+
#Initialise Cakeshop configuration
75+
./cakeshop-init.sh

examples/7nodes/stop.sh

+8-1
Original file line numberDiff line numberDiff line change
@@ -14,4 +14,11 @@ then
1414
jps | grep enclave | cut -d " " -f1 | xargs kill
1515
else
1616
echo "enclave: no process found"
17-
fi
17+
fi
18+
19+
if [ "`jps | grep cakeshop`" != "" ]
20+
then
21+
jps | grep cakeshop | cut -d " " -f1 | xargs kill
22+
else
23+
echo "cakeshop: no process found"
24+
fi

examples/7nodes/tessera-init.sh

+8
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,10 @@ cat <<EOF > ${DDIR}/tessera-config-09-${i}.json
9191
"app":"ThirdParty",
9292
"enabled": true,
9393
"serverAddress": "http://localhost:${serverPortThirdParty}",
94+
"cors" : {
95+
"allowedMethods" : ["GET", "OPTIONS"],
96+
"allowedOrigins" : ["*"]
97+
},
9498
"communicationType" : "REST"
9599
},
96100
{
@@ -119,6 +123,10 @@ cat <<EOF > ${DDIR}/tessera-config-09-${i}.json
119123
"clientTrustMode": "TOFU",
120124
"knownServersFile": "${DDIR}/knownServers"
121125
},
126+
"cors" : {
127+
"allowedMethods" : ["GET", "OPTIONS"],
128+
"allowedOrigins" : ["*"]
129+
},
122130
"communicationType" : "REST"
123131
}
124132
],

vagrant/bootstrap.sh

+17-1
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,17 @@
11
#!/bin/bash
22
set -eu -o pipefail
33

4+
# nodejs source for apt
5+
curl -sL https://deb.nodesource.com/setup_12.x | sudo -E bash -
6+
47
apt-get update
58
packages=(
69
parallel # utility
710
unzip # tessera startup script dependency
811
default-jdk # tessera runtime dependency
912
libleveldb-dev # constellation dependency
1013
libsodium-dev # constellation dependency
14+
nodejs # cakeshop dependency
1115
)
1216
apt-get install -y ${packages[@]}
1317

@@ -22,6 +26,11 @@ TESSERA_VERSION="0.10.0"
2226
TESSERA_OUTPUT_FILE="${TESSERA_HOME}/tessera.jar"
2327
TESSERA_ENCLAVE_OUTPUT_FILE="${TESSERA_HOME}/enclave.jar"
2428

29+
CAKESHOP_HOME=/home/vagrant/cakeshop
30+
mkdir -p ${CAKESHOP_HOME}
31+
CAKESHOP_VERSION="0.11.0-RC2"
32+
CAKESHOP_OUTPUT_FILE="${CAKESHOP_HOME}/cakeshop.war"
33+
2534
QUORUM_VERSION="2.3.0"
2635
QUORUM_OUTPUT_FILE="geth.tar.gz"
2736

@@ -33,12 +42,14 @@ parallel --link wget -q -O ::: \
3342
${TESSERA_ENCLAVE_OUTPUT_FILE} \
3443
${QUORUM_OUTPUT_FILE} \
3544
${POROSITY_OUTPUT_FILE} \
45+
${CAKESHOP_OUTPUT_FILE} \
3646
::: \
3747
https://github.com/jpmorganchase/constellation/releases/download/v$CVER/$CREL.tar.xz \
3848
https://oss.sonatype.org/content/groups/public/com/jpmorgan/quorum/tessera-app/${TESSERA_VERSION}/tessera-app-${TESSERA_VERSION}-app.jar \
3949
https://oss.sonatype.org/content/groups/public/com/jpmorgan/quorum/enclave-jaxrs/${TESSERA_VERSION}/enclave-jaxrs-${TESSERA_VERSION}-server.jar \
4050
https://dl.bintray.com/quorumengineering/quorum/v${QUORUM_VERSION}/geth_v${QUORUM_VERSION}_linux_amd64.tar.gz \
41-
https://github.com/jpmorganchase/quorum/releases/download/v1.2.0/porosity
51+
https://github.com/jpmorganchase/quorum/releases/download/v1.2.0/porosity \
52+
https://github.com/jpmorganchase/cakeshop/releases/download/v${CAKESHOP_VERSION}/cakeshop-${CAKESHOP_VERSION}.war
4253

4354
# install constellation
4455
echo "Installing Constellation ${CVER}"
@@ -61,6 +72,11 @@ rm -f ${QUORUM_OUTPUT_FILE}
6172
echo "Installing Porosity"
6273
chmod 0755 ${POROSITY_OUTPUT_FILE}
6374

75+
# install cakeshop
76+
echo "Installing Cakeshop ${CAKESHOP_VERSION}"
77+
echo "CAKESHOP_JAR=${CAKESHOP_OUTPUT_FILE}" >> /home/vagrant/.profile
78+
79+
6480
# copy examples
6581
cp -r /vagrant/examples /home/vagrant/quorum-examples
6682
chown -R vagrant:vagrant /home/vagrant/quorum-examples

0 commit comments

Comments
 (0)