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:
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)
- 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"
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:
- Under Application Settings change ‘WEBSITES_ENABLE_APP_SERVICE_STORAGE’ to true.
- 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!