Skip to content

Commit

Permalink
build(docker-compose): upgrade to docker compose V2
Browse files Browse the repository at this point in the history
- `quorum-multi-party-all-in-one`: use newest `quorum-quorum-dev-quickstart`,
    update quorum versions to most recent available. Run ledger as `quorum` user
    (required by newer versions). Use docker compose V2 from alpine package registry instead of
    V1 from pip.
- `besu-multi-party-all-in-one`: similar changes as for quorum-multi-party-all-in-on.
    Fix broken besu private transaction tests.
- `fabric-all-in-one`: Use docker compose V2 from alpine package registry instead of V1 from pip.
- `sawtooth-all-in-one`: Use docker compose V2 from alpine package registry instead of V1 from pip.

Closes: hyperledger-cacti#2593
Closes: hyperledger-cacti#2557

Signed-off-by: Michal Bajer <michal.bajer@fujitsu.com>
  • Loading branch information
outSH committed Aug 4, 2023
1 parent ecefc12 commit a028aa0
Show file tree
Hide file tree
Showing 12 changed files with 127 additions and 109 deletions.
69 changes: 33 additions & 36 deletions tools/docker/besu-multi-party-all-in-one/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,32 +1,37 @@
FROM docker:24.0.2-dind
################################
# STAGE 1
# Setup quorum-dev-quickstart
################################

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
FROM node:18.17.0 AS quorum-dev-quickstart-setup

WORKDIR /
ENV QUORUM_QUICKSTART_VERSION=0.1.5
ENV ROOT_DIR=/opt/quorum-dev-quickstart

RUN apk update
WORKDIR "${ROOT_DIR}"
RUN npm install -g "quorum-dev-quickstart@${QUORUM_QUICKSTART_VERSION}"
RUN quorum-dev-quickstart --clientType besu --outputPath ./ --monitoring default --privacy true --orchestrate false

# Install dependencies of Docker Compose
RUN apk add py-pip python3-dev libffi-dev openssl-dev gcc libc-dev make
################################
# STAGE 2
# docker compose base
################################

FROM docker:24.0.5-dind

ENV ROOT_DIR=/opt/quorum-dev-quickstart

WORKDIR /

# 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
RUN addgroup -g 1000 quorum \
&& adduser -u 1000 -G quorum -g docker -s /bin/sh -D quorum \
&& addgroup docker \
&& addgroup quorum docker

# 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
RUN apk update

# Install Docker Compose which is a dependency of Fabric Samples
RUN pip install docker-compose
# Install dependencies of Docker Compose
RUN apk add docker-cli docker-cli-compose curl

# Need git to clone the sources of the Fabric Samples repository from GitHub
RUN apk add --no-cache git
Expand All @@ -50,8 +55,7 @@ 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
RUN apk add --no-cache augeas

# Configure the OpenSSH server we just installed
RUN augtool 'set /files/etc/ssh/sshd_config/AuthorizedKeysFile ".ssh/authorized_keys /etc/authorized_keys/%u"'
Expand Down Expand Up @@ -79,23 +83,16 @@ 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/petermetz/quorum-dev-quickstart.git

WORKDIR /quorum-dev-quickstart

RUN git checkout programmatically-accept-start-args

RUN npm i

RUN npm run build

RUN npm run start -- --elk false --privacy true --clientType besu
# Copy quorum-dev-quickstart from the base
COPY --chown=quorum:quorum --from=quorum-dev-quickstart-setup "${ROOT_DIR}" "${ROOT_DIR}"
WORKDIR "${ROOT_DIR}"
COPY --chown=quorum:quorum env-config.ini .env

RUN apk add --no-cache supervisor
RUN apk add --no-cache ncurses

COPY healthcheck.sh /healthcheck.sh
COPY supervisord.conf /etc/supervisord.conf
COPY --chown=quorum:quorum supervisord.conf /etc/supervisord.conf

