Using volumes for openrouteservice

My goal is to be able to generate the openroute database on another machine and then copy the files to a version of openroute on another production machine, restart openroute and then magically it would have another region or a bigger region.
I do this so I do not have to bother the production machine with the initial generation of the graphs etc. and this can happen in the background.

To do this I created docker volumes for all the ors-core/data directories in this way:

      - graph-volume:/home/ors/ors-core/data/graphs
      - elevation-volume:/home/ors/ors-core/data/elevation_cache
      - ors-logs-volume:/home/ors/ors-core/logs/ors
      - tomcat-logs-volume:/home/ors/tomcat/logs
      - ors-config-volume:/home/ors/ors-conf
      - ./denmark-latest.osm.pbf:/home/ors/ors-core/data/osm_file.pbf
      - osm-file-volume:/home/ors/ors-core/data
      - BUILD_GRAPHS=True  # 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 -Xms5g -Xmx10g"
      - " -Djava.rmi.server.hostname=localhost"

    external: true
    external: true
    external: true
    external: true
    external: true
    external: true

And I can use docker cp to move the files from the generation machine to the production machine.

But when I restart openroute, it still is using the old database even if I deleted it. So I assume the restart is using data from somewhere else!

Is this a correct way of doing this or does someone have a better idea of doing this.

Some minor problems here but the strategy was right.
The docker compose on the generation machine created the volumes correctly
I copied files in the volumes to storage and moved them to the production machine.
The copied them into the volume, using docker cp
The I deleted the ors-app container on the production machine
Then restarted the production container with:
docker run -d --name ors-app -p 8080:8080 -mount source=graph-volume, target=/ors/ors-core/data/graph -mount source=elevation-volume, target=/ors/ors-core/data/elevation_cache openrouteservice/openrouteservice:latest

In the container log it looks like it is using the heidelberg version, but it is really using the version in the volume.

Most like I need to do the same thing for the ors-config.yml file if I have more than one service (e.g. car and walking)

there have been a lot of changes over the last few weeks relating to docker setup and configuration files, so there are a few places where a mismatch in settings between versions could cause problems. One of the first things would be to make sure that if you are using the latest image, you actually are using the same on both machines. When you are transferring graphs etc, it is often better to use a specified version for the docker image so you can be sure that this is the case.

Secondly, I believe that the path for the graphs folder in the second instance should be /home/ors/ors-core/graphs though I could be wrong on that - but might be worth checking inside the container if there are things in that folder, and if so, that’s where you should be mapping the graphs folder to.

Finally, it’s generally a good idea to make sure that the config file being used on both instances is the same.

@MatsGej Thanks for following up on this. Please share your complete docker-compose.yml and your ors-config.json with us, in this thread. That’ll make it easier for us to spot problems.