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.