Unable to connect to connect to VM on GCE

These are the steps I am taking to create an alpha and zero node

  1. Create an instance named dg
  2. Go to the VPC network tab and set the IP of the dg vm from Ephemeral to Static
  3. Open the cloud shell by clicking SSH
  4. $ curl https://get.dgraph.io -sSf | bash -s – --version=‘v1.2.3’
  5. $ dgraph zero --my=dg:5080
  6. Open another shell
  7. $ dgraph alpha --lru_mb=8096 --my=dg:7080 --zero=dg:5080

Everything seems to be working except when I visit the external IP at port 8080, I cannot connect. What am I missing?

There is nothing at 8080. Should have just a text saying that Dgraph is running. If you can’t see it, check your firewall or proxy/reverseProxy.

I have HTTP and HTTPS traffic enabled. Shouldn’t I be able to ssh into the vm, run an alpha node, and then be able to visit the ip:8080?

Yes, this feels like something out of Dgraph’s scope. Hard to tell what it is. @joaquin what do you think? there is some extra config to permit 8080 port to be exposed on GCE? Maybe is similar to AWS.

First, before getting into external firewall rules, see if on the system you can curl localhost, just to make sure the service is working:

curl http://localhost:8080/health
curl http://localhost:8080/state

Now for the firewall rules, GCE only allows by default port 22, unless check boxed HTTP/HTTPS, then explicitly only the ports 80 and 443 are open as well. For all other ports you have to add a new firewall rule to the VPC. Google uses a tags to apply the firewall rules set for your VPC for a particular GCE instance.

Thus, if you created a firewall rule (ingress of 8080) that applies to tag of dgraph-http for example, you would then take the network interface of that GCE instance for public IP and add the tag dgraph-http. After google will retroactively apply that rule to the GCE.

Some documentation links:

1 Like