Openroute service and VROOM

Hello everyone!

I’m excited to share that I’ve been working on setting up and using OpenRoute Service on my Ubuntu virtual machine via VirtualBox. So far, I’ve managed to make some successful requests from my machine using the endpoint provided in this [link](https://openrouteservice.org/dev/#/api-docs/v2/directions/%7Bprofile%7D/get)

However, I’ve run into a little dilemma when trying to use the optimization feature with Vroom Project. It seems I need to download this service from GitHub, and although I’ve given it a shot, I’m having trouble installing it correctly or making the request to get the most optimal route.

The documentation is a bit confusing, especially because the video tutorial I found is based on using the API, and I’m working in an On-Premise environment. Has anyone else faced this issue and could offer some advice or additional guidance?

I appreciate any help you can provide! :blush:

Hi @oriolvillorbinaenint,

easiest way is using docker which sets up vroom & vroom-express for you.

If you want to set it up from source, follow the installation documentation from those repos.

If you have a local ors running on port 8082, then the default config should fit.
If you changed some hosts or ports, you might have to adjust it a bit.

Best regards.

Hello,

I’ve tried to follow all the documentation from GitHub with I’m not able to make ORS and VROOM work together to be able to use the optimization endpoint, I’ve tried it installing the docker vroom and building it from the source. I couldn’t find any answer on my tryings. As I said on the first message, it’s a bit confusing all the documentation and I’m not able to install it on a easy way. I don’t know if there’s extra documentation, or new documentation and someone can give me a hand,

Thanks for all, :slight_smile:

Hey,
if you have your own openrouteservice instance running, then setting VROOM it up via docker following the instructions linked to by @amandus should work rather easily.

What is the config.yml you’re currently using for VROOM?
Can you provide a minimal (GET) request you can successfully run on your machine?

Best regards

Hello guys, first of all thanks for helping me.

My situation is that I have installed ORS on premise, and I’m able to run the service and request information to get the routes that I want. Until here it’s all settled up. I managed to install the maps that I need and to try different routes that works perfect.

On the VROOM part, is where i’m getting more stucked, and maybe i’m overthinking too much and in reality it’s easier.

In Documents path I installed ORS, here is where I have a folder called openrouteservice, to run the service I go to /Documents/openrouteservice/docker and here I execute sudo docker compose up. I initialize docker and I can start making requests from my machine to the server getting the results that I need.

For the installation of VROOM, I go to Documents directory, I open the terminal and I paste and execute this command:

All my next actions are referenced from this documentation: VROOM-Project/vroom-docker: Docker image for vroom and vroom-express (github.com)

sudo docker run -dt --name vroom --net host -v $PWD/conf:/conf -e VROOM_ROUTER=ors ghcr.io/vroom-project/vroom-docker:v1.14.0

It creates a conf folder, where inside I have two files, access.log and config.yml

As you mentioned config.yml here’s my configuration:

I did the docker restart vroom command as I changed orsm to ors in the router parameter.

Since here, I assume that I need to do the POST request referenced in the API playground here: Optimization | ORS API (openrouteservice.org) and it should work?

Sorry for this long post, but I thought that it would be the best option to understand my problem.

Thanks for this help guys,

Sorry guys again, I git cloned the repo, and did all this commands inside, and still stucked in these steps…

If I docker ps I see both services running:

Also I changed from config.yml the ip’s in the ors section from the ip of the machine:

But when I execute the python script that I copied from the documentation it returns me this error:

404 Not Found
Error
Cannot POST /ors/v2/optimization

This is the script, I tried to make the request with the port 8080 but it didn’t work either:

import requests

body = {“jobs”: [{“id”: 1, “service”: 300, “delivery”: [1], “location”: [2.13236, 41.36314], “skills”: [1], “time_windows”: [[32400, 36000]]},
{“id”: 2, “service”: 300, “delivery”: [1], “location”: [2.13189, 41.36476], “skills”: [1]},
{“id”: 3, “service”: 300, “delivery”: [1], “location”: [2.13057, 41.36556], “skills”: [2]},
{“id”: 4, “service”: 300, “delivery”: [1], “location”: [2.12788, 41.36511], “skills”: [2]},
{“id”: 5, “service”: 300, “delivery”: [1], “location”: [2.12594, 41.36612], “skills”: [14]},
{“id”: 6, “service”: 300, “delivery”: [1], “location”: [2.12872, 41.36503], “skills”: [14]}],
“vehicles”: [{“id”: 1, “profile”: “driving-car”, “start”: [2.12868, 41.36543], “end”: [2.12868, 41.36543],
“capacity”: [4], “skills”: [1, 14], “time_window”: [28800, 43200]}]}

headers = {
‘Accept’: ‘application/json, application/geo+json, application/gpx+xml, img/png; charset=utf-8’,
‘Content-Type’: ‘application/json; charset=utf-8’
}
call = requests.post(‘http://192.168.1.77:3000/ors/v2/optimization’, json=body, headers=headers)

print(call.status_code, call.reason)
print(call.text)

Thanks!

Hey,

if you have vroom running, you need to send your optimization requests directly to vroom, not through openrouteservice.

Also, your vroom docker container has no ports open to the outside - you have to pass port 3000 through like you do with ors and port 8080.

Best regards

Good Morning,

I added the last lines to the ORS docker-compose.yml. Which I reference VROOM as I saw in other posts from this blog.

I built again the docker and now I have the port 3000 ready in VROOM.

Now, I should be able to call the service and receive the optimization route right?

When I do it, I get returned by the server error 500

Is there something more that I need to configure?

Best Regards,.

Hey,

yes, this doesn’t look too bad.

When running a VROOM version before v1.14, iirc the host should look something like 192.168.1.77, without the path behind that.

Apart from that, make sure that your ors works and that the vroom container correctly picks up your config.

Best regards

Good Morning,

I get a correct response when calling ors for /directions.

When I want to request to VROOM I do it like as you said in your first phrase, just pointing to the port.

import requests

body = {“jobs”: [{“id”: 1, “service”: 300, “delivery”: [1], “location”: [2.13236, 41.36314], “skills”: [1], “time_windows”: [[32400, 36000]]},
{“id”: 2, “service”: 300, “delivery”: [1], “location”: [2.13189, 41.36476], “skills”: [1]},
{“id”: 3, “service”: 300, “delivery”: [1], “location”: [2.13057, 41.36556], “skills”: [2]},
{“id”: 4, “service”: 300, “delivery”: [1], “location”: [2.12788, 41.36511], “skills”: [2]},
{“id”: 5, “service”: 300, “delivery”: [1], “location”: [2.12594, 41.36612], “skills”: [14]},
{“id”: 6, “service”: 300, “delivery”: [1], “location”: [2.12872, 41.36503], “skills”: [14]}],
“vehicles”: [{“id”: 1, “profile”: “driving-car”, “start”: [2.12868, 41.36543], “end”: [2.12868, 41.36543],
“capacity”: [4], “skills”: [1, 14], “time_window”: [28800, 43200]}]}

headers = {
‘Accept’: ‘application/json, application/geo+json, application/gpx+xml, img/png; charset=utf-8’,
‘Content-Type’: ‘application/json; charset=utf-8’
}
call = requests.post(‘http://192.168.1.80:3000’, json=body, headers=headers)

print(call.text)
print(call)

But I get this response:

image

That is making me thing that vroom is not picking up correctly the config of ors, as you say in the second phrase.

And my question is, as I see that is failing at some point, how can I make sure that vroom takes the configuration of ors? I don’t know where to check that, and I don’t have any more documentation to follow, or I’m not able to find the answer,

Thanks for all this help,

Best Regards.,

Good afternoon,

I worked it!, I deleted the previous vroom docker, as I think that I made something wrong. And I don’t know how, so I started again a few times.

I installed again vroom with this command:

docker run -dt --name vroom_test --net host -v $PWD/conf:/conf -e VROOM_ROUTER=ors vroomvrp/vroom-docker:v1.8.0

I went into the docker files:

docker exec -t -i vroom_test /bin/bash

I edited the config.yml and I setted the router as ‘ors’.

And now when I do the request it returns me the values that I’m searching.

Thanks for all the help, and sorry for bothering you that much, I hope that this thread help other users that had been stucked into this problem as mine,

Thanks for all,

Best Regards.,

2 Likes