Commit 89947282 authored by Bernhard Schuster's avatar Bernhard Schuster
Browse files

fix README and containers

parent 4ff6d8f5
......@@ -2,6 +2,12 @@
Create nemesis nodes with alternate, at best faulty, at worst intentionally destructive behavior traits.
The first argument determines the behavior strain. The currently supported are:
* `suggest-garbage-candidate`
* `back-garbage-candidate`
* `dispute-ancestor`
## Integration test cases
To define integration tests create file
......@@ -38,16 +44,9 @@ This will also teardown the cluster after completion.
In order to build the container image you need to have the latest changes from
polkadot and substrate master branches.
There different behavior strains, pick one that you'd like to use with a build arg:
`$VARIANT` is one of:
* `dispute-ancestor`
* `second-garbage`
```sh
pwd # run this from the current dir
podman build --build-arg=$VARIANT -t paritypr/malus:v1 -f Containerfile ../../..
podman build -t paritypr/malus:v1 -f Containerfile ../../..
```
[gurke]: https://github.com/paritytech/gurke
......
......@@ -26,10 +26,10 @@ COPY substrate/ /usr/src/polkadot-malus/substrate/
WORKDIR /usr/src/polkadot-malus/polkadot
RUN cargo build -p polkadot-test-malus --release
RUN cp -v /usr/src/polkadot-malus/polkadot/target/release/malus-$VARIANT /usr/local/bin
RUN cp -v /usr/src/polkadot-malus/polkadot/target/release/malus /usr/local/bin
# check if executable works in this container
RUN /usr/local/bin/malus-$VARIANT --version
RUN /usr/local/bin/malus $VARIANT --version
#
### Runtime
......@@ -39,7 +39,7 @@ FROM debian:buster-slim as runtime
RUN apt-get update && \
apt-get install -y curl tini
COPY --from=builder /usr/src/polkadot-malus/polkadot/target/release/malus-$VARIANT /usr/local/bin
COPY --from=builder /usr/src/polkadot-malus/polkadot/target/release/malus /usr/local/bin
# Non-root user for security purposes.
#
# UIDs below 10,000 are a security risk, as a container breakout could result
......@@ -63,9 +63,9 @@ RUN chown -R nonroot. /home/nonroot
# Tell run test script that it runs in container
USER nonroot
# check if executable works in this container
RUN /usr/local/bin/malus-$VARIANT --version
RUN /usr/local/bin/malus --version
# Tini allows us to avoid several Docker edge cases, see https://github.com/krallin/tini.
ENTRYPOINT ["tini", "--", "/usr/local/bin/malus-$VARIANT"]
ENTRYPOINT ["tini", "--", "/usr/local/bin/malus"]
......@@ -128,7 +128,7 @@ RUN cargo build -p polkadot-test-malus --release
FROM debian:buster-slim as runtime
RUN apt-get update && \
apt-get install -y curl tini
COPY --from=builder /usr/src/polkadot-malus/polkadot/target/release/malus-$VARIANT /usr/local/bin
COPY --from=builder /usr/src/polkadot-malus/polkadot/target/release/malus /usr/local/bin
# Non-root user for security purposes.
#
# UIDs below 10,000 are a security risk, as a container breakout could result
......@@ -150,6 +150,6 @@ RUN chown -R nonroot. /home/nonroot
# Tell run test script that it runs in container
USER nonroot
# check if executable works in this container
RUN /usr/local/bin/malus-$VARIANT --version
RUN /usr/local/bin/malus --version
# Tini allows us to avoid several Docker edge cases, see https://github.com/krallin/tini.
ENTRYPOINT ["/usr/local/bin/malus-$VARIANT""]
ENTRYPOINT ["/usr/local/bin/malus"]
......@@ -25,12 +25,10 @@ RUN export PATH="$PATH:$HOME/.cargo/bin" && \
WORKDIR /usr/src/polkadot-malus/polkadot
RUN cargo build -p polkadot-test-malus --release --verbose
RUN cp -v /usr/src/polkadot-malus/polkadot/target/release/malus-dispute-ancestor /usr/local/bin
RUN cp -v /usr/src/polkadot-malus/polkadot/target/release/malus-second-garbage /usr/local/bin
RUN cp -v /usr/src/polkadot-malus/polkadot/target/release/malus /usr/local/bin
# check if executable works in this container
RUN /usr/local/bin/malus-dispute-ancestor --version
RUN /usr/local/bin/malus-second-garbage --version
RUN /usr/local/bin/malus --version
#
### Runtime
......@@ -40,8 +38,7 @@ FROM debian:buster-slim as runtime
RUN apt-get update && \
apt-get install -y curl tini
COPY --from=builder /usr/src/polkadot-malus/polkadot/target/release/malus-malus-dispute-ancestor /usr/local/bin
COPY --from=builder /usr/src/polkadot-malus/polkadot/target/release/malus-malus-second-garbage /usr/local/bin
COPY --from=builder /usr/src/polkadot-malus/polkadot/target/release/malus /usr/local/bin
# Non-root user for security purposes.
#
# UIDs below 10,000 are a security risk, as a container breakout could result
......@@ -64,7 +61,6 @@ RUN chown -R nonroot. /home/nonroot
# Use the non-root user to run our application
USER nonroot
# check if executable works in this container
RUN /usr/local/bin/malus-dispute-ancestor --version
RUN /usr/local/bin/malus-second-garbage --version
RUN /usr/local/bin/malus --version
# Tini allows us to avoid several Docker edge cases, see https://github.com/krallin/tini.
ENTRYPOINT ["tini", "--", "/usr/local/bin/malus-dispute-ancestor"]
ENTRYPOINT ["tini", "--", "/usr/local/bin/malus"]
......@@ -39,14 +39,12 @@ RUN apt-get update && \
# add malus binaries to the docker image
COPY ./malus-dispute-ancestor /usr/local/bin
COPY ./malus-suggest-garbage-candidate /usr/local/bin
COPY ./malus /usr/local/bin
USER nonroot
# check if executable works in this container
RUN /usr/local/bin/malus-dispute-ancestor --version
RUN /usr/local/bin/malus-suggest-garbage-candidate --version
RUN /usr/local/bin/malus --version
# Tini allows us to avoid several Docker edge cases, see https://github.com/krallin/tini.
ENTRYPOINT ["tini", "--", "/bin/bash"]
......@@ -24,6 +24,6 @@ command = "polkadot"
[nodes.david]
validator = true
extra-args = ["--dave"]
image = "{{get_env(name="MALUSIMAGE") | safe }}"
command = "/usr/local/bin/malus-dispute-valid-block"
command = "/usr/local/bin/malus"
extra-args = ["dispute-valid-block", "--dave"]
......@@ -12,24 +12,24 @@ command = "polkadot"
[nodes.bob]
validator = true
extra-args = ["--bob"]
extra-args = ["back-garbage-candidate", "--bob"]
image = "{{get_env(name="MALUSIMAGE") | safe }}"
command = "/usr/local/bin/malus-back-garbage-candidate"
command = "/usr/local/bin/malus"
[nodes.charlie]
validator = true
extra-args = ["--charlie"]
extra-args = ["back-garbage-candidate", "--charlie"]
image = "{{get_env(name="MALUSIMAGE") | safe }}"
command = "/usr/local/bin/malus-back-garbage-candidate"
command = "/usr/local/bin/malus"
[nodes.david]
validator = true
extra-args = ["--dave"]
extra-args = ["back-garbage-candidate", "--dave"]
image = "{{get_env(name="MALUSIMAGE") | safe }}"
command = "/usr/local/bin/malus-back-garbage-candidate"
command = "/usr/local/bin/malus"
[nodes.eve]
validator = true
extra-args = ["--eve"]
extra-args = ["suggest-garbage-candidate","--eve"]
image = "{{get_env(name="MALUSIMAGE") | safe }}"
command = "/usr/local/bin/malus-suggest-garbage-candidate"
command = "/usr/local/bin/malus"
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment