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(daemon): improve stdout on startup #10472

Merged
merged 3 commits into from
Aug 14, 2024
Merged

Conversation

lidel
Copy link
Member

@lidel lidel commented Aug 8, 2024

Summary

This PR is based on today's colo discussion, aims to address two problems with ipfs daemon output during startup:

  • PeerID missing
  • we have too many libp2p protocols sharing same port, and we also discover addresses via autonat and other means, it is not useful to print multiaddrs during startup
  • devops only care what TCP/IP sockets are opened, show them summary in form host:port (TCP, UDP) and hide libp2p behind ipfs id

Rationale

It no longer makes sense to list all listener and announced multiaddrs when the node starts. Modern libp2p node will have 3-4 transports sharing the same UDP port, and also have a very long list of webtransport and webrtc direct certhashes inlined in the address.

This makes startup output hard to parse, and what is worse, there is no PeerID, making printing these addresses not very useful without calling 'ipfs id' anyway.

This change removes announced and discovered multiaddrs from the stdout and replaces them with prompt to run "ipfs id". This allows user to learn about public address obtained via relays or UPnP.

Second change is to replace list of listeners in multiaddr form with simpler one, that de-duplicates listeners and provides node operator with useful information about opened ports in 'host:port (tcp,udp)' format, which is way more useful during debugging connectivity issues related to port forwarding etc.

Before

Initializing daemon...
Kubo version: 0.29.0
Repo version: 15
System version: amd64/linux
Golang version: go1.22.5
Swarm listening on /ip4/127.0.0.1/tcp/4501
Swarm listening on /ip4/127.0.0.1/udp/4501/quic-v1
Swarm listening on /ip4/127.0.0.1/udp/4501/quic-v1/webtransport/certhash/uEiCh6wGffj2j5qD86KFwWgo6U_X7GFtnQ0lYuXpojKjpgg/certhash/uEiBgIucJI0cdXZcxNr3Mtam5pFUzkUBP4mYthfSkt6hW7Q
Swarm listening on /ip4/172.37.0.1/tcp/4501
Swarm listening on /ip4/172.37.0.1/udp/4501/quic-v1
Swarm listening on /ip4/172.37.0.1/udp/4501/quic-v1/webtransport/certhash/uEiCh6wGffj2j5qD86KFwWgo6U_X7GFtnQ0lYuXpojKjpgg/certhash/uEiBgIucJI0cdXZcxNr3Mtam5pFUzkUBP4mYthfSkt6hW7Q
Swarm listening on /ip4/192.168.30.102/tcp/4501
Swarm listening on /ip4/192.168.30.102/udp/4501/quic-v1
Swarm listening on /ip4/192.168.30.102/udp/4501/quic-v1/webtransport/certhash/uEiCh6wGffj2j5qD86KFwWgo6U_X7GFtnQ0lYuXpojKjpgg/certhash/uEiBgIucJI0cdXZcxNr3Mtam5pFUzkUBP4mYthfSkt6hW7Q
Swarm listening on /ip6/::1/tcp/4501
Swarm listening on /ip6/::1/udp/4501/quic-v1
Swarm listening on /ip6/::1/udp/4501/quic-v1/webtransport/certhash/uEiCh6wGffj2j5qD86KFwWgo6U_X7GFtnQ0lYuXpojKjpgg/certhash/uEiBgIucJI0cdXZcxNr3Mtam5pFUzkUBP4mYthfSkt6hW7Q
Swarm listening on /p2p-circuit
Swarm announcing /ip4/127.0.0.1/tcp/4501
Swarm announcing /ip4/127.0.0.1/udp/4501/quic-v1
Swarm announcing /ip4/127.0.0.1/udp/4501/quic-v1/webtransport/certhash/uEiCh6wGffj2j5qD86KFwWgo6U_X7GFtnQ0lYuXpojKjpgg/certhash/uEiBgIucJI0cdXZcxNr3Mtam5pFUzkUBP4mYthfSkt6hW7Q
Swarm announcing /ip4/192.168.30.102/tcp/4501
Swarm announcing /ip4/192.168.30.102/udp/4501/quic-v1
Swarm announcing /ip4/192.168.30.102/udp/4501/quic-v1/webtransport/certhash/uEiCh6wGffj2j5qD86KFwWgo6U_X7GFtnQ0lYuXpojKjpgg/certhash/uEiBgIucJI0cdXZcxNr3Mtam5pFUzkUBP4mYthfSkt6hW7Q
Swarm announcing /ip4/37.30.210.45/udp/4501/quic-v1
Swarm announcing /ip4/37.30.210.45/udp/4501/quic-v1/webtransport/certhash/uEiCh6wGffj2j5qD86KFwWgo6U_X7GFtnQ0lYuXpojKjpgg/certhash/uEiBgIucJI0cdXZcxNr3Mtam5pFUzkUBP4mYthfSkt6hW7Q
Swarm announcing /ip6/::1/tcp/4501
Swarm announcing /ip6/::1/udp/4501/quic-v1
Swarm announcing /ip6/::1/udp/4501/quic-v1/webtransport/certhash/uEiCh6wGffj2j5qD86KFwWgo6U_X7GFtnQ0lYuXpojKjpgg/certhash/uEiBgIucJI0cdXZcxNr3Mtam5pFUzkUBP4mYthfSkt6hW7Q
RPC API server listening on /ip4/127.0.0.1/tcp/5501
WebUI: http://127.0.0.1:5501/webui
Gateway server listening on /ip4/127.0.0.1/tcp/8580
Daemon is ready

