Skip to content

Commit ce8f38c

Browse files
authored
feat(misc/server): add libp2p-lookup to rust-libp2p-server
As mentioned in #4444, we need to include https://github.com/mxinden/libp2p-lookup/ in the image so that we can enable a healthcheck when it starts up. Pull-Request: #4466.
1 parent ae3cef1 commit ce8f38c

File tree

6 files changed

+19
-5
lines changed

6 files changed

+19
-5
lines changed

Cargo.lock

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ libp2p-quic = { version = "0.9.2", path = "transports/quic" }
9191
libp2p-relay = { version = "0.16.1", path = "protocols/relay" }
9292
libp2p-rendezvous = { version = "0.13.0", path = "protocols/rendezvous" }
9393
libp2p-request-response = { version = "0.25.1", path = "protocols/request-response" }
94-
libp2p-server = { version = "0.12.2", path = "misc/server" }
94+
libp2p-server = { version = "0.12.3", path = "misc/server" }
9595
libp2p-swarm = { version = "0.43.4", path = "swarm" }
9696
libp2p-swarm-derive = { version = "0.33.0", path = "swarm-derive" }
9797
libp2p-swarm-test = { version = "0.2.0", path = "swarm-test" }

misc/server/CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,10 @@ All notable changes to this project will be documented in this file.
44
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
55
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
66

7+
## [0.12.3] - unreleased
8+
### Changed
9+
- Add libp2p-lookup to Dockerfile to enable healthchecks.
10+
711
## [0.12.2]
812
### Fixed
913
- Adhere to `--metrics-path` flag and listen on `0.0.0.0:8888` (default IPFS metrics port).

misc/server/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "libp2p-server"
3-
version = "0.12.2"
3+
version = "0.12.3"
44
authors = ["Max Inden <[email protected]>"]
55
edition = "2021"
66
repository = "https://github.com/libp2p/rust-libp2p"

misc/server/Dockerfile

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,12 @@
1-
FROM rust:1.66-bullseye as builder
1+
FROM rust:1.72-bullseye as builder
22
WORKDIR /usr/src/rust-libp2p-server
33

44
# Run with access to the target cache to speed up builds
55
WORKDIR /workspace
6+
7+
RUN --mount=type=cache,target=/usr/local/cargo/registry \
8+
cargo install --locked --root /usr/local libp2p-lookup --version 0.6.4
9+
610
ADD . .
711
RUN --mount=type=cache,target=./target \
812
--mount=type=cache,target=/usr/local/cargo/registry \
@@ -12,5 +16,5 @@ RUN --mount=type=cache,target=./target \
1216
mv ./target/release/libp2p-server /usr/local/bin/libp2p-server
1317

1418
FROM gcr.io/distroless/cc
15-
COPY --from=builder /usr/local/bin/libp2p-server /usr/local/bin/libp2p-server
19+
COPY --from=builder /usr/local/bin/libp2p-server /usr/local/bin/libp2p-lookup /usr/local/bin/
1620
CMD ["libp2p-server"]

misc/server/README.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,3 +33,9 @@ Local peer id: PeerId("12D3KooWSa1YEeQVSwvoqAMhwjKQ6kqZQckhWPb3RWEGV3sZGU6Z")
3333
Listening on "/ip4/127.0.0.1/udp/4001/quic"
3434
[...]
3535
```
36+
37+
The Docker container includes [libp2-lookup](https://github.com/mxinden/libp2p-lookup/) to enable adding a proper healthcheck for container startup, e.g.
38+
39+
``` shell
40+
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
41+
```

0 commit comments

Comments
 (0)