-
Notifications
You must be signed in to change notification settings - Fork 57
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
chore: easy setup fleets for lpt #3125
Merged
Merged
Changes from 7 commits
Commits
Show all changes
21 commits
Select commit
Hold shift + click to select a range
3e19e46
Added bootstrap peer exchange discovery option for easy setup ltp
NagyZoltanPeter 8859c58
Extended with PX discovery, auto-dial of PX cap peers, added switchin…
NagyZoltanPeter 7febe57
Added peer-exchange, found capable peers test, metrics on peer stabil…
NagyZoltanPeter 33c6ed0
Updated and actualized README.md for liteprotocoltester
NagyZoltanPeter 460f561
Created jenkinsfile for liteprotocoltester deployment
NagyZoltanPeter e9fb3c2
Fix build after rebase to latest master. Applied renames from PeerMan…
NagyZoltanPeter d781bb2
Fix Jenkinsfile.lpt choice param of LOGLEVEL
NagyZoltanPeter 47e2e04
Fix image push for jenkins job
NagyZoltanPeter 77238bf
More fix for deployment jenkins job
NagyZoltanPeter 2f90d5f
More fix to Jenkinsfile.lpt
NagyZoltanPeter 1fd679b
More fix to Jenkinsfile.lpt
NagyZoltanPeter 613f5bd
Fix Jenkinsfile.lpt post job cleanup
NagyZoltanPeter b83eaa5
Apply suggestions from code review
NagyZoltanPeter d591eb2
Address review comment with more explanation. Fixed dial exception du…
NagyZoltanPeter 286c4d4
Add configuration for requesting and testing peer exchange peers
NagyZoltanPeter 6d2a51a
Remove debug leftover
NagyZoltanPeter 9a1cd42
Fix lint issues
NagyZoltanPeter 6ca28a2
Addressing review comments, extended examples added to Readme
NagyZoltanPeter b212921
Better explaination in Readme, added metrics port configurability
NagyZoltanPeter 2a863d4
Fix cli arg description
NagyZoltanPeter a808619
Fix linting problem
NagyZoltanPeter File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
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
77 changes: 38 additions & 39 deletions
77
apps/liteprotocoltester/Dockerfile.liteprotocoltester.compile
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 |
---|---|---|
@@ -1,58 +1,57 @@ | ||
# BUILD NIM APP ---------------------------------------------------------------- | ||
FROM rust:1.77.1-alpine3.18 AS nim-build | ||
FROM rust:1.77.1-alpine3.18 AS nim-build | ||
|
||
ARG NIMFLAGS | ||
ARG MAKE_TARGET=liteprotocoltester | ||
ARG NIM_COMMIT | ||
ARG LOG_LEVEL=DEBUG | ||
ARG NIMFLAGS | ||
ARG MAKE_TARGET=liteprotocoltester | ||
ARG NIM_COMMIT | ||
ARG LOG_LEVEL=TRACE | ||
|
||
# Get build tools and required header files | ||
RUN apk add --no-cache bash git build-base pcre-dev linux-headers curl jq | ||
# Get build tools and required header files | ||
RUN apk add --no-cache bash git build-base openssl-dev pcre-dev linux-headers curl jq | ||
|
||
WORKDIR /app | ||
COPY . . | ||
WORKDIR /app | ||
COPY . . | ||
|
||
# workaround for alpine issue: https://github.com/alpinelinux/docker-alpine/issues/383 | ||
RUN apk update && apk upgrade | ||
# workaround for alpine issue: https://github.com/alpinelinux/docker-alpine/issues/383 | ||
RUN apk update && apk upgrade | ||
|
||
# Ran separately from 'make' to avoid re-doing | ||
RUN git submodule update --init --recursive | ||
# Ran separately from 'make' to avoid re-doing | ||
RUN git submodule update --init --recursive | ||
|
||
# Slowest build step for the sake of caching layers | ||
RUN make -j$(nproc) deps QUICK_AND_DIRTY_COMPILER=1 ${NIM_COMMIT} | ||
# Slowest build step for the sake of caching layers | ||
RUN make -j$(nproc) deps QUICK_AND_DIRTY_COMPILER=1 ${NIM_COMMIT} | ||
|
||
# Build the final node binary | ||
RUN make -j$(nproc) ${NIM_COMMIT} $MAKE_TARGET LOG_LEVEL=${LOG_LEVEL} NIMFLAGS="${NIMFLAGS}" | ||
# Build the final node binary | ||
RUN make -j$(nproc) ${NIM_COMMIT} $MAKE_TARGET LOG_LEVEL=${LOG_LEVEL} NIMFLAGS="${NIMFLAGS}" | ||
|
||
|
||
# PRODUCTION IMAGE ------------------------------------------------------------- | ||
# PRODUCTION IMAGE ------------------------------------------------------------- | ||
|
||
FROM alpine:3.18 AS prod | ||
FROM alpine:3.18 AS prod | ||
|
||
ARG MAKE_TARGET=liteprotocoltester | ||
ARG MAKE_TARGET=liteprotocoltester | ||
|
||
LABEL maintainer="jakub@status.im" | ||
LABEL source="https://github.com/waku-org/nwaku" | ||
LABEL description="Lite Protocol Tester: Waku light-client" | ||
LABEL commit="unknown" | ||
LABEL version="unknown" | ||
LABEL maintainer="zoltan@status.im" | ||
LABEL source="https://github.com/waku-org/nwaku" | ||
LABEL description="Lite Protocol Tester: Waku light-client" | ||
LABEL commit="unknown" | ||
LABEL version="unknown" | ||
|
||
# DevP2P, LibP2P, and JSON RPC ports | ||
EXPOSE 30303 60000 8545 | ||
# DevP2P, LibP2P, and JSON RPC ports | ||
EXPOSE 30303 60000 8545 | ||
|
||
# Referenced in the binary | ||
RUN apk add --no-cache libgcc pcre-dev libpq-dev | ||
# Referenced in the binary | ||
RUN apk add --no-cache libgcc pcre-dev libpq-dev \ | ||
wget \ | ||
iproute2 | ||
|
||
# Fix for 'Error loading shared library libpcre.so.3: No such file or directory' | ||
RUN ln -s /usr/lib/libpcre.so /usr/lib/libpcre.so.3 | ||
# Fix for 'Error loading shared library libpcre.so.3: No such file or directory' | ||
RUN ln -s /usr/lib/libpcre.so /usr/lib/libpcre.so.3 | ||
|
||
# Copy to separate location to accomodate different MAKE_TARGET values | ||
COPY --from=nim-build /app/build/$MAKE_TARGET /usr/bin/ | ||
COPY --from=nim-build /app/build/liteprotocoltester /usr/bin/ | ||
COPY --from=nim-build /app/apps/liteprotocoltester/run_tester_node.sh /usr/bin/ | ||
|
||
# Copy migration scripts for DB upgrades | ||
COPY --from=nim-build /app/migrations/ /app/migrations/ | ||
ENTRYPOINT ["/usr/bin/run_tester_node.sh", "/usr/bin/liteprotocoltester"] | ||
|
||
ENTRYPOINT ["/usr/bin/liteprotocoltester"] | ||
|
||
# By default just show help if called without arguments | ||
CMD ["--help"] | ||
# # By default just show help if called without arguments | ||
CMD ["--help"] |
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 |
---|---|---|
|
@@ -17,43 +17,26 @@ and multiple receivers. | |
|
||
Publishers are fill all message payloads with information about the test message and sender, helping the receiver side to calculate results. | ||
|
||
## Phases of development | ||
|
||
### Phase 1 | ||
|
||
At the first phase we aims to demonstrate the concept of the testing all boundled into a docker-compose environment where we run | ||
one service (full)node and a publisher and a receiver node. | ||
At this stage we can only configure number of messages and fixed frequency of the message pump. We do not expect message losses and any significant latency hence the test setup is very simple. | ||
|
||
### Further plans | ||
|
||
- Add more configurability (randomized message sizes, usage of more content topics and support for static sharding). | ||
- Extend collected metrics and polish reporting. | ||
- Add test metrics to graphana dashboard. | ||
- Support for static sharding and auto sharding for being able to test under different conditions. | ||
- ... | ||
|
||
## Usage | ||
|
||
### Phase 1 | ||
|
||
> NOTICE: This part is obsolate due integration with waku-simulator. | ||
> It needs some rework to make it work again standalone. | ||
### Using lpt-runner | ||
|
||
Lite Protocol Tester application is built under name `liteprotocoltester` in apps/liteprotocoltester folder. | ||
For ease of use, you can clone lpt-runner repository. That will utilize previously pushed liteprotocoltester docker image. | ||
It is recommended to use this method for fleet testing. | ||
|
||
Starting from nwaku repository root: | ||
```bash | ||
make liteprotocoltester | ||
cd apps/liteprotocoltester | ||
docker compose build | ||
git clone https://github.com/waku-org/lpt-runner.git | ||
cd lpt-runner | ||
|
||
# check Reame.md for more information | ||
# edit .env file to your needs | ||
|
||
docker compose up -d | ||
docker compose logs -f receivernode | ||
``` | ||
|
||
### Phase 2 | ||
# navigate localhost:3033 to see the lite-protocol-tester dashboard | ||
``` | ||
|
||
> Integration with waku-simulator! | ||
### Integration with waku-simulator! | ||
|
||
- For convenience, integration is done in cooperation with waku-simulator repository, but nothing is tightly coupled. | ||
- waku-simulator must be started separately with its own configuration. | ||
|
@@ -100,9 +83,7 @@ docker compose -f docker-compose-on-simularor.yml logs -f receivernode | |
|
||
Navigate to http://localhost:3033 to see the lite-protocol-tester dashboard. | ||
|
||
### Phase 3 | ||
|
||
> Run independently on a chosen waku fleet | ||
### Run independently on a chosen waku fleet | ||
|
||
This option is simple as is just to run the built liteprotocoltester binary with run_tester_node.sh script. | ||
|
||
|
@@ -136,7 +117,7 @@ Run a SENDER role liteprotocoltester and a RECEIVER role one on different termin | |
|
||
> RECEIVER side will periodically print statistics to standard output. | ||
|
||
## Configure | ||
## Configuration | ||
|
||
### Environment variables for docker compose runs | ||
|
||
|
@@ -158,6 +139,7 @@ Run a SENDER role liteprotocoltester and a RECEIVER role one on different termin | |
| :--- | :--- | :--- | | ||
| --test_func | separation of PUBLISHER or RECEIVER mode | RECEIVER | | ||
| --service-node| Address of the service node to use for lightpush and/or filter service | - | | ||
| --bootstrap-node| Address of the fleet's bootstrap node to use to determine service peer randomly choosen from the network. `--service-node` switch has precedence over this | - | | ||
| --num-messages | Number of message to publish | 120 | | ||
| --delay-messages | Frequency of messages in milliseconds | 1000 | | ||
| --min-message-size | Minimum message size in bytes | 1KiB | | ||
|
@@ -174,21 +156,28 @@ Run a SENDER role liteprotocoltester and a RECEIVER role one on different termin | |
| --log-level | Log level for the application | DEBUG | | ||
| --log-format | Logging output format (TEXT or JSON) | TEXT | | ||
|
||
### Specifying peer addresses | ||
|
||
Service node or bootstrap addresses can be specified in multiadress or ENR form. | ||
|
||
### Using bootstrap nodes | ||
|
||
There are multiple benefits of using bootstrap nodes. By using them liteprotocoltester will use Peer Exchange protocol to get possible peers from the network that are capable to serve as service peers for testing. Additionally it will test dial them to verify their connectivity - this will be reported in the logs and on dashboard metrics. | ||
Also by using bootstrap node and peer exchange discovery, litprotocoltester will be able to simulate service peer switch in case of failures. There are built in tresholds for service peer failures during test and service peer can be switched during the test. Also these service peer failures are reported, thus extening network reliability measures. | ||
|
||
### Docker image notice | ||
|
||
#### Building for docker compose runs on simulator or standalone | ||
Please note that currently to ease testing and development tester application docker image is based on ubuntu and uses the externally pre-built binary of 'liteprotocoltester'. | ||
This speeds up image creation. Another dokcer build file is provided for proper build of boundle image. | ||
|
||
> `Dockerfile.liteprotocoltester.copy` will create an image with the binary copied from the build directory. | ||
> `Dockerfile.liteprotocoltester` will create an ubuntu based image with the binary copied from the build directory. | ||
|
||
> `Dockerfile.liteprotocoltester.compile` will create an image completely compiled from source. This can be quite slow. | ||
> `Dockerfile.liteprotocoltester.compile` will create an ubuntu based image completely compiled from source. This can be slow. | ||
|
||
#### Creating standalone runner docker image | ||
|
||
To ease the work with lite-proto-tester, a docker image is possible to build. | ||
To ease the work with lite-protocol-tester, a docker image is possible to build. | ||
With that image it is easy to run the application in a container. | ||
|
||
> `Dockerfile.liteprotocoltester` will create an ubuntu image with the binary copied from the build directory. You need to pre-build the application. | ||
|
@@ -205,7 +194,17 @@ docker build -t liteprotocoltester:latest -f Dockerfile.liteprotocoltester ../.. | |
|
||
# edit and adjust .env file to your needs and for the network configuration | ||
|
||
docker run --env-file .env liteprotocoltester:latest RECEIVER <service-node-ip4-peer-address> | ||
docker run --env-file .env liteprotocoltester:latest RECEIVER <service-node-peer-address> | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think it'd help to have an example on each command so that an not-experienced reader can learn about the expected address format (that tiny suggestion also applies to the following lines as well.) |
||
|
||
docker run --env-file .env liteprotocoltester:latest SENDER <service-node-ip4-peer-address> | ||
docker run --env-file .env liteprotocoltester:latest SENDER <service-node-peer-address> | ||
``` | ||
|
||
#### Run test with auto service peer selection from a fleet using bootstrap node | ||
|
||
```bash | ||
|
||
docker run --env-file .env liteprotocoltester:latest RECEIVER <bootstrap-node-peer-address> BOOTSTRAP | ||
|
||
docker run --env-file .env liteprotocoltester:latest SENDER <bootstrap-node-peer-address> BOOTSTRAP | ||
``` | ||
|
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is super interesting! Maybe in the future we could set a list of service-nodes and then validate that the peer switch works well from a fixed service-node set.
Sorry, but I don't fully get the first part of the previous sentence. Aside, there's a tiny typo in
entending