Skip to content

Commit

Permalink
fix: patch libp2p to have quieter logging, enable extra metrics (#156)
Browse files Browse the repository at this point in the history
Patches libp2p with pre-release changes including more metrics and
quieter logging around expected errors.
  • Loading branch information
achingbrain authored Sep 25, 2024
1 parent b8a7688 commit 4d7729e
Show file tree
Hide file tree
Showing 18 changed files with 7,198 additions and 414 deletions.
2 changes: 2 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,9 @@ RUN apt-get update && \
WORKDIR /app

COPY package*.json ./
COPY patches ./patches
RUN npm ci --quiet
RUN npm run postinstall

ENV NODE_ENV production

Expand Down
7 changes: 6 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,11 @@
- [Bootstrap details](#bootstrap-details)
- [Requirements of a bootstrap node](#requirements-of-a-bootstrap-node)
- [Start the bootstrapper](#start-the-bootstrapper)
- [RPC API](#rpc-api)
- [Configuring bootstrapper options](#configuring-bootstrapper-options)
- [Building the Docker Image](#building-the-docker-image)
- [Running the docker image (once built):](#running-the-docker-image-once-built)
- [Running the docker image with monitoring:](#running-the-docker-image-with-monitoring)
- [License](#license)
- [Contribution](#contribution)

Expand Down Expand Up @@ -61,13 +63,16 @@ $ curl http://${HOST}:${RPC_PORT}/api/v0/nodejs/gc

# execute a heapdump
$ curl http://${HOST}:${RPC_PORT}/api/v0/nodejs/heapdump

# change the log level
$ curl http://${HOST}:${RPC_PORT}/api/v0/nodejs/log?namespace=libp2p:*
```

Please note that the RPC API server only listens on the loopback interface (127.0.0.1) by default. If you decide to change the `api-host` option, please make sure that the RPC API server is only used for development purposes and is not accessible publicly.

### Configuring bootstrapper options

```
```json
{
"config": {
"description": "Path to IPFS config file",
Expand Down
2 changes: 0 additions & 2 deletions docker-compose.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,7 @@ services:
- CONFIG_FLAGS=""
volumes:
- ./config.json:/config.json
- ./snapshot-dir:/app/snapshot-dir
command: node dist/src/index.js --config /config.json --enable-kademlia --enable-autonat
network_mode: host

prometheus:
restart: unless-stopped
Expand Down
9 changes: 3 additions & 6 deletions example-config.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,9 @@
]
},
"Bootstrap": [
"/dnsaddr/bootstrap.libp2p.io/p2p/QmQCU2EcMqAqQPR2i9bChDtGNJchTbq5TbXJJ16u19uLTa",
"/dnsaddr/bootstrap.libp2p.io/p2p/QmbLHAnMoJPWSCR5Zhtx6BHJX9KiKNN6tpvbUcqanj75Nb",
"/dnsaddr/bootstrap.libp2p.io/p2p/QmcZf59bWwK5XFi76CZX8cbJ4BhTzzA3gU1ZjYZcYW3dwt",
"/ip4/104.131.131.82/tcp/4001/p2p/QmaCpDMGvV2BGHeYERUEnRQAwe3N8SzbUtfsmvsqQLuvuJ",
"/ip4/104.131.131.82/udp/4001/quic-v1/p2p/QmaCpDMGvV2BGHeYERUEnRQAwe3N8SzbUtfsmvsqQLuvuJ",
"/dnsaddr/bootstrap.libp2p.io/p2p/QmNnooDu7bfjPFoTZYxMNLWUQJyrVwtbZg5gBMjTezGAJN"
"/dns4/am6.bootstrap.libp2p.io/tcp/443/wss/p2p/QmbLHAnMoJPWSCR5Zhtx6BHJX9KiKNN6tpvbUcqanj75Nb",
"/dns4/sg1.bootstrap.libp2p.io/p2p/QmcZf59bWwK5XFi76CZX8cbJ4BhTzzA3gU1ZjYZcYW3dwt",
"/dns4/sv15.bootstrap.libp2p.io/p2p/QmNnooDu7bfjPFoTZYxMNLWUQJyrVwtbZg5gBMjTezGAJN"
],
"Identity": {
"PeerID": "Generate with `ipfs init` and then grab from ~/.ipfs/config",
Expand Down
Loading

0 comments on commit 4d7729e

Please sign in to comment.