-
Notifications
You must be signed in to change notification settings - Fork 481
docs: getting started #514
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
Conversation
8dc4726
to
570da2a
Compare
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.
@vasco-santos I created a PR to discuss some edits, #520. I think it might be easier to do it that way than individual comments across this PR for the larger changes. I only did the first bit of configuration so we can discuss the approach.
A few thoughts:
- I think reducing the amount of text for each section would be helpful. If we can succinctly describe each step and then link off to further reading, I think that might be easier for folks to consume.
- I think it would be good to have the final code of this in
./examples
. If anyone gets stuck, they can go reference the example code and we can more easily ensure this is running properly in future releases, as we test all examples. - While multiplexing is not required, we should have it in the basic setup. If it's not configured the node won't be able to speak to the main network. The majority of users will likely need multiplexing. For me, basic setup means I should be able to start talking with the main network, even if it's in a limited fashion.
👍
sounds good, I will change that once we get #520 here |
3a63a7f
to
1a72e46
Compare
I think I addressed all the feedback except for:
For that one in specific, I will create an issue to track all the remaining endeavours. I want to get all the examples being tested in CI, in order to ease the release process |
doc/GETTING_STARTED.md
Outdated
|
||
You can install `libp2p-mplex` and add it to your libp2p node as follows in the next example. You should revisit the [API](./API.md) document, more specifically [API#dial](./API.md#dial) and [API#handle](./API.md#handle). | ||
|
||
We will also install the next dependencies for easily work with [async iterable duplex streams](https://gist.github.com/alanshaw/591dc7dd54e4f99338a347ef568d6ee9). |
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.
We should point to the local README we have for this, as we'll also be including more examples of using iterable streams in libp2p https://github.com/libp2p/js-libp2p/blob/refactor/async-await/doc/STREAMING_ITERABLES.md
doc/GETTING_STARTED.md
Outdated
await node.stop() | ||
``` | ||
|
||
If you are not familiar with multiaddrs, you should read the [multiformats/js-multiaddr](https://github.com/multiformats/js-multiaddr) README. |
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 seems out of place, not sure where this should go.
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.
I think we can just remove it
doc/GETTING_STARTED.md
Outdated
npm install libp2p-kad-dht | ||
``` | ||
|
||
`js-libp2p` configuration is not well defined yet regarding content routing routing. Therefore, the `dht` should be plugged through a `modules.dht` property, while the `libp2p-delegated-content-routing` should be plugged into `modules.contentRouting` array. |
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.
Same here, it is defined, but the DHT does not yet conform to the separate configuration.
doc/GETTING_STARTED.md
Outdated
await node.start() | ||
|
||
// provide cid | ||
await libp2p.contentRouting.provide(cid) |
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.
Since we're aiming to have people join the live network we should probably not have them provide content, as their node is going to go offline pretty quickly. What do you think?
For findProviders we should just use a well known cid, and we should include the cid module here. A website or the ipfs readme might be good options.
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.
Good call!
doc/GETTING_STARTED.md
Outdated
|
||
const node = await Libp2p.create({ | ||
modules: { | ||
transport: [TCP], |
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.
Same thing here, why the switch to TCP?
* doc: initial review of getting started Co-Authored-By: Vasco Santos <[email protected]>
Co-Authored-By: Jacob Heun <[email protected]>
Co-Authored-By: Jacob Heun <[email protected]>
e437c0a
to
462d303
Compare
I went ahead and cleaned up some of the language. I also removed mdns, DHT and Pubsub setup from the guide for now. The problem with having these included is that the setup as it was, wasn't sufficient for these things to work properly. For example, you could start and run pubsub, but you wouldn't be publishing to anything. I think it's more valuable to get people running a node and connecting it to the public network, and then referencing the Configuration readme and examples folder for additional sources of configuration. The examples do a better job of ensuring each piece will yield results by doing things like running multiple nodes when necessary. I think we can add additional components to this in the future, but they should work without needing any additional configuration/resources. |
doc/API.md
Outdated
|
||
- `peer`: instance of [PeerInfo][https://github.com/libp2p/js-peer-info] | ||
|
||
#### We have a new connection to a peer |
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.
#### We have a new connection to a peer | |
#### An incoming connection from a peer has been established |
Is it only incoming or outgoing also?
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.
It is both.
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.
Gotcha, might be an idea just to be explicit that it is!
doc/GETTING_STARTED.md
Outdated
|
||
#### Transports | ||
|
||
Libp2p uses Transports to establish connections between peers over the network. You can configure any number of Transports, but you only need 1 to start with. Supporting more Transports will improve the ability of your node to speak to a larger number of nodes on the network. |
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.
Could we explain a little what a transport is?
Co-Authored-By: Alan Shaw <[email protected]>
* docs: getting started * docs: review getting started (#520) * doc: initial review of getting started Co-Authored-By: Vasco Santos <[email protected]> * chore: move multiplexing to basic setup * chore: add read more cta * chore: apply suggestions from code review Co-Authored-By: Jacob Heun <[email protected]> * chore: just configure multiplexer * chore: apply suggestions from code review Co-Authored-By: Jacob Heun <[email protected]> * chore: just use websockets and changed dht module introduction * chore: add reference for events in the API doc * docs: simplify getting started guide and clean up language * chore: apply suggestions from code review Co-Authored-By: Alan Shaw <[email protected]> * docs(fix): address review comments Co-authored-by: Jacob Heun <[email protected]> Co-authored-by: Alan Shaw <[email protected]>
This getting started doc aims to be the entry point for new users of
js-libp2p
since it goes deeper in detail within each concept.For more advanced users, we expect that they consult the API and CONFIG docs mostly, as they are more straightforward documents