I’ve got an ipfs-cluster-service 1.0.6 running on a VPS. I would like to run commands on it using ipfs-cluster-ctl 1.0.6 via libp2p. However, when I try, I get an error.
ipfs-cluster-ctl --force-http --debug --host '/ip4/38.242.216.6/tcp/9096/ipfs/QmZSZJeo3o3q2q3M5VTtH6UrgWEodYLmhRwpaoU8uQzbrM' --basic-auth 'redacted:redacted' --secret 3acade7f761c91f5fe3d34c4f4d15a17f817bc3463ab4395958f302b222a023b status
2023-07-10T14:42:54.786-0800 DEBUG cluster-ctl ipfs-cluster-ctl/main.go:153 debug level enabled
2023-07-10T14:42:54.792-0800 DEBUG apiclient client/lbclient.go:81 retrying 1 times
2023-07-10T14:42:54.792-0800 DEBUG apiclient client/request.go:63 GET: libp2p://QmZSZJeo3o3q2q3M5VTtH6UrgWEodYLmhRwpaoU8uQzbrM/pins?local=false&filter=&cids=
2023-07-10T14:42:55.850-0800 ERROR apiclient client/lbclient.go:104 reached maximum number of retries without success, retries: 1
An error occurred:
Code: 0
Message: Get "libp2p://QmZSZJeo3o3q2q3M5VTtH6UrgWEodYLmhRwpaoU8uQzbrM/pins?local=false&filter=&cids=": protocols not supported: [/libp2p-http]
The error brings up more questions than answers. It says protocol not supported, but which process is it talking about? Is it ipfs-cluster-service or ipfs-cluster-ctl that is not supporting the protocol?
Why is the protocol not supported? I am following the IPFS Cluster documentation which suggests I can connect to ipfs-cluster-service restapi using libp2p.
I’ve been searching for answers and found some git issues and PRs which mention the feature of being able to use libp2p.
I must be missing something. I’ll keep poking at this. If anybody has any ideas I’d love to hear them. Thank you!
Based on the documentation, I’m suspecting that libp2p is not listening by default for crdt clusters, which is what I’m doing.
The REST API component automatically, and additionally, can expose the HTTP API as a libp2p service on the main libp2p cluster Host (which listens on port 9096) (this happens by default on Raft clusters)
I got it working by defining api.restapi.libp2p_listen_multiaddress, api.restapi.id, and api.restapi.private_key in the cluster config. Also instead of --force-http I used --https.
CRDT clusters with “followers” could share the cluster-secret publicly and this would give access to the libp2p API endpoint if it was enabled by default on the main libp2p-host.
Thus it is necessary to define a separate host.
Regarding ipfs-cluster-ctl usage, you can ipfs-cluster-ctl --host /ip4/<ip>/tcp/<port>/p2p/<api_peer_id> and it should use libp2p-http tunnel. If you are using --force-http changes are that you are talking to the normal http endpoint.