Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How do we connect to a private remote substrate node? #3

Closed
justintim-es opened this issue Apr 7, 2020 · 9 comments
Closed

How do we connect to a private remote substrate node? #3

justintim-es opened this issue Apr 7, 2020 · 9 comments

Comments

@justintim-es
Copy link

Dear substrate,
when I try to connect to my remote node on google cloud. using the telemetry-url ws://telemetry.polkadot.io:1024
Polkadot says "You are not connected to a node. Ensure that your node is running and that the Websocket endpoint is reachable."
How do i set up a secure/insecure websocket endpoint on substrate?
And when i try to connect to the following endpoint
"/ip4/35.223.179.7/tcp/30333/p2p/QmVNEAoh4TFLX2
cNEGogv3Gy8vBHw5ATU7biZYpsdwA14t"
polkadot says the same

I've read the following:
https://wiki.polkadot.network/docs/en/maintain-wss

when i try to setup the nginx server and the server asks me for a domain name: I enter "http://nachtstein.nl""
i get the following error:

An unexpected error occurred:
Error creating new order :: Cannot issue for "\"http": Domain name contains an invalid character

Does anyone know a good tutorial?

@justintim-es justintim-es changed the title How do I connect to a remote node? How do We connect to a remote node? Apr 7, 2020
@justintim-es justintim-es changed the title How do We connect to a remote node? How do we connect to a remote node? Apr 7, 2020
@justintim-es justintim-es changed the title How do we connect to a remote node? How do we connect to a private remote substrate node? Apr 7, 2020
@bkchr bkchr transferred this issue from paritytech/substrate Apr 7, 2020
@JoshOrndorff
Copy link

JoshOrndorff commented Apr 7, 2020

Hello @noahsalvadordenjo

I understand that you are trying to run a Substrate node on google cloud and connect the Polkadot JS Apps UI to it. There are a few ways to do this. I'll describe the easiest technique first, then a more robust technique. I'll also observe that getting the UI to connect is unrelated to telemetry.

Using an Insecure Websocket (ws)

When you run your node in google cloud you need to give it the --ws-external flag which opens up your websocket endpoint to receive traffic from the public internet. So your run command might look something like this.

# Run a dev node
./target/release/substrate --dev --ws-external

# Or in general
./path/to/substrate <your preferred flags> --ws-external

Now that your web socket is open to the public, you can open your web browser. (Firefox will not work for this purpose because it will not allow an https site to connect to a ws websocket, work around this for now by using a different browser). You can navigate to https://polkadot.js.org/apps/#/settings. Enable the custom endpoint slider, and then enter your url as
ws://<your gcloud ip addr>:9944. Of course you need to make sure that port 9944 is actually open in your cloud server's firewall.

At this point you should be good to go. If you want to use firefox with the insecure websocket, you will need to host the Apps UI locally. Instructions for that are in its github repo. Firefox also works with the wss method (read on).

Using a Secure Websocket (wss)

If you are using this node for more than just playing around and learning, you'll eventually want a proper wss endpoint. To get one, you can use nginx on your server to act as a reverse proxy. You can reference the official docs and my notes for tips on setting this up and an example configuration file.

When using a secure websocket, you no longer need --ws-external and you can use any browser including firefox.

@justintim-es
Copy link
Author

justintim-es commented Apr 7, 2020

Thanks a lot,
if i run the node

./target/release/node-template   --base-path /tmp/alice   --chain local   --alice   --po
rt 30333   --ws-port 9944   --rpc-port 9933   --telemetry-url 'ws://telemetry.polkadot.io:1024 0'  --ws-external

and connect polkadot with my external ip wss://35.223.179.7:9944 i still have the following error:
You are not connected to a node. Ensure that your node is running and that the Websocket endpoint is reachable.
I know that with ethereum I had to specify my internal ip with --rpcaddr. How do I specify my internal ip?

@JoshOrndorff
Copy link

The problem is that you specified the wrong endpoint. You wrote wss://35.223.179.7:9944. But it should be ws://35.223.179.7:9944. Unless you setup nginx like I described (or do something analogous) you are using an insecure ws endpoint.

@justintim-es
Copy link
Author

I've enabled my firewall port to allow al incoming traffic and i still have the following error
You are not connected to a node. Ensure that your node is running and that the Websocket endpoint is reachable.
You are connecting from a secure location to an insecure WebSocket (ws://35.223.179.7:9944). Due to browser mixed-content security policies this connection type is not allowed. Change the RPC service to a secure 'wss' endpoint.

@JoshOrndorff
Copy link

Are you using firefox?

(Firefox will not work for this purpose because it will not allow an https site to connect to a ws websocket, work around this for now by using a different browser)

@justintim-es
Copy link
Author

chrome

@justintim-es
Copy link
Author

Is it possible to change

Prometheus server started at 127.0.0.1:9615

to use my internal ip?

@JoshOrndorff
Copy link

I haven't seen that issue on chrome. It's possible that they have updated to the same policy as firefox. In that case you have two options.

  1. Setup the reverse proxy so your node has a wss endpoint.
  2. Host the UI locally ([instructions[(https://github.com/polkadot-js/apps#development))

@justintim-es
Copy link
Author

Used the polkadot api locally and got the genesis hash!
Thanks a lot!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants