Hosting zero and alpha on different servers

I am trying to host Dgraph on heroku, and since ports are dynamically allocated in heroku, I have created two separate dynos for zero and alpha.

and this is my zero server

FROM dgraph/dgraph:latest
CMD ["sh","-c","dgraph zero --my=0.0.0.0:$PORT"]

this is my alpha server

FROM dgraph/dgraph:latest
CMD ["sh","-c","dgraph alpha --my=0.0.0.0:$PORT --zero=https://sampleurl.herokuapp.com:27955"]

But I keep getting this error

16 pool.go:311] CONN: Unable to connect with https://sampleurl.herokuapp.com:27955 : rpc error: code = Unavailable desc = connection error: desc = "transport: Error while dialing dial tcp: address https://sampleurl.herokuapp.com:27955: too many colons in address"

What am I supposed to do with the “too many colons in address part”?

You have the scheme https:// in the zero address flag for the alpha. It is a gRPC address and expects only host:port.

I think you may need to revisit your --my flags as well. This should be the address that other nodes can find you at, not 0.0.0.0.

1 Like

I know this is not really a dgraph related question, but is there any easy way to deply dgraph on heroku?

Using some context clues here (I have never played with heroku) but you could run a non-production quality system with the dgraph/standalone image with a single external port and everything else is done on 127.0.0.1 (communication between zero and alpha that is). I do not know your use case but that would probably not be appropriate for most use cases.

A quick google shows some internal routing examples on heroku, they may have some sort of service discovery system you can use. Like in kubernetes, you can use the DNS name of the service and it will automatically update that when a pod changes and gets a new IP.

Good luck.

1 Like

Thank You!, will check it out