libp2p / js-libp2p-daemon

A js-libp2p backed daemon
Other
15 stars 11 forks source link

Daemon cli not working as expected #83

Open odesenfans opened 2 years ago

odesenfans commented 2 years ago

Hello,

I'm trying to install the latest version of the daemon to try it out, but I'm a bit perplexed by the install procedure. Could you add documentation to show how to start the daemon, and/or release the new version on npm?

achingbrain commented 2 years ago

Please see the changes in #91 - do these make it a bit clearer?

odesenfans commented 2 years ago

Hello @achingbrain, thanks for the update! I managed to install the latest version. However, the daemon does not seem to work.

npm i -g @libp2p/daemon@1.0.3
jsp2pd --help
# Returns to the prompt and prints nothing
jsp2pd
# Returns to the prompt as well

I'm trying this on a pretty standard install of Ubuntu 20.04 and nodejs v17.9.0.

PS: I did uninstall the previous version of the daemon, and running the daemon with DEBUG=* does not yield additional information.

odesenfans commented 2 years ago

I looked into it a bit more, I guess these lines explain why the daemon does not start.

export async function createLibp2pServer(listenAddr, argv) {
    // const libp2p = await createLibp2p(argv)
    // const daemon = await createServer(new Multiaddr(argv.listen), libp2p)
    throw new Error('Not implemented yet');
}
odesenfans commented 2 years ago

@wemeetagain this issue is not resolved, see my comments above. The doc explains how to install the daemon correctly, but the daemon does not work as expected once installed.

achingbrain commented 2 years ago

It was closed automatically by the linked PR

achingbrain commented 2 years ago

Good spot on the commented out code - the modules published by this mono-repo are only really used in testing interop between js-libp2p and go-libp2p - in those tests it's started programatically using the @libp2p/daemon-server module rather than via the command line @libp2p/daemon module.

Would you like to open a PR that fixes the CLI tool up for use outside of the libp2p interop suite?

It should be relatively straight forward - the createLibp2p function is exported by libp2p, you just need to figure out a way to convert argv to the options object that function expects, and createServer is exported by @libp2p/daemon-server.

odesenfans commented 2 years ago

I can give it a try over the weekend, sure!

p-shahi commented 2 years ago

@odesenfans Any update :) Are you still interested in doing this?

odesenfans commented 2 years ago

Hello, in the end I switched to writing my own network daemon with rust-libp2p.

achingbrain commented 2 years ago

That's interesting, is it available anywhere? I'd love to try to adapt it to run interop tests against in the same way we use this module and go-libp2p-daemon in js-libp2p.

odesenfans commented 2 years ago

Hi @achingbrain, you can find it here: https://github.com/aleph-im/p2p-service. The goal was not to be compatible with the protobuf protocol you defined for the daemon, so you won't be able to use it as a stand-in replacement. We have several services in our system that are interested in subscribing to pubsub topics, so I went for a RabbitMQ interface for pubsub and a small HTTP server for stuff like dialing peers.

It's pretty basic at the moment but it does the job so far.