After (this PR)

PeerID is printed, and swarm listeners are summarized as host:port (TCP, UDP)

Initializing daemon...
Kubo version: 0.30.0-dev-02fde38fb
Repo version: 16
System version: amd64/linux
Golang version: go1.22.5
PeerID: 12D3KooWQ73s1CQsm4jWwQvdCAtc5w8LatyQt7QLQARk5xdhK9CE
Swarm listening on 127.0.0.1:4501 (TCP,UDP)
Swarm listening on 192.168.30.102:4501 (TCP,UDP)
Swarm listening on 172.37.0.1:4501 (TCP,UDP)
Swarm listening on [::1]:4501 (TCP,UDP)
Run 'ipfs id' to inspect announced and discovered multiaddrs of this node.
RPC API server listening on /ip4/127.0.0.1/tcp/5501
WebUI: http://127.0.0.1:5501/webui
Gateway server listening on /ip4/127.0.0.1/tcp/8580
Daemon is ready

cc #10436

It no longer makes sense to list  all listener and announced multiaddrs
when the node starts. Modern libp2p node will have 3-4 transports
sharign the same UDP port, and also have a very long list of
webtransport and webrtc direct certhashes inlined in the address.

This makes startup output hard to parse, and what is worse, there is no
PeerID, making printing these addresses not very useful without calling
'ipfs id' anyway.

This change removes annouced and discovered multiaddrs from the stdout
and replaces them with prompt to run "ipfs id".  This allows user to
learn about public address obtained via relays or UPnP.

Second change is to replace list of listeners in multiaddr form with
simpler one, that deduplicates listeners and provides node operatior
with useful information about opened ports in 'host:port (tcp,udp)'
format, which is way more useful during debuging connectivity issues
related to port forwarding etc.
@lidel lidel mentioned this pull request Aug 8, 2024
32 tasks
@lidel lidel marked this pull request as ready for review August 8, 2024 21:04
@lidel lidel requested a review from a team as a code owner August 8, 2024 21:04
subjective, but looks better than ,
Copy link
Member Author

@lidel lidel left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No concerns raised so far, landing to master, and 0.30.0-rc1 next week for wider feedback.

@lidel lidel merged commit 0d42831 into master Aug 14, 2024
14 checks passed
@lidel lidel deleted the feat/improved-daemon-stdout-ux branch August 14, 2024 14:42
@SgtPooki
Copy link
Member

@lidel with these changes, how do users get listening multiaddrs for the kubo node? should we print out a "get listening multiaddrs with" line?

@lidel
Copy link
Member Author

lidel commented Aug 14, 2024

Good question. I'd say user can inspect config? Daemon should print useful information, and not all defined listeners will work.

This PR prints Run 'ipfs id' to inspect announced and discovered multiaddrs of this node.

Felt like a good compromise, but if it is not enough, free to improve this line in a new PR:

fmt.Printf("Run 'ipfs id' to inspect announced and discovered multiaddrs of this node.\n")

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants