Skip to content
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

feat(misc/server): add libp2p-lookup to rust-libp2p-server #4466

Merged
merged 11 commits into from
Sep 11, 2023
4 changes: 4 additions & 0 deletions misc/server/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,10 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [0.12.2]
mcamou marked this conversation as resolved.
Show resolved Hide resolved
### Changed
- Add libp2p-lookup to Dockerfile to enable healthchecks
mcamou marked this conversation as resolved.
Show resolved Hide resolved

## [0.12.2]
### Fixed
- Adhere to `--metrics-path` flag and listen on `0.0.0.0:8888` (default IPFS metrics port).
Expand Down
8 changes: 6 additions & 2 deletions misc/server/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,8 +1,12 @@
FROM rust:1.66-bullseye as builder
FROM rust:1.67-bullseye as builder
WORKDIR /usr/src/rust-libp2p-server
mcamou marked this conversation as resolved.
Show resolved Hide resolved

# Run with access to the target cache to speed up builds
WORKDIR /workspace

RUN --mount=type=cache,target=/usr/local/cargo/registry \
cargo install --root /usr/local libp2p-lookup

mcamou marked this conversation as resolved.
Show resolved Hide resolved
ADD . .
RUN --mount=type=cache,target=./target \
--mount=type=cache,target=/usr/local/cargo/registry \
Expand All @@ -12,5 +16,5 @@ RUN --mount=type=cache,target=./target \
mv ./target/release/libp2p-server /usr/local/bin/libp2p-server

FROM gcr.io/distroless/cc
COPY --from=builder /usr/local/bin/libp2p-server /usr/local/bin/libp2p-server
COPY --from=builder /usr/local/bin/libp2p-server /usr/local/bin/libp2p-lookup /usr/local/bin/
CMD ["libp2p-server"]
6 changes: 6 additions & 0 deletions misc/server/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,3 +33,9 @@ Local peer id: PeerId("12D3KooWSa1YEeQVSwvoqAMhwjKQ6kqZQckhWPb3RWEGV3sZGU6Z")
Listening on "/ip4/127.0.0.1/udp/4001/quic"
[...]
```

The Docker container includes [libp2-lookup](https://github.com/mxinden/libp2p-lookup/) to enable adding a proper healthcheck for container startup, e.g.

``` shell
docker run --health-cmd 'libp2p-lookup direct --address /ip4/127.0.0.1/tcp/4001/p2p/QmQCU2EcMqAqQPR2i9bChDtGNJchTbq5TbXJJ16u19uLTa' /home/ipfs/.ipfs:/ipfs ghcr.io/libp2p/rust-libp2p-server --config /ipfs/config
```
Loading