I started vroom + ors, but I cannot use optimization endpoint

I’ve already started a docker compose instance and everything seems to be running, directions api works, all health check green.

Vroom also started listening on port 3000.

But I cannot make any api calls to http://localhost:8080/ors/v2/optimization endpoint, it gives me 404 error.

Is there something else I need to setup to enable optimization?

Thanks a lot!

Hey,

when configuring vroom (or rather, vroom-express), make sure that you have the routingServers set up correctly in your config.yml, i.e. that the host and port for ors profiles are set correctly.

Then, your optimization queries should go to vroom directly, which will in turn call your configured ors instance.
You don’t have to configure a “detour” via ors :wink:

Best regards

thank you for your quick reply! Will this url work if I configured in vroom?
looks like I need to rebuild the vroom image to use ors instead of the default osrm backend

configure config.yml like this:

cliArgs:
  geometry: false # retrieve geometry (-g)
  planmode: false # run vroom in plan mode (-c) if set to true
  threads: 4 # number of threads to use (-t)
  explore: 5 # exploration level to use (0..5) (-x)
  limit: '1mb' # max request size
  logdir: '/..' # the path for the logs relative to ./src
  logsize: '100M' # max log file size for rotation
  maxlocations: 1000 # max number of jobs/shipments locations
  maxvehicles: 200 # max number of vehicles
  override: true # allow cli options override (-c, -g, -t and -x)
  path: '' # VROOM path (if not in $PATH)
  port: 3000 # expressjs port
  router: 'ors' # routing backend (osrm, libosrm or ors)
  timeout: 300000 # milli-seconds
  baseurl: '/' #base url for api
routingServers:
  osrm:
    car:
      host: '0.0.0.0'
      port: '5000'
    bike:
      host: '0.0.0.0'
      port: '5001'
    foot:
      host: '0.0.0.0'
      port: '5002'
  ors:
    driving-car:
      host: '0.0.0.0'
      port: '8080'
    driving-hgv:
      host: '0.0.0.0'
      port: '8080'
    cycling-regular:
      host: '0.0.0.0'
      port: '8080'
    cycling-mountain:
      host: '0.0.0.0'
      port: '8080'
    cycling-road:
      host: '0.0.0.0'
      port: '8080'
    cycling-electric:
      host: '0.0.0.0'
      port: '8080'
    foot-walking:
      host: '0.0.0.0'
      port: '8080'
    foot-hiking:
      host: '0.0.0.0'
      port: '8080'
  valhalla:
    auto:
      host: '0.0.0.0'
      port: '8002'
    bicycle:
      host: '0.0.0.0'
      port: '8002'
    pedestrian:
      host: '0.0.0.0'
      port: '8002'
    motorcycle:
      host: '0.0.0.0'
      port: '8002'
    motor_scooter:
      host: '0.0.0.0'
      port: '8002'
    taxi:
      host: '0.0.0.0'
      port: '8002'
    hov:
      host: '0.0.0.0'
      port: '8002'
    truck:
      host: '0.0.0.0'
      port: '8002'
    bus:
      host: '0.0.0.0'
      port: '8002'

and docker compose to this:


services:
  vroom:
    network_mode: host
    image: vroomvrp/vroom-docker:v1.11.0
    container_name: vroom
    volumes:
      - ./vroom-conf/:/conf
    environment:
      - VROOM_ROUTER=ors  # router to use, osrm, valhalla or ors
    depends_on:
      - ors

but still cannot access optimization endpoint, i can access and received response for directions api

Hey,

if your system correctly resolves host: '0.0.0.0' to localhost, then this looks like it could work.
Note, that you’ll have to query localhost:3000 for optimization queries, not …ors/v2/optimization.

Best regards

I Still Couldn’t access multiple vechicles optimization endpoint. Can you please help out.

Hey,

without a bit more information, it’s going to be hard to help out.
Could you check that your ors instance is correctly up and running, that your vroom config has correct routingServers configured and that requests go to the vroom port?

Best regards

Yes ors is currectly up and running also it giving response to end points like http://localhost:8080/ors/v2/status or health.

It was said localhost port 3000 /health would respond once vroom is ready, But that one is giving error.
Here is my config.yml file pls check they are any errors. [Please do not post phone numbers, email addresses or social media accounts on forum posts]

cliArgs:
  geometry: false # retrieve geometry (-g)
  threads: 4 # number of threads to use (-t)
  explore: 5 # exploration level to use (0..5) (-x)
  limit: '1mb' # max request size
  logdir: '/..' # the path for the logs relative to ./src
  logsize: '100M' # max log file size for rotation
  maxlocations: 1000 # max number of jobs/shipments locations
  maxvehicles: 200 # max number of vehicles
  override: true # allow cli options override (-g, -t and -x)
  path: '' # VROOM path (if not in $PATH)
  port: 3000 # expressjs port
  router: 'ors' # routing backend (osrm, libosrm or ors)
  timeout: 300000 # milli-seconds
  baseurl: '/' #base url for api
routingServers:
  osrm:
    car:
      host: '0.0.0.0'
      port: '5000'
    bike:
      host: '0.0.0.0'
      port: '5000'
    foot:
      host: '0.0.0.0'
      port: '5000'
  ors:
    driving-car:
      host: '0.0.0.0'
      port: '8080'
    driving-hgv:
      host: '0.0.0.0'
      port: '8080'
    cycling-regular:
      host: '0.0.0.0'
      port: '8080'
    cycling-mountain:
      host: '0.0.0.0'
      port: '8080'
    cycling-road:
      host: '0.0.0.0'
      port: '8080'
    cycling-electric:
      host: '0.0.0.0'
      port: '8080'
    foot-walking:
      host: '0.0.0.0'
      port: '8080'
    foot-hiking:
      host: '0.0.0.0'
      port: '8080'

Hey,

I assume you have installed vroom and are now running vroom-express to be able to query it via HTTP-requests.
Are you certain that the vroom binary is in your $PATH? Your path of your vroom-express config is empty…

Also, note that the page itself will be empty, but it’ll return HTTP200, query e.g. with

curl -w "%{http_code}\n" http://localhost:3000/health

Best regards

Hi,
Could you please say which file path to be in the vroom-express config file. Also, could you let me know what is the endpoint for achieving multiple vehicle optimization.

I came across this post since I was having an issue to make this example, work on a local setup. Since ORS doesn’t have the optimization code embedded in it anymore, you must use vroom+ors for optimization.

here’s a docker-compose.yml with this setup:

version: '2.4'
services:
  ors:
    container_name: ors
    image: openrouteservice/openrouteservice:latest
    ports:
      - 8080:8080
      - 9001:9001
    user: "${ORS_UID:-0}:${ORS_GID:-0}"
    volumes:
      - ./graphs:/ors-core/data/graphs
      - ./elevation_cache:/ors-core/data/elevation_cache
      - ./logs/ors:/var/log/ors
      - ./logs/tomcat:/usr/local/tomcat/logs
      - ./conf:/ors-conf
     # - ./new-york-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=-Djava.awt.headless=true -server -XX:TargetSurvivorRatio=75 -XX:SurvivorRatio=64 -XX:MaxTenuringThreshold=3 -XX:+UseG1GC -XX:+ScavengeBeforeFullGC -XX:ParallelGCThreads=4 -Xms1g -Xmx2g"
      - "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"

  vroom:
    container_name: vroom2
    image: vroomvrp/vroom-docker:v1.12.0
    network_mode: host
    volumes:
      - ./vroom-conf/:/conf
    environment:
      - VROOM_ROUTER=ors  # router to use, osrm, valhalla or ors
    depends_on:
      - ors

create the folders that the yaml is expecting: mkdir -p vroom-conf conf elevation_cache graphs logs/ors logs/tomcat
start this with docker compose up --build

To test that ORS is running go to: localhost:8080/ors/health
it should return {"status":"ready"}

Then test to make sure ORS has loaded your maps (especially if you are putting your own custom ones) and you are testing coordinates that fall in the loaded maps. If you are using the default ORS docker:
Execute this to see: localhost:8080/ors/v2/directions/driving-car?start=8.681495,49.41461&end=8.687872,49.420318

Now that you’ve confirmed that ORS is working, you need to update the vroom config.
Take down docker (with ctrl+c)

in vroom-conf/config.yml, you’ll need to change the router and baseurl:

router: 'ors' # routing backend (osrm, libosrm or ors)
baseurl: '/optimization/' #base url for api

You may need to make the file writeable with: chmod a+w config.yml

Now restart with docker compose up --build

Test to make sure vroom is up:

curl -w "%{http_code}\n" http://localhost:3000/health

Now make a call to the optimization endpoint by calling vroom, not ORS.
localhost:3000/optimization with your corresponding json (I would recommend using postman to send the request)

vroom will then call ORS to get information and return a response.

2 Likes