Local hosting of ors and vroom

Hi,
Im trying to localy run the route optimzation locally. I get the local ors to work. But when i post the following example:

import requests

body = {
    "jobs": [
        {"id": 1, "service": 300, "amount": [1], "location": [57.7072, 11.9668]},
        {"id": 2, "service": 300, "amount": [1], "location": [57.6955, 11.9926]},
        {"id": 3, "service": 300, "amount": [1], "location": [57.7104, 11.9658]},
        {"id": 4, "service": 300, "amount": [1], "location": [57.6838, 11.9487]}
    ],
    "vehicles": [
        {
            "id": 1,
            "profile": "driving-hgv",
            "start": [57.7072, 11.9668],
            "end": [57.7072, 11.9668],
            "capacity": [2000]
        }
    ],
    "options": {"g": 'true'}
}

headers = {
    'Accept': 'application/json, application/geo+json, application/gpx+xml, img/png; charset=utf-8',
    'Content-Type': 'application/json; charset=utf-8'
}

response = requests.post('http://localhost:3000', json=body, headers=headers)
print(response.json())

‘Vroom Response:
{
“code”: 3,
“error”: “Failed to connect to 0.0.0.0:8080”
}’

This is my current set up:
docker-compose:

version: '3.8'

services:
  ors-app:
    build:
      context: ./
    container_name: ors-app
    ports:
      - "8080:8082"
      - "9001:9001"
    image: openrouteservice/openrouteservice:v8.0.0
    volumes:
      - ./ors-docker:/home/ors
    environment:
      REBUILD_GRAPHS: False
      CONTAINER_LOG_LEVEL: INFO
      XMS: 4g
      XMX: 8g
      ADDITIONAL_JAVA_OPTS: ""
  vroom:
    image: ghcr.io/vroom-project/vroom-docker:latest
    ports:
      - "3000:3000"
    volumes:
      - ./vroom/config.yml:/conf/config.yml
    environment:
      - VROOM_ROUTER=ors

Vroom config:

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/ors/v2'
      port: '8080'
    driving-hgv:
      host: '0.0.0.0/ors/v2'
      port: '8080'
    cycling-regular:
      host: '0.0.0.0/ors/v2'
      port: '8080'
    cycling-mountain:
      host: '0.0.0.0/ors/v2'
      port: '8080'
    cycling-road:
      host: '0.0.0.0/ors/v2'
      port: '8080'
    cycling-electric:
      host: '0.0.0.0/ors/v2'
      port: '8080'
    foot-walking:
      host: '0.0.0.0/ors/v2'
      port: '8080'
    foot-hiking:
      host: '0.0.0.0/ors/v2'
      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'

ors-config:

ors:
  engine:
    source_file: /home/ors/files/sweden-latest.osm.pbf
    profiles:
      hgv:
        enabled: true

Hey,

I’m guessing that your baseurl and host settings in the vroom config don’t quite add up, since you are usually not querying localhost:8080 but localhost:8080/ors/v2/ or something along those lines, so the ors/v2-part might be missing in either of the two parameters.

The handling here changed in v1.14, so it will depend on your vroom version.

Best regards

Hi there just keen to see if anyone has any fix for this as I have the same problem. Below is my docker-compose file:


version: '3.8'

services:
  # ----------------- ORS application configuration ------------------- #
  ors-app:

    build:
      context: ./
    container_name: ors-app
    ports:
      - "8080:8082"  # Expose the ORS API on port 8080
      - "9001:9001"  # Expose additional port for monitoring (optional)
    image: local/openrouteservice:latest
    volumes:  # Mount relative directories. ONLY for local container runtime. To switch to docker managed volumes see 'Docker Volumes configuration' section below.
      - ./ors-docker:/home/ors  # Mount the ORS application directory (for logs, graphs, elevation_cache, etc.) into its own directory
    environment:
      REBUILD_GRAPHS: False  # Set to True to rebuild graphs on container start.
      CONTAINER_LOG_LEVEL: INFO  # Log level for the container. Possible values: DEBUG, INFO, WARNING, ERROR, CRITICAL
      XMS: 4g  # start RAM assigned to java
      XMX: 6g  # max RAM assigned to java. Rule of Thumb: <PBF-size> * <profiles> * 2
      ADDITIONAL_JAVA_OPTS: ""  # further options you want to pass to the java command

  vroom-backend:
    container_name: vroom-backend
    image: ghcr.io/vroom-project/vroom-docker:latest
    restart: always
    ports:
      - "3000:3000"
    depends_on:
      - ors-app
    volumes:
      - ./vroom-conf/:/conf
    environment:
      - VROOM_ROUTER=ors
    networks:
      tsp_network:
        aliases:
          - vroom-backend
  vroom-frontend:
    container_name: vroom-frontend
    image: iedmrc/vroom-frontend
    restart: always
    ports:
      - "9966:9966"
    depends_on:
      - ors-app
      - vroom-backend
    networks:
      tsp_network:
        aliases:
          - vroom-frontend
networks:
  tsp_network:
      driver: bridge

Vroom config:

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:
  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'

As you can probably suggest I am not very experienced in Docker stuff :slight_smile:

Hi @DiyanIvanov

see jakobs post above.

Where did you get your vroom config from?

See example conrfig for ors settings:

Best regards

Hiya, thanks for the prompt response! The error persists even after updating the paths to 0.0.0.0/ors/v2

Me again following the steps in this https://medium.com/@calroughan/a-beginners-guide-to-installing-osrm-and-vroom-on-gcp-28fbcf1f7857 guide, I have manually created Bridge Network, and when inspecting the network I saw that the Gateway is 172.20.0.1. So changing 0.0.0.0/ors/V2 to 172.20.0.1/ors/v2 solve the problem for me.

1 Like