Skip to content

Commit

Permalink
Fix missing curl binary and update CI (#45)
Browse files Browse the repository at this point in the history
Fix parquet file download error because of a missing curl binary.
This was happening on the `eth_getBalance` test for instance.
Note that flood swallowed the exception making the error harder to spot.

Update the CI to also test against eth_getBalance which triggers a
parquet file download.
Also removes the redundant node2, this was a workaround as flood used to
crash with only one node.

Also unpin the patch version of Python and address a small DRY on the
Vegeta version.
  • Loading branch information
AndreMiras authored Aug 30, 2023
1 parent eb88711 commit 03f93c4
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 9 deletions.
9 changes: 6 additions & 3 deletions .github/workflows/docker.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,18 @@ on:

jobs:
docker:
strategy:
matrix:
test: ["eth_getBalance", "eth_getBlockByNumber"]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: docker/setup-buildx-action@v2
- run: docker build --tag paradigmxyz/flood:latest .
- run: docker run --rm paradigmxyz/flood:latest version
- run: |
- name: ${{ matrix.test }}
run: |
docker run --rm paradigmxyz/flood:latest \
eth_getBlockByNumber \
${{ matrix.test }} \
node1=https://eth.llamarpc.com \
node2=https://eth.llamarpc.com \
--duration 3 --rate 1
15 changes: 9 additions & 6 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
# https://github.com/paradigmxyz/flood/pkgs/container/flood

# Stage 1: Install flood
FROM python:3.11.3-slim AS flood-builder
FROM python:3.11-slim AS flood-builder
ENV USERNAME="flood"
ENV PATH="${PATH}:/home/${USERNAME}/.local/bin"
RUN adduser $USERNAME
Expand All @@ -14,23 +14,26 @@ RUN pip install --user --no-cache-dir ./

# Stage 2: Install vegeta
FROM debian:stable-slim AS vegeta-builder
ENV VEGETA_VERSION=12.8.4
RUN apt-get update && apt-get install -y --no-install-recommends wget ca-certificates \
&& rm -rf /var/lib/apt/lists/* \
&& mkdir /vegeta
WORKDIR /vegeta
RUN wget https://github.com/tsenart/vegeta/releases/download/v12.8.4/vegeta_12.8.4_linux_amd64.tar.gz \
&& tar xzf vegeta_12.8.4_linux_amd64.tar.gz \
&& rm vegeta_12.8.4_linux_amd64.tar.gz
RUN wget https://github.com/tsenart/vegeta/releases/download/v${VEGETA_VERSION}/vegeta_${VEGETA_VERSION}_linux_amd64.tar.gz \
&& tar xzf vegeta_${VEGETA_VERSION}_linux_amd64.tar.gz \
&& rm vegeta_${VEGETA_VERSION}_linux_amd64.tar.gz

# Final stage: Combine flood and vegeta
FROM python:3.11.3-slim
FROM python:3.11-slim
ENV USERNAME="flood"
ENV PATH="${PATH}:/home/${USERNAME}/.local/bin"
RUN adduser $USERNAME
USER $USERNAME

RUN apt-get update && apt-get install -y --no-install-recommends curl \
&& rm -rf /var/lib/apt/lists/*
COPY --from=flood-builder /home/$USERNAME/.local /home/$USERNAME/.local
COPY --from=vegeta-builder /vegeta/vegeta /home/$USERNAME/.local/bin/vegeta

USER $USERNAME
WORKDIR /home/$USERNAME
ENTRYPOINT ["python", "-m", "flood"]

0 comments on commit 03f93c4

Please sign in to comment.