Unable to use separate pbf file when using base image and docker compose

I’ve used docker run with the base image and a mounted .pbf file to successfully use the route service.

I’ve then tried to incorporate the service into my own docker compose script, but it reverts to the sample .pbf.

What have I done wrong?

This is the relevant part of my docker compose file:

ors-app:
    container_name: ors-app
    ports:
      - "8080:8080"
      - "9001:9001"
    image: openrouteservice/openrouteservice:latest
    user: "${UID:-0}:${GID:-0}"
    volumes:
      - ./ors/graphs:/home/ors/ors-core/data/graphs
      - ./ors/elevation_cache:/home/ors/ors-core/data/elevation_cache
      - ./ors/logs/ors:/home/ors/ors-core/logs/ors
      - ./ors/logs/tomcat:/home/ors/tomcat/logs
      - ./ors/conf:/home/ors/ors-conf
      - ./ors/britain-and-ireland-latest.osm.pbf:/home/ors/ors-core/data/osm_file.pbf
    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 -Xms4g -Xmx8g"
      - "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’ve changed the path on where the host side of the mappings sit, but this worked fine with docker run.

Any help gratefully received.

Hey,

you could either try setting BUILD_GRAPHS=True in the environment options or try deleting the contents of the graph folder.
Both should trigger a rebuild of the graphs, thus taking into account your changed pbf file. Note that this’ll take some time building.

Best regards

Hi Jakob,

Thanks very much for the reply.

I just tried simplifying down my test case to try to see what is going on. I took the base docker compose and just removed the build instructions:

version: '2.4'
services:
  ors-app2:
    container_name: ors-app2
    ports:
      - "8082:8080"
      - "9002:9001"
    image: openrouteservice/openrouteservice:latest
    user: "${UID:-0}:${GID:-0}"
    volumes:
      - ./graphs:/home/ors/ors-core/data/graphs
      - ./elevation_cache:/home/ors/ors-core/data/elevation_cache
      - ./logs/ors:/home/ors/ors-core/logs/ors
      - ./logs/tomcat:/home/ors/tomcat/logs
      - ./conf:/home/ors/ors-conf
      - ./cyprus-latest.osm.pbf:/home/ors/ors-core/data/osm_file.pbf
    environment:
      - BUILD_GRAPHS=True  # Forces the container to rebuild the graphs, e.g. when PBF is changed
      - "JAVA_OPTS.......

What is interesting is that this ignores my pbf file, and does not populate any of the mapped folders (graphs, conf etc. are empty). Are the mappings here in the compose file incorrect?

Also happy to be told I’m doing something stupid.

Regards,
Andrew

I’ve dug in a bit further and it seems that there is a disparity between the compose file and the docker run instructions.

Using the following docker compose (which strips out the /home/ors mappings), it picks up my .pbf file correctly as the ors folders used by the image are in the root folder:

version: '2.4'
services:
  ors-app2:
    container_name: ors-app2
    ports:
      - "8082:8080"
      - "9002:9001"
    image: openrouteservice/openrouteservice:latest
    user: "${UID:-0}:${GID:-0}"
    volumes:
      - ./graphs:/ors-core/data/graphs
      - ./elevation_cache:/ors-core/data/elevation_cache
      - ./logs/ors:/ors-core/logs/ors
      - ./conf:/ors-conf
      - ./cyprus-latest.osm.pbf:/ors-core/data/osm_file.pbf
    environment:
      - BUILD_GRAPHS=True  # Forces the container to rebuild the graphs, e.g. when PBF is changed
      - "JAVA_OPTS=......

@Andres_Mansini
We are tracking this problem here. Stay tuned.

Best regards