Trying to access api server on a google compute engine, failed to connect

I am trying to access a remote google compute engine where I have the ipfs daemon running, but I get port 5001 connection refused. I have stumbled around setting firewall rules on the server and on my laptop, but without success.

I would appreciate any help.

Here is my last attempt:

C:\Users\joe>gcloud compute firewall-rules list

NAME NETWORK DIRECTION PRIORITY ALLOW DENY DISABLED default-allow-http default INGRESS 1000 tcp:80 False default-allow-https default INGRESS 1000 tcp:443 False default-allow-icmp default INGRESS 65534 icmp False default-allow-internal default INGRESS 65534 tcp:0-65535,udp:0-65535,icmp False default-allow-rdp default INGRESS 65534 tcp:3389 False default-allow-ssh default INGRESS 65534 tcp:22 False ipfs default INGRESS 1000 tcp:5001 False ipfs4001 default INGRESS 1000 tcp:4001 False ipfs4002 default INGRESS 1000 udp:4002 False ipfs8080 default INGRESS 1000 tcp:8080 False ipfs8081 default INGRESS 1000 tcp:8081 False

To show all fields of the firewall, please show in JSON format: --format=json
To show all fields in table format, please see the examples in --help.

C:\Users\joe>curl http://35.196.228.208:5001/api/v0/swarm/peers
curl: (7) Failed to connect to 35.196.228.208 port 5001: Connection refused

Quick quick answer: you might need to change the IPFS (I suppose go-ipfs) configuration, to listen for 0.0.0.0 instead of localhost or 127.0.0.1, but I strongly suggest to not expose those API to the public

1 Like

Thanks, you are correct.
I did this later last night and it worked.
I do not know if opening the ports as above was necessary or not.
I am not sure if I am going in the right direction. I am a newby to ipfs.
what I want to do eventually is to have a website in ipfs which collects form data from a client and writes it to ipfs in a “data” subdirectory accessible to the same website.

Dropping a hint: I think you can achieve that by using IPNS rather than a “sub-directory” from IPFS. :slight_smile:

1 Like

Thanks for the hint. I was considering that option. Using a separate key for data, where the data is a JSON file, containing the old entries from prior postings, as well as the data from the current posting. ipfs add, followed by ipfs publish. I think that is likely to work well.

Thanks