# # Extend the parent image's entrypoint
# # https://superuser.com/questions/1459466/can-i-add-an-additional-docker-entrypoint-script
Expand Down
4 changes: 4 additions & 0 deletions tools/docker/besu-multi-party-all-in-one/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -101,3 +101,7 @@ docker run \
--publish 25000:25000 \
cbmpaio
```

## Updating the Besu version
- `env-config.ini` is the configuration file of `quorum-dev-quickstart` npm package (it's copied as `.env` in the container).
- To use another version of besu ledger update specific variables in `env-config.ini` and build the container.
22 changes: 22 additions & 0 deletions tools/docker/besu-multi-party-all-in-one/env-config.ini
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
# This file defines environment variables defaults for Docker-compose
# but we also use it for shell scripts as a sourced file

BESU_VERSION=23.4.1
QUORUM_VERSION=23.4.0
TESSERA_VERSION=23.4.0
ETHSIGNER_VERSION=22.1.3
QUORUM_EXPLORER_VERSION=4f60191

LOCK_FILE=.quorumDevQuickstart.lock

# GoQuorum consensus algorithm
# istanbul, qbft, raft
# !!! lower case ONLY here
GOQUORUM_CONS_ALGO=qbft

# Besu consensus algorithm
# IBFT, QBFT, CLIQUE
# PLEASE NOTE: IBFT used here refers to IBFT2.0 and not IBFT1.0 More information can be found https://besu.hyperledger.org/en/latest/HowTo/Configure/Consensus-Protocols/IBFT/
# We use IBFT here to keep the API names consistent
# !!! upper case ONLY here
BESU_CONS_ALGO=QBFT
4 changes: 3 additions & 1 deletion tools/docker/besu-multi-party-all-in-one/supervisord.conf
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,9 @@ stdout_logfile=/dev/stdout
stdout_logfile_maxbytes=0

[program:besu-network]
command=/quorum-dev-quickstart/run.sh
command=%(ENV_ROOT_DIR)s/run.sh
user=quorum
environment=HOME="/opt/quorum-dev-quickstart",USER="quorum",TERM="linux"
autostart=true
autorestart=unexpected
stderr_logfile=/dev/stderr
Expand Down
20 changes: 2 additions & 18 deletions tools/docker/fabric-all-in-one/Dockerfile_v1.4.x
Original file line number Diff line number Diff line change
Expand Up @@ -10,23 +10,7 @@ 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
RUN apk add docker-cli docker-cli-compose

# Need git to clone the sources of the Fabric Samples repository from GitHub
RUN apk add --no-cache git
Expand Down Expand Up @@ -57,7 +41,7 @@ RUN apk add --no-cache libc6-compat
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
RUN apk add --no-cache augeas

# Configure the OpenSSH server we just installed
RUN augtool 'set /files/etc/ssh/sshd_config/AuthorizedKeysFile ".ssh/authorized_keys /etc/authorized_keys/%u"'
Expand Down
20 changes: 2 additions & 18 deletions tools/docker/fabric-all-in-one/Dockerfile_v2.x
Original file line number Diff line number Diff line change
Expand Up @@ -12,23 +12,7 @@ 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
RUN apk add docker-cli docker-cli-compose

# Need git to clone the sources of the Fabric Samples repository from GitHub
RUN apk add --no-cache git
Expand Down Expand Up @@ -62,7 +46,7 @@ RUN apk add --no-cache libc6-compat
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
RUN apk add --no-cache augeas

# Configure the OpenSSH server we just installed
RUN augtool 'set /files/etc/ssh/sshd_config/AuthorizedKeysFile ".ssh/authorized_keys /etc/authorized_keys/%u"'
Expand Down
43 changes: 23 additions & 20 deletions tools/docker/quorum-multi-party-all-in-one/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@
# Setup quorum-dev-quickstart
################################

FROM node:16.17.0 AS quorum-dev-quickstart-setup
FROM node:18.17.0 AS quorum-dev-quickstart-setup

ENV QUORUM_QUICKSTART_VERSION=0.0.80
ENV QUORUM_QUICKSTART_VERSION=0.1.5
ENV ROOT_DIR=/opt/quorum-dev-quickstart

WORKDIR "${ROOT_DIR}"
Expand All @@ -14,38 +14,41 @@ RUN quorum-dev-quickstart --clientType goquorum --outputPath ./ --monitoring def

################################
# STAGE 2
# docker-compose base
# docker compose base
################################

FROM docker:24.0.2-dind
FROM docker:24.0.5-dind

ENV ROOT_DIR=/opt/quorum-dev-quickstart

# Install docker-compose and quorum-dev-quickstart setup dependencies
# Install docker compose and quorum-dev-quickstart setup dependencies
RUN apk update \
&& apk add --no-cache \
py-pip \
python3-dev \
libffi-dev \
openssl-dev \
gcc \
libc-dev \
rust \
cargo \
make \
bash \
ncurses \
supervisor \
&& pip install docker-compose
docker-cli \
docker-cli-compose \
gcc \
libc-dev \
rust \
cargo \
make \
bash \
ncurses \
supervisor

RUN addgroup -g 1000 quorum \
&& adduser -u 1000 -G quorum -g docker -s /bin/sh -D quorum \
&& addgroup docker \
&& addgroup quorum docker

# Copy quorum-dev-quickstart from the base
COPY --from=quorum-dev-quickstart-setup "${ROOT_DIR}" "${ROOT_DIR}"
COPY --chown=quorum:quorum --from=quorum-dev-quickstart-setup "${ROOT_DIR}" "${ROOT_DIR}"
WORKDIR "${ROOT_DIR}"
COPY --chown=quorum:quorum env-config.ini .env

COPY healthcheck.sh /healthcheck.sh
HEALTHCHECK --interval=10s --timeout=5s --start-period=60s --retries=500 CMD /healthcheck.sh

COPY supervisord.conf /etc/supervisord.conf
COPY --chown=quorum:quorum supervisord.conf /etc/supervisord.conf
ENTRYPOINT ["/usr/bin/supervisord"]
CMD ["--configuration", "/etc/supervisord.conf", "--nodaemon"]

Expand Down
4 changes: 4 additions & 0 deletions tools/docker/quorum-multi-party-all-in-one/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -86,3 +86,7 @@ docker run \
--publish 25000:25000 \
cqmpaio
```

