forked from hyperledger-cacti/cacti
-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
test: adding quorum mp test ledger dockerfile
Related to hyperledger-cacti#951 Signed-off-by: Travis Payne <[email protected]>
- Loading branch information
Showing
5 changed files
with
312 additions
and
0 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 |
---|---|---|
@@ -0,0 +1,139 @@ | ||
FROM docker:20.10.3-dind | ||
|
||
ARG BESU_VERSION=21.1.2 | ||
ARG QUORUM_VERSION=21.4.1 | ||
ARG QUORUM_TESSERA_VERSION=21.1.1 | ||
ARG CA_VERSION=1.4.9 | ||
|
||
WORKDIR / | ||
|
||
RUN apk update | ||
|
||
# Install dependencies of Docker Compose | ||
RUN apk add py-pip python3-dev libffi-dev openssl-dev gcc libc-dev make | ||
|
||
# Install python/pip - We need this because DinD 18.x has Python 2 | ||
# And we cannot upgrade to DinD 19 because of | ||
# https://github.com/docker-library/docker/issues/170 | ||
ENV PYTHONUNBUFFERED=1 | ||
RUN apk add --update --no-cache python3 && ln -sf python3 /usr/bin/python | ||
RUN python3 -m ensurepip | ||
RUN pip3 install --no-cache --upgrade "pip>=21" setuptools | ||
|
||
# Without this the docker-compose installation crashes, complaining about | ||
# a lack of rust compiler... | ||
# RUN pip install setuptools_rust | ||
ENV CRYPTOGRAPHY_DONT_BUILD_RUST=1 | ||
|
||
# Install Docker Compose which is a dependency of Fabric Samples | ||
RUN pip install docker-compose | ||
|
||
# Need git to clone the sources of the Fabric Samples repository from GitHub | ||
RUN apk add --no-cache git | ||
|
||
# Fabric Samples needs bash, sh is not good enough here | ||
RUN apk add --no-cache bash | ||
|
||
# The file binary is used to inspect exectubles when debugging container image issues | ||
RUN apk add --no-cache file | ||
|
||
# Need NodeJS tooling for the Typescript contracts | ||
RUN apk add --no-cache npm nodejs | ||
|
||
# Needed because the Fabric binaries need the GNU libc dynamic linker to be executed | ||
# and alpine does not have that by default | ||
# @see https://askubuntu.com/a/1035037/1008695 | ||
# @see https://github.com/gliderlabs/docker-alpine/issues/219#issuecomment-254741346 | ||
RUN apk add --no-cache libc6-compat | ||
|
||
RUN apk add --no-cache --update chromium | ||
|
||
ENV CACTUS_CFG_PATH=/etc/hyperledger/cactus | ||
RUN mkdir -p $CACTUS_CFG_PATH | ||
# OpenSSH - need to have it so we can shell in and install/instantiate contracts | ||
RUN apk add --no-cache openssh augeas | ||
|
||
# Configure the OpenSSH server we just installed | ||
RUN augtool 'set /files/etc/ssh/sshd_config/AuthorizedKeysFile ".ssh/authorized_keys /etc/authorized_keys/%u"' | ||
RUN augtool 'set /files/etc/ssh/sshd_config/PermitRootLogin yes' | ||
RUN augtool 'set /files/etc/ssh/sshd_config/PasswordAuthentication no' | ||
RUN augtool 'set /files/etc/ssh/sshd_config/PermitEmptyPasswords no' | ||
RUN augtool 'set /files/etc/ssh/sshd_config/Port 22' | ||
RUN augtool 'set /files/etc/ssh/sshd_config/LogLevel DEBUG2' | ||
RUN augtool 'set /files/etc/ssh/sshd_config/LoginGraceTime 10' | ||
# Create the server's key - without this sshd will refuse to start | ||
RUN ssh-keygen -A | ||
|
||
# Generate an RSA keypair on the fly to avoid having to hardcode one in the image | ||
# which technically does not pose a security threat since this is only a development | ||
# image, but we do it like this anyway. | ||
RUN mkdir ~/.ssh | ||
RUN chmod 700 ~/.ssh/ | ||
RUN touch ~/.ssh/authorized_keys | ||
RUN ["/bin/bash", "-c", "ssh-keygen -t rsa -N '' -f $CACTUS_CFG_PATH/quorum-aio-image <<< y"] | ||
RUN mv $CACTUS_CFG_PATH/quorum-aio-image $CACTUS_CFG_PATH/quorum-aio-image.key | ||
RUN cp $CACTUS_CFG_PATH/quorum-aio-image.pub ~/.ssh/authorized_keys | ||
|
||
RUN apk add --no-cache util-linux | ||
|
||
# FIXME - make it so that SSHd does not need this to work | ||
RUN echo "root:$(uuidgen)" | chpasswd | ||
|
||
RUN git clone https://github.com/travis-payne/quorum-dev-quickstart.git | ||
|
||
WORKDIR /quorum-dev-quickstart | ||
|
||
RUN git fetch | ||
|
||
RUN git checkout e029993 | ||
|
||
RUN npm i | ||
|
||
RUN npm run build | ||
|
||
RUN npm run start -- --clientType goquorum --outputPath ./ --monitoring default --privacy true --orchestrate false | ||
|
||
RUN chmod -R a+rwx ../quorum-dev-quickstart/ | ||
|
||
RUN apk add --no-cache supervisor | ||
RUN apk add --no-cache ncurses | ||
|
||
COPY healthcheck.sh /healthcheck.sh | ||
COPY supervisord.conf /etc/supervisord.conf | ||
|
||
# # Extend the parent image's entrypoint | ||
# # https://superuser.com/questions/1459466/can-i-add-an-additional-docker-entrypoint-script | ||
ENTRYPOINT ["/usr/bin/supervisord"] | ||
CMD ["--configuration", "/etc/supervisord.conf", "--nodaemon"] | ||
|
||
HEALTHCHECK --interval=10s --timeout=5s --start-period=60s --retries=500 CMD /healthcheck.sh | ||
|
||
# OpenSSH Server | ||
EXPOSE 22 | ||
|
||
# Grafana | ||
EXPOSE 3000 | ||
|
||
# RPC Node: HTTP, WebSocket Providers | ||
EXPOSE 8545 8546 | ||
|
||
# supervisord web ui/dashboard | ||
EXPOSE 9001 | ||
|
||
# Prometheus | ||
EXPOSE 9090 | ||
|
||
# ETH signer proxy | ||
EXPOSE 18545 | ||
|
||
# Quorum member 1: HTTP; WebSocket Providers; Tessera | ||
EXPOSE 20000 20001 9081 | ||
|
||
# Quorum member 2: HTTP; WebSocket Providers; Tessera | ||
EXPOSE 20002 20003 9082 | ||
|
||
# Quorum member 3: HTTP; WebSocket Providers; Tessera | ||
EXPOSE 20004 20005 9083 | ||
|
||
# Web block explorer | ||
EXPOSE 25000 |
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,106 @@ | ||
# @hyperledger/cactus-quorum-multi-party-all-in-one<!-- omit in toc --> | ||
|
||
## Table of Contents<!-- omit in toc --> | ||
|
||
- [Summary](#summary) | ||
- [Usage via Public Container Registry](#usage-via-public-container-registry) | ||
- [List endpoints and services](#list-endpoints-and-services) | ||
- [2021-08-17 09:39:45,048 DEBG 'quorum-network' stdout output:](#2021-08-17-093945048-debg-quorum-network-stdout-output) | ||
- [List endpoints and services](#list-endpoints-and-services-1) | ||
|
||
## Summary | ||
|
||
A container image that hosts a Quorum network which is | ||
- Has multiple nodes and validators | ||
- Supports transaction privacy (`privateFrom` and `privateFor`) | ||
|
||
## Usage via Public Container Registry | ||
|
||
```sh | ||
docker run \ | ||
--rm \ | ||
--privileged \ | ||
--publish 2222:22 \ | ||
--publish 3000:3000 \ | ||
--publish 8545:8545 \ | ||
--publish 8546:8546 \ | ||
--publish 9001:9001 \ | ||
--publish 9081:9081 \ | ||
--publish 9082:9082 \ | ||
--publish 9083:9083 \ | ||
--publish 9090:9090 \ | ||
--publish 18545:18545 \ | ||
--publish 20000:20000 \ | ||
--publish 20001:20001 \ | ||
--publish 20002:20002 \ | ||
--publish 20003:20003 \ | ||
--publish 20004:20004 \ | ||
--publish 20005:20005 \ | ||
--publish 25000:25000 \ | ||
ghcr.io/hyperledger/cactus-quorum-multi-party-all-in-one:latest | ||
|
||
``` | ||
|
||
************************************* | ||
Quorum Dev Quickstart | ||
************************************* | ||
|
||
---------------------------------- | ||
List endpoints and services | ||
---------------------------------- | ||
JSON-RPC HTTP service endpoint : http://localhost:8545 | ||
2021-08-17 09:39:45,048 DEBG 'quorum-network' stdout output: | ||
---------------------------------- | ||
List endpoints and services | ||
---------------------------------- | ||
JSON-RPC HTTP service endpoint : http://localhost:8545 | ||
|
||
JSON-RPC WebSocket service endpoint : ws://localhost:8546 | ||
Web block explorer address : http://localhost:25000/ | ||
2021-08-17 09:39:45,049 DEBG 'quorum-network' stdout output: | ||
JSON-RPC WebSocket service endpoint : ws://localhost:8546 | ||
Web block explorer address : http://localhost:25000/ | ||
|
||
|
||
For more information on the endpoints and services, refer to README.md in the installation directory. | ||
**************************************************************** | ||
2021-08-17 09:39:47,429 DEBG 'quorum-network' stdout output: | ||
|
||
For more information on the endpoints and services, refer to README.md in the installation directory. | ||
**************************************************************** | ||
|
||
``` | ||
## Building the Image Locally | ||
```sh | ||
DOCKER_BUILDKIT=1 docker build ./tools/docker/quorum-multi-party-all-in-one/ --progress=plain --tag cqmpaio | ||
``` | ||
|
||
```sh | ||
docker run --rm --privileged --publish-all cqmpaio | ||
``` | ||
|
||
```sh | ||
docker run \ | ||
--rm \ | ||
--privileged \ | ||
--publish 2222:22 \ | ||
--publish 3000:3000 \ | ||
--publish 8545:8545 \ | ||
--publish 8546:8546 \ | ||
--publish 9001:9001 \ | ||
--publish 9081:9081 \ | ||
--publish 9082:9082 \ | ||
--publish 9083:9083 \ | ||
--publish 9090:9090 \ | ||
--publish 18545:18545 \ | ||
--publish 20000:20000 \ | ||
--publish 20001:20001 \ | ||
--publish 20002:20002 \ | ||
--publish 20003:20003 \ | ||
--publish 20004:20004 \ | ||
--publish 20005:20005 \ | ||
--publish 25000:25000 \ | ||
cqmpaio | ||
``` |
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,13 @@ | ||
#!/bin/sh | ||
|
||
set -e | ||
|
||
# # Quorum Member 1 | ||
wget -O- --post-data '{"jsonrpc":"2.0","method":"net_peerCount","params":[],"id":1}' --header 'Content-Type: application/json' http://localhost:20000 | ||
|
||
# # Quorum Member 2 | ||
wget -O- --post-data '{"jsonrpc":"2.0","method":"net_peerCount","params":[],"id":1}' --header 'Content-Type: application/json' http://localhost:20000 | ||
|
||
# # Quorum Member 3 | ||
wget -O- --post-data '{"jsonrpc":"2.0","method":"net_peerCount","params":[],"id":1}' --header 'Content-Type: application/json' http://localhost:20000 | ||
|
18 changes: 18 additions & 0 deletions
18
tools/docker/quorum-multi-party-all-in-one/hooks/post_push
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,18 @@ | ||
#!/bin/bash | ||
|
||
|
||
SHORTHASH="$(git rev-parse --short HEAD)" | ||
TODAYS_DATE="$(date +%F)" | ||
|
||
# | ||
# We tag every image with today's date and also the git short hash | ||
# Today's date helps humans quickly intuit which version is older/newer | ||
# And the short hash helps identify the exact git revision that the image was | ||
# built from in case you are chasing some exotic bug that requires this sort of | ||
# rabbithole diving where you are down to comparing the images at this level. | ||
# | ||
DOCKER_TAG="$TODAYS_DATE-$SHORTHASH" | ||
|
||
|
||
docker tag $IMAGE_NAME $DOCKER_REPO:$DOCKER_TAG | ||
docker push $DOCKER_REPO:$DOCKER_TAG |
36 changes: 36 additions & 0 deletions
36
tools/docker/quorum-multi-party-all-in-one/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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
[supervisord] | ||
logfile = /var/log/supervisord.log | ||
logfile_maxbytes = 50MB | ||
logfile_backups=10 | ||
loglevel = debug | ||
|
||
[program:sshd] | ||
command=/usr/sbin/sshd -D | ||
autostart=true | ||
autorestart=true | ||
stderr_logfile=/dev/stderr | ||
stderr_logfile_maxbytes=0 | ||
stdout_logfile=/dev/stdout | ||
stdout_logfile_maxbytes=0 | ||
|
||
[program:dockerd] | ||
command=dockerd-entrypoint.sh | ||
autostart=true | ||
autorestart=true | ||
stderr_logfile=/dev/stderr | ||
stderr_logfile_maxbytes=0 | ||
stdout_logfile=/dev/stdout | ||
stdout_logfile_maxbytes=0 | ||
|
||
[program:quorum-network] | ||
command=/quorum-dev-quickstart/run.sh | ||
autostart=true | ||
autorestart=false | ||
stderr_logfile=/dev/stderr | ||
stderr_logfile_maxbytes=0 | ||
stdout_logfile=/dev/stdout | ||
stdout_logfile_maxbytes=0 | ||
|
||
[inet_http_server] | ||
port = 0.0.0.0:9001 | ||
|