gis-ops / docker-valhalla

This is our flexible Docker repository for the Valhalla routing engine
MIT License
233 stars 69 forks source link

Deploying the container to Heroku #67

Closed msiric closed 2 years ago

msiric commented 2 years ago

Hi,

How would I go about deploying this container to Heroku? I'd like to use the .pbf file for Andorra, build the tiles and deploy the container to Heroku so it's ready to serve requests.

How to issue the following command so that the container is built with the tiles as it's deployed to Heroku? docker run -dt --name valhalla_gis-ops -p 8002:8002 -v $PWD/custom_files:/custom_files -e tile_urls=https://download.geofabrik.de/europe/andorra-latest.osm.pbf gisops/valhalla:latest

Any advice is appreciated, thanks

nilsnolde commented 2 years ago

Command looks good, what do the logs say?

msiric commented 2 years ago

The problem is that I cannot specify the port when deploying to Heroku. Heroku assigns a random port after deployment. This means that I cannot expose port 8002 in the Dockerfile, but instead use process.env.PORT that will be provided by Heroku. How can I do this if I have no access to the internals of Valhalla?

nilsnolde commented 2 years ago

Just map another port to the docker host then. Docker internal port != host port, that’s what “-p” does (left side host, right side inside container). No idea about heroku, but it HAS TO give you the option to expose your desired port from the spun up instance. Not really an issue with this repo, try a heroku specific forum.