## Updating the Quorum version
- `env-config.ini` is the configuration file of `quorum-dev-quickstart` npm package (it's copied as `.env` in the container).
- To use another version of quorum ledger update specific variables in `env-config.ini` and build the container.
22 changes: 22 additions & 0 deletions tools/docker/quorum-multi-party-all-in-one/env-config.ini
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
# This file defines environment variables defaults for Docker-compose
# but we also use it for shell scripts as a sourced file

BESU_VERSION=23.4.1
QUORUM_VERSION=23.4.0
TESSERA_VERSION=23.4.0
ETHSIGNER_VERSION=22.1.3
QUORUM_EXPLORER_VERSION=4f60191

LOCK_FILE=.quorumDevQuickstart.lock

# GoQuorum consensus algorithm
# istanbul, qbft, raft
# !!! lower case ONLY here
GOQUORUM_CONS_ALGO=qbft

# Besu consensus algorithm
# IBFT, QBFT, CLIQUE
# PLEASE NOTE: IBFT used here refers to IBFT2.0 and not IBFT1.0 More information can be found https://besu.hyperledger.org/en/latest/HowTo/Configure/Consensus-Protocols/IBFT/
# We use IBFT here to keep the API names consistent
# !!! upper case ONLY here
BESU_CONS_ALGO=QBFT
2 changes: 2 additions & 0 deletions tools/docker/quorum-multi-party-all-in-one/supervisord.conf
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@ stdout_logfile_maxbytes=0

[program:quorum-network]
command=%(ENV_ROOT_DIR)s/run.sh
user=quorum
environment=HOME="/opt/quorum-dev-quickstart",USER="quorum",TERM="linux"
autostart=true
autorestart=false
stderr_logfile=/dev/stderr
Expand Down
23 changes: 9 additions & 14 deletions tools/docker/sawtooth-all-in-one/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,20 +1,15 @@
FROM docker:24.0.2-dind
FROM docker:24.0.5-dind

# Install docker-compose and it's dependencies
RUN apk update \
&& apk add --no-cache \
py-pip \
python3-dev \
libffi-dev \
openssl-dev \
gcc \
libc-dev \
rust \
cargo \
make \
supervisor \
&& pip install wheel \
&& pip install docker-compose
docker-cli \
docker-cli-compose \
gcc \
libc-dev \
rust \
cargo \
make \
supervisor

# Copy sawtooth docker-compose
COPY ./sawtooth-default.yaml /app/docker-compose.yaml
Expand Down
3 changes: 1 addition & 2 deletions tools/docker/sawtooth-all-in-one/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,10 @@ docker-compose build && docker-compose up -d
```

### Docker
> Excute from `tools/docker/sawtooth-all-in-one` or adjust the paths accordingly.

``` bash
# Build
DOCKER_BUILDKIT=1 docker build . -t cactus-sawtooth-all-in-one
DOCKER_BUILDKIT=1 docker build ./tools/docker/sawtooth-all-in-one/ -t cactus-sawtooth-all-in-one

# Run
docker run --name sawtooth_all_in_one_ledger_1x --detach --privileged -p 8008:8008 cactus-sawtooth-all-in-one
Expand Down

0 comments on commit a028aa0

Please sign in to comment.