Running IPFS on Google Compute Engine instance

Hi!

I’m trying to run IPFS on a Google Compute Engine Instance. I already installed the linux prebuilt package but, when I first started the daemon I was not able to access the gateway but I fixed it by opening the 5001 tcp and udp ports but it don’t connect to any node.

I tried by opening the following ports I found in another thread IPFS ports firewall

TCP 4001 5001 8080 8081
UDP 4002/udp

I’m also seeing that the fields Peer ID, Location, Agent Version, Protocol Version, Public Key are empty in the webui

I’m working on a small project and I’m trying to make it visible for a small presentation and it will be great if I can run it on a VM to make the public interact with it

could you precise OS version and ipfs version

could try to run ipfs init

regards

I’m running IPFS 0.4.13 over Ubuntu 16.04

This is the full uname -a output

Linux instance-1 4.10.0-38-generic #42~16.04.1-Ubuntu SMP Tue Oct 10 16:32:20 UTC 2017 x86_64 x86_64 x86_64 GNU/Linux

could you see your ipfs config ? ipfs config show

This is my config

{
  "API": {
    "HTTPHeaders": null
  },
  "Addresses": {
    "API": "/ip4/0.0.0.0/tcp/5001",
    "Announce": [],
    "Gateway": "/ip4/0.0.0.0/tcp/8080",
    "NoAnnounce": [],
    "Swarm": [
      "/ip4/0.0.0.0/tcp/4001",
      "/ip6/::/tcp/4001"
    ]
  },
  "Bootstrap": [
    "/dnsaddr/bootstrap.libp2p.io/ipfs/QmNnooDu7bfjPFoTZYxMNLWUQJyrVwtbZg5gBMjTezGAJN",
    "/dnsaddr/bootstrap.libp2p.io/ipfs/QmQCU2EcMqAqQPR2i9bChDtGNJchTbq5TbXJJ16u19uLTa",
  "Reprovider": {
    "/dnsaddr/bootstrap.libp2p.io/ipfs/QmbLHAnMoJPWSCR5Zhtx6BHJX9KiKNN6tpvbUcqanj75Nb",
    "/dnsaddr/bootstrap.libp2p.io/ipfs/QmcZf59bWwK5XFi76CZX8cbJ4BhTzzA3gU1ZjYZcYW3dwt",
    "/ip4/104.131.131.82/tcp/4001/ipfs/QmaCpDMGvV2BGHeYERUEnRQAwe3N8SzbUtfsmvsqQLuvuJ",
    "/ip4/104.236.179.241/tcp/4001/ipfs/QmSoLPppuBtQSGwKDZT2M73ULpjvfd3aZ6ha4oFGL1KrGM",
    "/ip4/128.199.219.111/tcp/4001/ipfs/QmSoLSafTMBsPKadTEgaXctDQVcqN88CNLHXMkTNwMKPnu",
    "/ip4/104.236.76.40/tcp/4001/ipfs/QmSoLV4Bbm51jM9C4gDYZQ9Cy3U6aXMJDAbzgu2fzaDs64",
    "/ip4/178.62.158.247/tcp/4001/ipfs/QmSoLer265NRgSp2LA3dPaeykiS1J6DifTC88f5uVQKNAd",
    "/ip6/2604:a880:1:20::203:d001/tcp/4001/ipfs/QmSoLPppuBtQSGwKDZT2M73ULpjvfd3aZ6ha4oFGL1KrGM",
    "/ip6/2400:6180:0:d0::151:6001/tcp/4001/ipfs/QmSoLSafTMBsPKadTEgaXctDQVcqN88CNLHXMkTNwMKPnu",
    "/ip6/2604:a880:800:10::4a:5001/tcp/4001/ipfs/QmSoLV4Bbm51jM9C4gDYZQ9Cy3U6aXMJDAbzgu2fzaDs64",
    "/ip6/2a03:b0c0:0:1010::23:1001/tcp/4001/ipfs/QmSoLer265NRgSp2LA3dPaeykiS1J6DifTC88f5uVQKNAd"
  ],
  "Datastore": {
    "BloomFilterSize": 0,
    "GCPeriod": "1h",
    "HashOnRead": false,
    "Spec": {
      "mounts": [
        {
          "child": {
            "path": "blocks",
            "shardFunc": "/repo/flatfs/shard/v1/next-to-last/2",
            "sync": true,
            "type": "flatfs"
          },
          "mountpoint": "/blocks",
          "prefix": "flatfs.datastore",
          "type": "measure"
        },
        {
          "child": {
            "compression": "none",
            "path": "datastore",
            "type": "levelds"
          },
          "mountpoint": "/",
          "prefix": "leveldb.datastore",
          "type": "measure"
        }
      ],
      "type": "mount"
    },
    "StorageGCWatermark": 90,
    "StorageMax": "10GB"
  },
  "Discovery": {
    "MDNS": {
      "Enabled": true,
      "Interval": 10
    }
  },
  "Experimental": {
    "FilestoreEnabled": false,
    "Libp2pStreamMounting": false,
    "ShardingEnabled": false
  },
  "Gateway": {
    "HTTPHeaders": {
      "Access-Control-Allow-Headers": [
        "X-Requested-With",
        "Range"
      ],
      "Access-Control-Allow-Methods": [
        "GET"
      ],
      "Access-Control-Allow-Origin": [
        "*"
      ]
    },
    "PathPrefixes": [],
    "RootRedirect": "",
    "Writable": false
  },
  "Identity": {
    "PeerID": "QmYYSD3GP88wwMo9MTjM3vze8KR5p4AJfGVkSfUgCQZGqs"
  },
  "Ipns": {
    "RecordLifetime": "",
    "RepublishPeriod": "",
    "ResolveCacheSize": 128
  },
  "Mounts": {
    "FuseAllowOther": false,
    "IPFS": "/ipfs",
    "IPNS": "/ipns"
  },
  "Reprovider": {
    "Interval": "12h",
    "Strategy": "all"
  },
  "Swarm": {
    "AddrFilters": null,
    "ConnMgr": {
      "GracePeriod": "20s",
      "HighWater": 900,
      "LowWater": 600,
      "Type": "basic"
    },
    "DisableBandwidthMetrics": false,
    "DisableNatPortMap": false,
    "DisableRelay": false,
    "EnableRelayHop": false
  }
}

do you check firewall on GCE : https://stackoverflow.com/a/21068402/3063005

I opened all ports (incoming and outgoing) on the instance but it can’t connect

in your navigator javascript console do you have javascript error ?

yes, I opened inspector and it is showing this error on file ipfs-webui.0.3.0.js:12:31024

SyntaxError: JSON.parse: unexpected non-whitespace character after JSON data at line 1 column 5 of the JSON data
Stack trace:
r/<@http://104.196.10.137:5001/ipfs/QmPhnvn747LqwPYMJmQVorMaGbMSgA7mRRoyyZYz3DoZRQ/ipfs-webui.0.3.0.js:14:30570
n@http://104.196.10.137:5001/ipfs/QmPhnvn747LqwPYMJmQVorMaGbMSgA7mRRoyyZYz3DoZRQ/ipfs-webui.0.3.0.js:2:23902
r/<@http://104.196.10.137:5001/ipfs/QmPhnvn747LqwPYMJmQVorMaGbMSgA7mRRoyyZYz3DoZRQ/ipfs-webui.0.3.0.js:17:30820
n.prototype.emit@http://104.196.10.137:5001/ipfs/QmPhnvn747LqwPYMJmQVorMaGbMSgA7mRRoyyZYz3DoZRQ/ipfs-webui.0.3.0.js:2:366
E@http://104.196.10.137:5001/ipfs/QmPhnvn747LqwPYMJmQVorMaGbMSgA7mRRoyyZYz3DoZRQ/ipfs-webui.0.3.0.js:55:24024
y@http://104.196.10.137:5001/ipfs/QmPhnvn747LqwPYMJmQVorMaGbMSgA7mRRoyyZYz3DoZRQ/ipfs-webui.0.3.0.js:55:23115
n/<@http://104.196.10.137:5001/ipfs/QmPhnvn747LqwPYMJmQVorMaGbMSgA7mRRoyyZYz3DoZRQ/ipfs-webui.0.3.0.js:2:7836
u.prototype.run@http://104.196.10.137:5001/ipfs/QmPhnvn747LqwPYMJmQVorMaGbMSgA7mRRoyyZYz3DoZRQ/ipfs-webui.0.3.0.js:1:26073
s@http://104.196.10.137:5001/ipfs/QmPhnvn747LqwPYMJmQVorMaGbMSgA7mRRoyyZYz3DoZRQ/ipfs-webui.0.3.0.js:1:25581

intresting maybe you can poste this issue on github

Issue here:

However, this doesn’t look like a bug. It looks like a CORS issue. Solution here:


Standard warning: Whatever you do, please do not leave the API exposed on the public internet.

1 Like

Hi, I am trying to upload a file to the IPFS node which is running in GCP, CentOS 7 (using js-ipfs).

this.ipfsApi = ipfsAPI(‘localhost’, ‘5001’) - works fine
but
this.ipfsApi = ipfsAPI(‘GCP Instance’s IP’, ‘5001’) - does not work and it says connection refused. I have allowed all ports actually, but still no luck reaching out to this.

I want to upload the files from my client to the remote node, without using the local node. Any help would be greatly appreciated.

Thanks in advance.