Skip to content

Commit

Permalink
Merge pull request #34 from /issues/33
Browse files Browse the repository at this point in the history
Issues/33
  • Loading branch information
cnorburn authored Jul 22, 2024
2 parents 33295ec + 392d98c commit fa5a46a
Show file tree
Hide file tree
Showing 5 changed files with 30 additions and 21 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,4 @@
/tmp
result
venv
.idea
26 changes: 18 additions & 8 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,15 @@ FROM debian:buster AS build
# Allow users to specify forked node, or specific commit
# If not fallback to release branch (or alternatively just specify branch)
ARG NODE_REPO=https://github.com/casper-network/casper-node.git
ARG NODE_COMMIT=
ARG CLIENT_REPO=https://github.com/casper-ecosystem/casper-client-rs.git
ARG CLIENT_COMMIT=
ARG NODE_GITBRANCH=release-1.5.6
ARG CLIENT_GITBRANCH=release-2.0.0
ARG SIDECAR_REPO=https://github.com/casper-network/casper-sidecar.git

ARG NODE_COMMIT=
ARG NODE_GITBRANCH=release-2.0.0-rc3
ARG CLIENT_GITBRANCH=feat-track-node-2.0
ARG CLIENT_COMMIT=317051ddfb372d9404850c6a1787f225d6d32b4e
ARG SIDECAR_GITBRANCH=release-1.0.0rc2_node-2.0.0rc3
ARG SIDECAR_COMMIT=

RUN apt-get update \
&& DEBIAN_FRONTEND="noninteractive" \
Expand All @@ -30,14 +34,19 @@ ENV PATH="$PATH:/root/.cargo/bin"

RUN git clone https://github.com/casper-network/casper-node-launcher.git
RUN if [ -n "$NODE_COMMIT" ]; then \
git clone -b $NODE_COMMIT $NODE_REPO; \
git clone $NODE_REPO && cd casper-node && git checkout $NODE_COMMIT && cd ..; \
else \
git clone -b $NODE_GITBRANCH $NODE_REPO; \
fi \
&& if [ -n "$CLIENT_COMMIT" ]; then \
git clone -b $CLIENT_COMMIT $CLIENT_REPO; \
git clone $CLIENT_REPO && cd casper-client-rs && git checkout $CLIENT_COMMIT && cd ..; \
else \
git clone -b $CLIENT_GITBRANCH $CLIENT_REPO; \
fi \
&& if [ -n "$SIDECAR_COMMIT" ]; then \
git clone $SIDECAR_REPO && cd casper-sidecar && git checkout $SIDECAR_COMMIT && cd ..; \
else \
git clone -b $SIDECAR_GITBRANCH $SIDECAR_REPO; \
fi

# Local CCTL source code.
Expand Down Expand Up @@ -76,6 +85,7 @@ WORKDIR /home/cctl
COPY --from=build --chown=cctl:cctl /casper-node-launcher ./casper-node-launcher
COPY --from=build --chown=cctl:cctl /casper-client-rs ./casper-client-rs
COPY --from=build --chown=cctl:cctl /casper-node ./casper-node
COPY --from=build --chown=cctl:cctl /casper-sidecar ./casper-sidecar
COPY --from=build --chown=cctl:cctl /cctl ./cctl

ENV CCTL="/home/cctl/cctl"
Expand All @@ -85,9 +95,9 @@ RUN echo "source $CCTL/activate" >> .bashrc
COPY --chown=cctl:cctl ./docker/start.sh .
RUN chmod +x start.sh

EXPOSE 11101-11105 14101-14105 18101-18105
EXPOSE 11101-11105 12101-12105 13101-13105 14101-14105 21101-21105 22101-22105

HEALTHCHECK --interval=10s --timeout=5s --retries=4 --start-period=20s \
CMD curl --silent --location 'http://127.0.0.1:11101/rpc' --header 'Content-Type: application/json' --data '{"id": "1", "jsonrpc": "2.0", "method": "info_get_status", "params": []}' | jq -e -n 'input.result.reactor_state' | grep "Validate"
CMD curl --silent --location 'http://127.0.0.1:21101/rpc' --header 'Content-Type: application/json' --data '{"id": "1", "jsonrpc": "2.0", "method": "info_get_status", "params": []}' | jq -e -n 'input.result.reactor_state' | grep "Validate"

CMD ["/bin/bash", "-c", "source start.sh"]
14 changes: 5 additions & 9 deletions docker/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -97,21 +97,17 @@ docker exec -t -i cspr-cctl /bin/bash
cctl-chain-view-genesis-chainspec
```

[TODO: Add a deploy example]

To view how cctl can be used within a project view the following Terminus SDK test projects:

[TODO: Add the links once the Terminus project have migrated to CCTL]

- Java
- [Java](https://github.com/casper-sdks/terminus-java-tests)

- Python
- [Python](https://github.com/casper-sdks/terminus-python-tests)

- Go
- [Go](https://github.com/casper-sdks/terminus-go-tests)

- JS
- [JS](https://github.com/casper-sdks/terminus-js-tests)

- C#
- [C#](https://github.com/casper-sdks/terminus-dotnet-tests)

### Pre-built images

Expand Down
6 changes: 4 additions & 2 deletions docker/clean.sh
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,10 @@ rm -r casper-node-launcher/target/release/.fingerprint
rm -r casper-client-rs/target/release/build
rm -r casper-client-rs/target/release/deps
rm -r casper-client-rs/target/release/.fingerprint
rm -r casper-sidecar/target/release/build
rm -r casper-sidecar/target/release/deps
rm -r casper-sidecar/target/release/.fingerprint
rm -r casper-node/.git
rm -r casper-client-rs/.git
rm -r casper-node-launcher/.git
rm -r casper-node/utils/nctl
rm -r casper-node/utils/nctl-metrics
rm -r casper-sidecar/.git
4 changes: 2 additions & 2 deletions docker/start.sh
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#!/bin/bash

source $CCTL/activate
source $CCTL/cmds/infra/net/setup.sh
source $CCTL/cmds/infra/net/start.sh
source $CCTL/cmds/infra/net/ctl_setup.sh
source $CCTL/cmds/infra/net/ctl_start.sh

tail -f $CCTL/assets/nodes/node-1/logs/node-stderr.log

0 comments on commit fa5a46a

Please sign in to comment.