Skip to content
This repository was archived by the owner on Jan 19, 2022. It is now read-only.
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
65 commits
Select commit Hold shift + click to select a range
c19352d
applied patch by lucassaldanha
Apr 22, 2018
21c2bcc
apply patch for issue #428, update setup.sh
pccr10001 Jul 4, 2018
72fb712
bump quorum to 2.1.1
pccr10001 Nov 21, 2018
1114e61
fix constellation node building
pccr10001 Nov 21, 2018
ac17210
bump quorum version to 2.2.0
pccr10001 Dec 17, 2018
916721c
Update README
pccr10001 Dec 17, 2018
6d77510
update genesis.json to fix solc problem
pccr10001 Dec 19, 2018
a397346
remove test version
pccr10001 Dec 19, 2018
843c485
set rpcvhost to allow all hostname
pccr10001 Dec 21, 2018
be27db1
add clique support, COLORFUL!
pccr10001 Jan 4, 2019
33eb7d0
Update README.md
pccr10001 Jan 4, 2019
23c2c65
Update README.md
pccr10001 Jan 4, 2019
8649943
Update README.md
pccr10001 Jan 4, 2019
189fde2
add Istanbul BFT support
pccr10001 Jan 9, 2019
bceec59
update comment
pccr10001 Jan 9, 2019
f45a7bb
Update README.md
pccr10001 Jan 9, 2019
7ef2b51
Update README.md
pccr10001 Jan 9, 2019
1ef40af
Update README.md
pccr10001 Jan 9, 2019
c8014d3
remove test args
pccr10001 Jan 9, 2019
3002670
fix signer counter
pccr10001 Jan 9, 2019
45573a5
fix raft setup
pccr10001 Jan 9, 2019
1a24ad0
update quorum to 2.2.1
pccr10001 Jan 23, 2019
608cf2e
add bootnode
pccr10001 Jan 28, 2019
a4fd17c
use bash in container, fix number > 10
pccr10001 Feb 12, 2019
780818d
add easy access cmd, split config file
pccr10001 Feb 13, 2019
90988e0
add deploy outside nodes
pccr10001 Feb 13, 2019
2f96a65
add support for outside nodes
pccr10001 Feb 13, 2019
e95186e
add support for outside nodes
pccr10001 Feb 13, 2019
b2c1a75
use tmux to view logs
pccr10001 Feb 13, 2019
8be0c9d
remove useless file
pccr10001 Feb 13, 2019
cdb5144
fix cleanup
pccr10001 Feb 13, 2019
7c16da2
test host network
pccr10001 Feb 13, 2019
93e8110
test host network
pccr10001 Feb 13, 2019
fa4c0b3
update docker-compose gen
pccr10001 Feb 14, 2019
a36657b
add docker host network support
pccr10001 Feb 21, 2019
1338297
add docker host network support
pccr10001 Feb 21, 2019
b7fb3ed
update readme
pccr10001 Feb 21, 2019
8db3827
add disable constellation
pccr10001 Feb 22, 2019
086d2d5
Update setup.sh
noureddinel Mar 20, 2019
52de2b0
Merge pull request #1 from noureddinel/patch-1
pccr10001 Mar 26, 2019
ec9c781
fix if syntax, add auto restart
pccr10001 Apr 2, 2019
d02137e
speedup deploy
pccr10001 Apr 2, 2019
75657d5
bump quorum version to 2.2.3
pccr10001 May 9, 2019
503b82d
fix istanbul path
pccr10001 Jun 19, 2019
a464281
bump quorum to v2.2.4, fix istanbul-tools
pccr10001 Aug 13, 2019
dbc9cb7
update default settings
pccr10001 Aug 13, 2019
da9abeb
Update README.md
pccr10001 Aug 13, 2019
e26ff9a
add websocket
pccr10001 Aug 22, 2019
c57e9bf
Merge branch 'master' of github.com:pccr10001/quorum-docker-Nnodes
pccr10001 Aug 22, 2019
0935bce
fix typo
pccr10001 Aug 22, 2019
95a91db
bump to v2.2.5
pccr10001 Sep 26, 2019
b342cdf
bump to v2.2.5
pccr10001 Sep 26, 2019
dae58e9
Update Dockerfile
pccr10001 Oct 7, 2019
596a268
bump quorum to v2.3.0
pccr10001 Oct 7, 2019
c258318
add multi-cluster support
pccr10001 Nov 11, 2019
2e83037
add missing file
pccr10001 Nov 11, 2019
3ae2b3d
Add readme
pccr10001 Nov 11, 2019
5baa8d1
add Readme
pccr10001 Nov 11, 2019
c4ba7e0
Update README.md
pccr10001 Nov 11, 2019
333a926
add timezone support
pccr10001 Nov 12, 2019
de1023e
Merge branch 'master' of github.com:pccr10001/quorum-docker-Nnodes
pccr10001 Nov 12, 2019
bbde531
add support for Quorum 2.5.0
pccr10001 May 29, 2020
404cb7a
update readme
pccr10001 May 29, 2020
7a623ac
fix maxCodeSize parameter, fix docker-compose parameter
pccr10001 May 29, 2020
c5e9ee1
remove test parameter
pccr10001 May 29, 2020
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
.#*
Nnodes/.current_config
Nnodes/qdata_*
Nnodes/contract_pri.js
Nnodes/contract_pub.js
Nnodes/docker-compose.yml
Nnodes/static-nodes.json
Nnodes/genesis.json
53 changes: 37 additions & 16 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
FROM ubuntu:16.04 as builder
FROM ubuntu:18.04 as builder

ARG CONSTELLATION_VERSION=0.3.5
ARG QUORUM_VERSION=2.5.0

WORKDIR /work

Expand All @@ -12,28 +15,37 @@ RUN apt-get update && \
sysvbanner \
unzip \
wget \
wrk \
zlib1g-dev

RUN wget -q https://github.com/jpmorganchase/constellation/releases/download/v0.0.1-alpha/ubuntu1604.zip && \
unzip ubuntu1604.zip && \
cp ubuntu1604/constellation-node /usr/local/bin && \
RUN wget -q https://github.com/jpmorganchase/constellation/releases/download/v0.3.5-build.1/constellation-0.3.5-ubuntu1604.tar.gz && \
tar -xvf constellation-$CONSTELLATION_VERSION-ubuntu1604.tar.gz && \
cp constellation-node /usr/local/bin && \
chmod 0755 /usr/local/bin/constellation-node && \
cp ubuntu1604/constellation-enclave-keygen /usr/local/bin/ && \
chmod 0755 /usr/local/bin/constellation-enclave-keygen && \
rm -rf ubuntu1604.zip ubuntu1604
rm -rf constellation-$CONSTELLATION_VERSION-ubuntu1604.tar.gz constellation-node

ENV GOREL go1.7.3.linux-amd64.tar.gz
ENV GOREL go1.12.7.linux-amd64.tar.gz
ENV PATH $PATH:/usr/local/go/bin

RUN wget -q https://storage.googleapis.com/golang/$GOREL && \
tar xfz $GOREL && \
mv go /usr/local/go && \
rm -f $GOREL

#RUN mkdir istanbul && cd istanbul && \
# GO111MODULE=on GOPATH=/work/istanbul go get -u github.com/jpmorganchase/istanbul-tools/cmd/istanbul && \
# cp bin/istanbul /usr/local/bin && \
# cd .. && rm -rf istanbul

RUN git clone https://github.com/jpmorganchase/istanbul-tools.git istanbul && \
cd istanbul && \
make && \
cp build/bin/istanbul /usr/local/bin/ && \
cd .. && rm -rf istanbul


RUN git clone https://github.com/jpmorganchase/quorum.git && \
cd quorum && \
git checkout tags/v1.2.0 && \
git checkout v$QUORUM_VERSION && \
make all && \
cp build/bin/geth /usr/local/bin && \
cp build/bin/bootnode /usr/local/bin && \
Expand All @@ -42,7 +54,7 @@ RUN git clone https://github.com/jpmorganchase/quorum.git && \

### Create the runtime image, leaving most of the cruft behind (hopefully...)

FROM ubuntu:16.04
FROM ubuntu:18.04

# Install add-apt-repository
RUN apt-get update && \
Expand All @@ -51,20 +63,29 @@ RUN apt-get update && \
apt-get update && \
apt-get install -y --no-install-recommends \
libdb-dev \
libleveldb-dev \
libsodium-dev \
zlib1g-dev\
libtinfo-dev \
solc && \
rm -rf /var/lib/apt/lists/*
rm -rf /var/lib/apt/lists/* && \
mkdir /.ethereum && \
chown -R 1000:1000 /.ethereum && \
groupadd -g 1000 geth && useradd -u 1000 -g 1000 -s /bin/bash geth && \
mkdir /home/geth && chown 1000:1000 -R /home/geth


# Temporary useful tools
#RUN apt-get update && \
# apt-get install -y iputils-ping net-tools vim
RUN apt-get update && \
apt-get install -y iputils-ping net-tools vim

COPY --from=builder \
/usr/local/bin/constellation-node \
/usr/local/bin/constellation-enclave-keygen \
/usr/local/bin/istanbul \
/usr/local/bin/geth \
/usr/local/bin/bootnode \
/usr/local/bin/
/usr/local/bin/

ENV SHELL=/bin/bash

CMD ["/qdata/start-node.sh"]
3 changes: 3 additions & 0 deletions Nnodes/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
config.sh
qdata_*
.current_config
39 changes: 11 additions & 28 deletions Nnodes/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,38 +16,34 @@ This is what we set up for each node.
In addition we create some utility scripts on the host.

* A *docker-compose.yml* file that can be used with docker-compose to create the network of containers.
* Two sample contract creation scripts:
* *contract_pub.js* - creates a public contract, visible to all.
* *contract_pri.js* - creates a private contract between the sender and Node 2.


Refer to the *setup.sh* file itself for the full code.

## Configuration options

Options are simple and self-explanatory. The *docker-compose.yml* file will create a Docker network for the nodes as per the `subnet` variable here. If you want to run more nodes, then add addresses for them to the `ips` list.
Options are simple and self-explanatory. The *docker-compose.yml* file will create a Docker network for the nodes as per the `subnet` variable here. If you want to run more nodes, change `total_nodes` to how many you want.

`in config.sh`

#### Configuration options #############################################

# One Docker container will be configured for each IP address in $ips
subnet="172.13.0.0/16"
ips=("172.13.0.2" "172.13.0.3" "172.13.0.4")
# Total nodes to deploy
total_nodes=5

# Signer nodes for Clique and IBFT
signer_nodes=7

# Docker image name
image=quorum

# Use docker host network for RLP connection.
use_host_net=false

The docker image is used during set-up to run Geth, Bootnode and Constellation to generate various things. These executables don't need to be installed on the host machine.

## House-keeping

The sample private transaction we will create later is designed to be sent from Node 1 to Node 2, so we demand that there be at least two nodes configured.

if [[ ${#ips[@]} < 2 ]]
then
echo "ERROR: There must be more than one node IP address."
exit 1
fi

Delete any old configuration.

./cleanup.sh
Expand Down Expand Up @@ -262,16 +258,3 @@ This is the first file that is not written to the node-specific directories. Thi
- subnet: $subnet
EOF

## Create pre-populated contracts

For convenience, we provide a couple of scripts that create contracts, one public, one private. The private contract needs to know Node 2's key since that is the node we will share the contract with, so we copy in the key we generated earlier. Templates for the contracts are in the *templates/* directory.

#### Create pre-populated contracts ####################################

# Private contract - insert Node 2 as the recipient
cat templates/contract_pri.js \
| sed s:_NODEKEY_:`cat qdata_2/keys/tm.pub`:g \
> contract_pri.js

# Public contract - no change required
cp templates/contract_pub.js ./
9 changes: 8 additions & 1 deletion Nnodes/cleanup.sh
Original file line number Diff line number Diff line change
@@ -1,8 +1,15 @@
#!/bin/bash

echo " - Removing containers."
docker-compose down

echo " - Removing old data."
rm -rf qdata_[0-9] qdata_[0-9][0-9]
rm -f docker-compose.yml
rm -f contract_pri.js contract_pub.js
rm .current_config 2>/dev/null
rm genesis.json 2>/dev/null

# Shouldn't be needed, but just in case:
rm -f static-nodes.json genesis.json

rm -f docker-compose.yml
40 changes: 40 additions & 0 deletions Nnodes/cmd.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
#!/bin/bash

source ./.current_config

command=$1
node=$2

if [[ "$command" = "console" ]]; then
container_id=`docker ps --format "{{.ID}}:{{.Names}}" | grep ${consensus}_${service}_$node | cut -d : -f 1`
if [[ "$container_id" = "" ]]; then
echo "No such container."
exit 1
fi
docker exec -it $container_id bash -c "export SHELL=/bin/bash && geth attach /qdata/dd/geth.ipc"
exit 0

elif [[ "$command" = "log" ]]; then

if [[ "$node" = "" ]]; then
echo "No such container."
exit 1
fi

tail -F qdata_$node/logs/geth.log

elif [[ "$command" = "logs" ]]; then

lines=$((`tput lines`/$total_nodes))
tmux_cmd="tmux new-session \; "
for i in $(seq 2 $total_nodes); do
tmux_cmd="$tmux_cmd split-window -v -l $lines \; select-pane -t 0 \; "
done
for i in $(seq 1 $total_nodes); do

tmux_cmd="$tmux_cmd send-keys -t $((i-1)) 'bash -c \"trap pkill tmux:\\ server SIGINT; ./cmd.sh log $i || true; pkill tmux:\\ server\"' C-j \; "
done

eval $tmux_cmd

fi
66 changes: 66 additions & 0 deletions Nnodes/config.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
#!/bin/bash

#### Configuration options #############################################

# Port prefix
port_range=61000

#rpc_start_port=$((port_range+100))
#node_start_port=$((port_range+200))
#raft_start_port=$((port_range+300))
#constellation_start_port=$((port_range+400))

# Old version
rpc_start_port=23000
node_start_port=24000
raft_start_port=25000
ws_start_port=26000
constellation_start_port=27000

# Default port number
raft_port=50400
constellation_port=9000
rlp_port=30303
rpc_port=8545
ws_port=8546

#Disable constellation node
use_constellation=false

# VIP Subnet
subnet="172.14.0.0/16"

# Use docker host network for RLP connection.
use_host_net=true


# Interface IP for RLP listening when using docker host network
interface_ip="172.16.1.122"

# Total nodes to deploy
total_nodes=4

# Signer nodes for Clique and IBFT
signer_nodes=4

# Consensus engine ex. raft, clique, istanbul
consensus=raft

# Block period for Clique and IBFT
block_period=0

# Docker image name
image=quorum

# Service name for docker-compose.yml
service=n1

# Send some ether for pre-defined accounts
alloc_ether=true

node_name_prefix=master
auto_start_containers=true

########################################################################

[[ "$total_nodes" -lt "$signer_nodes" ]] && total_nodes=$signer_nodes
62 changes: 62 additions & 0 deletions Nnodes/outside/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
# Quorum Multi-Cluster Setup
* Raft support
* Clique support (*experimental)

## Getting Started

1. Change master cluster network to `HOST` and set the `master nodes IP`
```bash=
vi config.sh

# Use docker host network for RLP connection.
use_host_net=true

# Interface IP for RLP listening when using docker host network
interface_ip="172.16.2.169"

# create master nodes.
./setup.sh
```

2. Create a cluster
```bash=
cd outside

./setup.sh
Usage: ./setup.sh [ext_node_ip] [node_name] [service_name]

./setup.sh 192.168.26.112 test e1
[R] Raft Leader is 2ffa9baf...28fa34c7.
[R] RPC at http://172.16.2.169:23002/
[*] Generate Outside Quorum Nodes for test_e1.
[1] Configuring for '4' nodes.
[2] Creating Enodes.
- Node #1 with nodekey: 6d81f39a...71b22271 configured with Raft ID 5.
- Node #2 with nodekey: 79249409...9d76813d configured with Raft ID 6.
- Node #3 with nodekey: c82cc372...d66d8213 configured with Raft ID 7.
- Node #4 with nodekey: 035663a1...d95a7286 configured with Raft ID 8.
[3] Creating Ether accounts.
- Account 0xcd17213144bc4615bf6c5bfd043a601dc2c5365f created on Node #1.
- Account 0x0fb3df4332728c97f3ca7c04db6e6dab08f9c3ea created on Node #2.
- Account 0xdfdd444f36fdf14ffa6290ad0295425e0ed04676 created on Node #3.
- Account 0x94301d0ef2ca1af5c5b55bca0be69f41beb7da90 created on Node #4.
[4] Creating Quorum keys and finishing configuration.
[-] Finished.
[-] Please upload test_e1 directory to destination.
```

3. Upload a new cluster to other node
```bash=
scp -r test_e1 192.168.26.112:~/

ssh 192.168.26.112

# go to cluster dir
cd test_e2

# build Quorum image
docker build -t quorum image/

# start
docker-compose up -d
```
7 changes: 7 additions & 0 deletions Nnodes/outside/cleanup.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
#!/bin/bash

echo " - Removing containers."
docker-compose --log-level ERROR down 2>/dev/null

echo " - Removing old data."
rm -rf qdata_[0-9]/dd/geth qdata_[0-9][0-9]/dd/geth
Loading