Azure container and ORS Docker

Hey guys

I am plooking to find a way to host ORS docker on azure container apps. So far i tried searching for some sort of documentation, but didn’t find any.

Hoping someone here could help me out, i am fairly new to ORS as well as hosting it on Docker. Any help would be appreciated!

Thanks !

I’ve been working on this exact same thing and I just figured it out!

There are a couple of steps you need to do to get this working.

Create a Dockerfile containing your pbf (mine is us-latest) and the ors-config file.

The Dockerfile will look similar to this:

FROM openrouteservice/openrouteservice:nightly

COPY ./us-latest.osm.pbf /home/ors/ors-core/data/osm_file.pbf

COPY ./ors-config.json /home/ors/ors-conf/ors-config.json

Once this image is built deploy it to the registry of your choice (docker hub is a good spot, Azure Container Registry is probably ‘better’ if you’re familiar with it).

Create an Azure App Service using ‘Docker Container’ and ‘Linux’.

Deployment options are as follows:

Container type: Docker Compose (Preview)
Registry Source: Docker Hub (or Azure if you did that)

Config:

version: '2.4'
services:
  ors-app:
    container_name: ors-app
    ports:
      - "8080:8080"
      - "9001:9001"
    image: yourRepository/yourCustomImage
    user: "${UID:-0}:${GID:-0}"
    volumes:
      - mapStorage:/home/ors/ors-core/data/graphs
    environment:
      - BUILD_GRAPHS=False  # Forces the container to rebuild the graphs, e.g. when PBF is changed
      - "JAVA_OPTS=-Djava.awt.headless=true -server -XX:TargetSurvivorRatio=75 -XX:SurvivorRatio=64 -XX:MaxTenuringThreshold=3 -XX:+UseG1GC -XX:+ScavengeBeforeFullGC -XX:ParallelGCThreads=4 -Xms50g -Xmx55g"
      - "CATALINA_OPTS=-Dcom.sun.management.jmxremote -Dcom.sun.management.jmxremote.port=9001 -Dcom.sun.management.jmxremote.rmi.port=9001 -Dcom.sun.management.jmxremote.authenticate=false -Dcom.sun.management.jmxremote.ssl=false -Djava.rmi.server.hostname=localhost"
      - ORS_CONFIG=/home/ors/ors-conf/ors-config.json

NOTE: I AM USING 50GB MEMORY ALLOCATION, ADJUST -Xms50g -Xmx55g TO YOUR NEEDS

Now that this is done you will need another portion to keep persistent storage (It takes me roughly 4-5 hours to build us-latest pbf, not acceptable if the container restarts…)

Create an Azure Storage Account with an Azure File share. My file share is named ‘mapStorage’ as indicated in the docker compose config. You will map your file share to /home/ors/ors-core/data/graphs in the docker config.

Then under ‘Configuration’ of the App Service you will need to enable 2 things:

  1. Under Application Settings change ‘WEBSITES_ENABLE_APP_SERVICE_STORAGE’ to true.
  2. Under ‘Path Mappings’ create the mapping to your Azure File storage (my running config below). Note, the mount path is the same as the one in the docker compose file.

After all this your container should restart and start building!

1 Like