dockerherokudockerfiledgraph

Multiple $PORT on Heroku Docker deployment


The current deployment Dockerfile contains this

CMD ["sh","-c","dgraph zero --my=0.0.0.0:5080 & dgraph alpha --my=0.0.0.0:7080 --zero=0.0.0.0:5080"]

However since Heroku dynamically allocates ports, they recommend the $PORT variable. But when substituted, all the ports get the same number.

Is there anyway to have more than one $PORT?


Solution

  • It is not possible: every Web Dyno exposes only one port which is provided at runtime with the $PORT env variable.

    You can deploy each component into its own Dyno (they will then communicate over HTTPS).

    Or you could look at Heroku Private Spaces which is an enterprise feature.