Add ability to change DGraph URL in tour.dgraph.io

Moved from GitHub tutorial/52

Posted by MichelDiz:

New users can stumble into this impasse. When the user does not have Hyper-V or there is a need to install Docker on another machine or even on a virtual machine. There is no way for the user to practice Dgraph through the Tour. Because Dgraph points to Localhost. Dgraph installed on a virtual machine will come with an IP of the virtual machine and not the host IP.

It would be necessary to be able to change the address that the Tour triggers the queries, mutations and alters.

Anonymous commented :

Hi,

I am using https://tour.dgraph.io/ for study the dgraph, but can’t run the codes.
I am just stuck on https://tour.dgraph.io/moredata/1/, I am not able load the data on my local dgraph, so I can’t follow the futher steps.

so when this can be possible to run queries on your VM.

Thanks in advance.

peterstace commented :

@SumanSingh4 , if you’re using a VM, it’s still possible to complete the tour, but it will require some additional steps depending on the precise nature of your setup (possible forwarding ports between the VM and host etc). Feel free to post on discuss if you require further guidance.

MichelDiz commented :

A temporary solution for this, for those who need it. The Dgraph staff has released a UI binary called Ratel. Just download the current version (1.0.1) and run only Ratel on the machine. That you are able to copy and paste the models used in the Tour. Pointing to the right private LAN/IP.

However, now that we have this solution applied in Ratel. I do not see any impasse in the same solution within the Tour natively.

MichelDiz commented :

@paulftw Do you think this should be done in the Tour model? Today I particularly believe that using Ratel satisfies my need when I opened this issue. But maybe other people want it. And still have the problem from the Headers.

paulftw commented :

I don’t insist my answer is right, but: nowadays it’s not that hard to find a machine to install dgraph and a browser on. If a user wants to run Dgraph elsewhere they are probably an advanced user and can sort out the localhost issue without our help.
(for example if they use a virtual machine they could open a web browser on that machine).

Tour is just an educational tool, not a swiss army knife to access all possible dgraph installations.

Maybe an easier way for us to support exotic scenarios is to have a separate switch to show curl commands of doing the tour steps. Users would adjust those to their needs.

There’s a fix for the headers bug waiting to be pushed to prod.

manishrjain commented :

I think we should have a way by which we can allow users to set a URL. If one is running Docker on Windows, that runs within a VM. To access it, one needs to pass an IP address (of the VM), and Dgraph won’t be accessible on localhost.

MichelDiz commented :

Looking at the code by the way, I believe by putting the URL in runnable.js as variable (let) with a func to set and reset the URL. And then in runnable.html put a simple textbox (and btn to set) in the field

           <span class = "pane-title">
             Endpoint: {{$ endpoint}}
           </ span>

It would solve the thing. It does not have to be anything elaborate.

I could work on this, but I found it almost impossible for Hugo Theme to work on Windows (that’s what I have today).