Launch public circuit relays

I’m building a chat app using ipfs and orbitdb. I currently have a desktop app which works perfectly on local networks but as soon as the greater internet is involve, databases do not sync anymore. I think this can be resolved using circuit-relays and in the future the autoRelay feature, but I can’t find how to deploy my own circuit relay.

±----------------------------+               ±-----------------------------------+             ±---------------------------+
| Desktop app          |                | Public circuit relay      |               | Desktop app       |
| behind NAT            |    <==>    | on heroku or aws       |    <==>   | behind NAT        |
±----------------------------+               ±-----------------------------------+              ±----------------------------+

I followed the circuit-relaying tutorial, which works very well but is all run locally. But when deploying on an AWS instance for example I get a bunch of errors as the node being unreachable.

My ipfs config

const ipfsOptions = {
  //preload: { enabled: false },
  repo: "./ipfs",
  relay:{ enabled:true, hop: { enabled:true, active: true}},
  EXPERIMENTAL: { pubsub: true },
  config: {
    Bootstrap: [],
    Addresses: { Swarm: [
      "/dns4/secure-beyond-12878.herokuapp.com/tcp/80/ws/p2p-webrtc-star",
      "/dns4/wrtc-star1.par.dwebops.pub/tcp/443/wss/p2p-webrtc-star",
      "/dns4/blooming-springs-75345.herokuapp.com/tcp/443/wss/p2p-webrtc-star/"
    ],
    "API":"/ip4/127.0.0.1/tcp/5001",
    "Gateway": "/ip4/127.0.0.1/tcp/8080"
  },
  }
};

Once the ipfs node is running inside the app, I’m trying to connect to the circuit relay as such
await ipfsNode.swarm.connect("/ip4/127.0.0.1/tcp/4004/p2p/12D3KooWNMx9mV7hxqgVns5B2FSJBfv1UyqJFRHMyupC9Z9PDZ1h");

Anyone know what I’m doing wrong or if what I want to do can work?

You are trying to dial a node using a TCP address, when your node does not have a TCP transport.

Browser does not support TCP, so you will need to connect to a websockets address of the relay.

1 Like