hypercore-protocol / cli

A CLI for peer-to-peer file sharing using the Hypercore Protocol.
MIT License
206 stars 17 forks source link

Daemon not detected when directly started from hyperspace #51

Open DieracDelta opened 3 years ago

DieracDelta commented 3 years ago

When I start hypercore with hyperspace --storage $STORAGE --host $HOST --port $PORT, then run:

❯ ps -aux | rg hyp
jrestivo 1067902  0.1  0.0 635796 54572 ?        SLsl 11:08   0:00 /nix/store/5kkjf5wvfvclqj76k9f69c95gw5mfbhc-nodejs-14.17.4/bin/node /nix/store/if04chi2qyhxr5mvifmq9wfhswydj3ms-hyperspace/bin/hyperspace --storage ~/.hyperspace --host hyperspace --port 0
jrestivo 1069029  0.0  0.0   9644  6232 pts/11   S+   11:11   0:00 rg hyp
flakes [$!+?]
❯ hyp info
The daemon is not active. Please run:

  hyp daemon start
❯ hyp daemon status
Hyperspace v3.19.0
Hyperspace API v1.15.1
Your address:  (Not Hole-punchable)

This is preventing me from using any of the hyp commands. Any advice? Both hyp info and hyp daemon start connect to the daemon, as it prints out:

Remote client opened
Remote client closed
pfrazee commented 3 years ago

If you're using a --host other than the default, you'll need to pass that param to hyp daemon status too

DieracDelta commented 3 years ago

I've added --host to both invocations. Same output:

❯ hyp --host hyperspace info
The daemon is not active. Please run:

  hyp daemon start
❯ hyp --host hyperspace daemon status
Hyperspace v3.19.0
Hyperspace API v1.15.1
Your address:  (Not Hole-punchable)
pfrazee commented 3 years ago

Ah, it looks like the hyp CLI isn't respecting this config: https://github.com/hypercore-protocol/cli/blob/master/lib/hyper/index.js#L16 and https://github.com/hypercore-protocol/cli/blob/master/lib/commands/daemon/status.js#L20 (and a few other spots)

We should either add a CLI flag or an env var. Any thoughts on which?

cc @andrewosh @mafintosh

DieracDelta commented 3 years ago

What would the CLI flag/env var be specifying? From a usability standpoint, either sounds fine on my end as a user.

EternalDeiwos commented 3 years ago

I tried making some local modifications to this for testing and I would also mention that the hyperspace-mirroring-service is also a daemon that needs to be running for the CLI to work. I've been trying for the last while to get that running in a Docker container and I can't make sense of it; its pretty ambiguous.