filecoin-project / dealbot

🤖🤝 A bot for making deals
Apache License 2.0
32 stars 10 forks source link

When start dealbot daemon, the `--endpoint` flag get error "unknown url scheme". #362

Closed kuchaguangjie closed 2 years ago

kuchaguangjie commented 2 years ago

Hi,

When start dealbot daemon via: dealbot daemon -l localhost:0 -d /mnt/mars/data/dealbot/daemon/data/ -n /mnt/mars/data/dealbot/daemon/data/ --endpoint https://127.0.0.1:8764

Get error:

2022-02-08T19:22:13.563+0800    INFO    controller  client/client.go:40 dealbot controller client initialized   {"addr": "https://127.0.0.1:8764"}
2022-02-08T19:22:13.563+0800    WARN    cliutil util/apiinfo.go:81  API Token not set and requested, capabilities might be limited.
2022-02-08T19:22:13.563+0800    FATAL   dealbot dealbot/main.go:94  unknown url scheme ''

So, what is the correct format for --endpoint flag? Isn't it the --listen flag of dealbot controller? Thanks.

willscott commented 2 years ago

that looks like it's working for the controller, and matches what our helm setup is: https://github.com/filecoin-project/helm-charts/blob/master/charts/dealbot/templates/deployment.yaml#L229-L230

perhaps the error is about a different flag that is missing?

willscott commented 2 years ago

in particular, you haven't provided the info for how the dealbot daemon should talk to a running lotus node to make storage or retrieval deals as tasked by the controller

kuchaguangjie commented 2 years ago

USAGE:
   dealbot daemon [command options] [arguments...]

OPTIONS:
   --data-dir value, -d value       writable directory used to transfer data to node [$DEALBOT_DATA_DIRECTORY]
   --node-data-dir value, -n value  data-dir from relative to node's location [data-dir] [$DEALBOT_NODE_DATA_DIRECTORY]
   --wallet value, -w value         deal client wallet address on node [$DEALBOT_WALLET_ADDRESS]
   --endpoint value, -e value       HTTP endpoint of the controller [$DEALBOT_CONTROLLER_ENDPOINT]
   --id value                       set bot worker id [$DEALBOT_ID]
   --listen value, -l value         host:port to bind http server on [$DEALBOT_LISTEN]
   --stage-timeout value            stagename=duration (example: DealAccepted=15m), DefaultRetrieval and DefaultStorage set defaults [$STAGE_TIMEOUT]
   --tags value                     comma separated tag strings [$DEALBOT_TAGS]
   --workers value                  number of concurrent task workers (default: 1) [$DEALBOT_WORKERS]
   --minfil value                   min amount of fil needed (in attofil) in wallet for tasks to be popped by daemon [$DEALBOT_MIN_FIL]
   --mincap value                   min amount of datacap needed (in bytes) in wallet for tasks to be popped by daemon [$DEALBOT_MIN_CAP]
   --posthook value                 bash script to run when a deal finishes [$DEALBOT_POST_HOOK]
   --datapointlog value             file / stream to write out a json line for each task as it updates [$DEALBOT_DATAPOINT_LOG]
   --help, -h                       show help (default: false)

Above are all the flags, @willscott do you know which flag(s) I'm missing, thanks.

willscott commented 2 years ago

this is going to be rough around the edges. i'm afraid you're going to need to look at the code.

https://github.com/filecoin-project/dealbot/blob/397685ab4d1d3bea41c1b1ab20911187f3a6bffd/lotus/lotus.go#L109

i think it tries to find a lotus running token in home directory by default, but there is a way to specify an api to use instead for retrieval-only mode.

kuchaguangjie commented 2 years ago

You mean it require the api flag, but dealbot daemon command doesn't support that flag? Or something else ? I'm a bit confused, is there a working command example using command line flags to start daemon, thanks.

willscott commented 2 years ago

i believe we have used it in configurations with that flag set via env var, or where the flag is not needed because it learns it from the lotus state in the home directory, but have not run it in a configuration where it is passed on the command line

kuchaguangjie commented 2 years ago

Do you know what's the env name for api flag? And is its value something like this: "token:/ip4/127.0.0.1/tcp/1234/http" ?

willscott commented 2 years ago

https://github.com/filecoin-project/dealbot/blob/397685ab4d1d3bea41c1b1ab20911187f3a6bffd/main.go#L39-L41

kuchaguangjie commented 2 years ago

After specify api, it worked, thanks.

kuchaguangjie commented 2 years ago

But, after dealbot daemon start, when I executed lotus wallet list, got error:

ERROR: missing permission to invoke 'WalletList' (need 'write')

Do you know what might be the cause? (I'm using local devnet), thanks.

willscott commented 2 years ago

if you can't execute lotus wallet list on your local lotus node you aren't passing auth token to the daemon appropriately

kuchaguangjie commented 2 years ago

@willscott Thanks, but I didn't specify any token when start lotus. lotus wallet list works before I start dealbot daemon. Anyway, let me do more test.

kuchaguangjie commented 2 years ago

I've managed to add token together with api, now lotus wallet list works, thanks.