# Own hosted openrouteservice instance not working

**URL:** https://ask.openrouteservice.org/t/own-hosted-openrouteservice-instance-not-working/1800
**Category:** openrouteservice
**Created:** [June 9, 2020, 9:22pm UTC](https://ask.openrouteservice.org/t/own-hosted-openrouteservice-instance-not-working/1800 "2020-06-09T21:22:43Z")
**Posts on this page:** 13
**Page:** 1

<div class="post-metadata">

### Author: ![SimonDahrs](https://ask.openrouteservice.org/user_avatar/ask.openrouteservice.org/simondahrs/32/603_2.png) [@SimonDahrs](https://ask.openrouteservice.org/u/SimonDahrs)
#### Post date: [June 9, 2020, 9:22pm UTC](https://ask.openrouteservice.org/t/own-hosted-openrouteservice-instance-not-working/1800/1 "2020-06-09T21:22:43Z")

</div>

I have my own hosted instance of openrouteservice using their Docker image ([https://github.com/GIScience/openrouteservice](https://github.com/GIScience/openrouteservice)). I downloaded the .pbf file of the Netherlands from [https://download.geofabrik.de/europe/netherlands.html](https://download.geofabrik.de/europe/netherlands.html), and I set to use this file in the docker-compose file.

When I run a simple query on this instance, like:

```auto
url:
http://my-domain/ors/v2/directions/driving-car/json?
Headers:
{
  "headers": {
    "User-Agent": "ORSClientPython.v2.2.3",
    "Content-type": "application/json",
    "Authorization": null
  },
  "timeout": 60,
  "json": {
    "coordinates": [
      [
        4.451162,
        51.926484
      ],
      [
        4.301373,
        52.049112
      ],
      [
        4.528832,
        52.06009
      ],
      [
        4.322566,
        52.057557
      ],
      [
        4.256713,
        52.071065
      ],
      [
        4.223623,
        52.024614
      ],
      [
        4.451162,
        51.926484
      ]
    ]
  }
}

```

I get the response `Could not find point 0: 4.4511620 51.9264840 within a radius of 350.0 meters.` While, when I run this exact same query, I do get a succesful response.

Does anyone know what is going wrong here?

Here’s my docker-compose.yml:

```auto

version: '3'
services:
  ors-app:
    container_name: ors-app
    ports:
      - 8080:8080
    image: openrouteservice/openrouteservice:v6.1.0
    build:
      context: ../
      args:
        APP_CONFIG: ./openrouteservice/docker/conf/app.config.sample
        OSM_FILE: ./osm_data/netherlands-latest.osm.pbf
    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
      - ./osm_data/netherlands-latest.osm.pbf:/ors-core/data/osm_file.pbf
    environment:
      - BUILD_GRAPHS=False # Forces the container to rebuild the graphs, e.g. when PBF is changed in app.config
      - "JAVA_OPTS=-Djava.awt.headless=true -server -XX:TargetSurvivorRatio=75 -XX:SurvivorRatio=64 -XX:MaxTenuringThreshold=3 -XX:+UseConcMarkSweepGC -XX:+UseParNewGC -XX:ParallelGCThread$
      - "CATALINA_OPTS=-Dcom.sun.management.jmxremote -Dcom.sun.management.jmxremote.port=9001 -Dcom.sun.management.jmxremote.rmi.port=9001 -Dcom.sun.management.jmxremote.authenticate=fals$

```

---

<div class="post-metadata">

### Author: ![LittleBoxOfChicken](https://ask.openrouteservice.org/user_avatar/ask.openrouteservice.org/littleboxofchicken/32/601_2.png) [@LittleBoxOfChicken](https://ask.openrouteservice.org/u/LittleBoxOfChicken)
#### Post date: [June 11, 2020, 4:41pm UTC](https://ask.openrouteservice.org/t/own-hosted-openrouteservice-instance-not-working/1800/2 "2020-06-11T16:41:58Z")

</div>

Hallo,

I’m also from the Netherlands and I’m also trying to get the service working with that same file. It seems to me that the .pbf file of the entire Netherlands is broken right now. Building routes of each provice separately works fine.

Also you should change BUILD\_GRAPHS=False to BUILD\_GRAPHS=True otherwise it will not try to recalculate the graphs. (which determine your routes)

Also if, after changing the environment variable, you have any luck with the netherlands-latest.osm.pbf file, let me know. 🙂

---

<div class="post-metadata">

### Author: ![nils](https://ask.openrouteservice.org/user_avatar/ask.openrouteservice.org/nils/32/6_2.png) [@nils](https://ask.openrouteservice.org/u/nils)
#### Post date: [June 11, 2020, 6:10pm UTC](https://ask.openrouteservice.org/t/own-hosted-openrouteservice-instance-not-working/1800/3 "2020-06-11T18:10:32Z")

</div>

You sure about that? Did you try all provinces separately, they build, but entire country doesn’t?

What’s the error? I’d guess on a out-of-memory?!

---

<div class="post-metadata">

### Author: ![nils](https://ask.openrouteservice.org/user_avatar/ask.openrouteservice.org/nils/32/6_2.png) [@nils](https://ask.openrouteservice.org/u/nils)
#### Post date: [June 11, 2020, 6:12pm UTC](https://ask.openrouteservice.org/t/own-hosted-openrouteservice-instance-not-working/1800/4 "2020-06-11T18:12:42Z")

</div>

There IS a tiny bug(ish):

> <https://github.com/GIScience/openrouteservice/issues/742>
>
> It's very annoying: whenever a new container is created (e.g. when just changing… some env var in \`docker-compose.yml\`) the new container reads the default \`app.config\` provided by the image. Regardless if the user actually has a valid config in \`./ors-conf\`. 
> 
> Not hard to remedy:
> 
> The problem is that \`mvn package\` is run in the image itself, which packages the default \`app.config\` into the WAR file. So currently there's no way to access the \`app.config\` Tomcat will use since it's inside the WAR.
> 
> The lines 
> \`\`\`
> mvn -q -f /ors-core/openrouteservice/pom.xml package -DskipTests && \\
> cp -f /ors-core/openrouteservice/target/\*.war /usr/local/tomcat/webapps/ors.war && \\ 
> \`\`\`
> need to be in \`docker-entrypoint.sh\`, not in the \`Dockerfile\`, with some logic so we don't package needlessly if nothing changed.

When the container starts the first time, it most likely will build Heidelberg. Try coordinates from Heidelberg, my guess is they work. If you just restart the container it should work. But to be sure do `BUILD_GRAPHS=True`.

---

<div class="post-metadata">

### Author: ![SimonDahrs](https://ask.openrouteservice.org/user_avatar/ask.openrouteservice.org/simondahrs/32/603_2.png) [@SimonDahrs](https://ask.openrouteservice.org/u/SimonDahrs)
#### Post date: [June 11, 2020, 7:17pm UTC](https://ask.openrouteservice.org/t/own-hosted-openrouteservice-instance-not-working/1800/5 "2020-06-11T19:17:18Z")

</div>

Thanks, this was exactly the issue I had!  
Apparently the graphs were built using the Heidelberg dataset so it couldn’t find my Dutch coordinates.  
I deleted the graphs folder, which is equivalent to setting BUILD\_GRAPHS=True to build the correct graphs.

---

<div class="post-metadata">

### Author: ![nils](https://ask.openrouteservice.org/user_avatar/ask.openrouteservice.org/nils/32/6_2.png) [@nils](https://ask.openrouteservice.org/u/nils)
#### Post date: [June 11, 2020, 7:18pm UTC](https://ask.openrouteservice.org/t/own-hosted-openrouteservice-instance-not-working/1800/6 "2020-06-11T19:18:49Z")

</div>

Yeah damn. Will fix that tmrw or the weekend. Almost everyone, myself included, gets confused by that.

---

<div class="post-metadata">

### Author: ![LittleBoxOfChicken](https://ask.openrouteservice.org/user_avatar/ask.openrouteservice.org/littleboxofchicken/32/601_2.png) [@LittleBoxOfChicken](https://ask.openrouteservice.org/u/LittleBoxOfChicken)
#### Post date: [June 12, 2020, 8:26am UTC](https://ask.openrouteservice.org/t/own-hosted-openrouteservice-instance-not-working/1800/7 "2020-06-12T08:26:42Z")

</div>

I fixed it as well. My issue was that it wasn’t using my updated config file and I had to run it with `init_thread: 1` instead of 2. I didn’t explicitly get an out of memory exception though… odd.

Glad we all got it working though! 🙂

---

<div class="post-metadata">

### Author: ![nils](https://ask.openrouteservice.org/user_avatar/ask.openrouteservice.org/nils/32/6_2.png) [@nils](https://ask.openrouteservice.org/u/nils)
#### Post date: [June 12, 2020, 11:24am UTC](https://ask.openrouteservice.org/t/own-hosted-openrouteservice-instance-not-working/1800/8 "2020-06-12T11:24:03Z")

</div>

Ooh yes that is a good point. Almost forgot that it can be an issue. You must’ve tested a lot to get to that point. Really sorry about that!

---

<div class="post-metadata">

### Author: ![nils](https://ask.openrouteservice.org/user_avatar/ask.openrouteservice.org/nils/32/6_2.png) [@nils](https://ask.openrouteservice.org/u/nils)
#### Post date: [June 14, 2020, 8:33am UTC](https://ask.openrouteservice.org/t/own-hosted-openrouteservice-instance-not-working/1800/9 "2020-06-14T08:33:20Z")

</div>

@LittleBoxOfChicken @SimonDahrs

If you could assist a little by trying if this PR resolves your issues, that’d be appreciated:

> <https://github.com/GIScience/openrouteservice/pull/745>
>
> \### Pull Request Checklist
> 
> \- \[x\] 1. I have \[\*\*rebased\*\*\](https://github.com/G…IScience/openrouteservice/blob/master/CONTRIBUTE.md#pull-request-guidelines) the latest version of the master branch into my feature branch and all conflicts have been resolved.
> \- \[x\] 2. I have added information about the change/addition to functionality to the CHANGELOG.md file under the \[Unreleased\] heading.
> \- \[\] 3. I have documented my code using JDocs tags.
> \- \[\] 4. I have removed unnecessary commented out code, imports and System.out.println statements.
> \- \[\] 5. I have written JUnit tests for any new methods/classes and ensured that they pass.
> \- \[\] 6. I have created API tests for any new functionality exposed to the API.
> \- \[\] 7. If changes/additions are made to the app.config file, I have added these to the app.config wiki page on github along with a short description of what it is for, and documented this in the Pull Request (below).
> \- \[\] 8. I have built graphs with my code of the Heidelberg.osm.gz file and run the api-tests with all test passing
> \- \[x\] 9. I have referenced the Issue Number in the Pull Request (if the changes were from an issue).
> \- \[\] 10. For new features or changes involving building of graphs, I have tested on a larger dataset (at least Germany) and the graphs build without problems (i.e. no out-of-memory errors).
> \- \[\] 11. For new features or changes involving the graphbuilding process (i.e. changing encoders, updating the importer etc.), I have generated longer distance routes for the affected profiles with different options (avoid features, max weight etc.) and compared these with the routes of the same parameters and start/end points generated from the current live ORS. If there are differences then the reasoning for these \*\*MUST\*\* be documented in the pull request.
> \- \[x\] 12. I have written in the Pull Request information about the changes made including their intended usage and why the change was needed.
> 
> Fixes #742 .
> 
> \### Information about the changes
> \- Key functionality added: 
> - default \`app.config.sample\` from \`./openrouteservice/src/main/resources/app.config.sample\` is used to build the image
> - be aware the image changes the \`app.config\` to 
> - only build \`car\` instead of all profiles
> - \`init\_threads: 1\` since \> 1 can cause issues
> - changes all paths to docker image paths
> - uses the default \`heidelberg.osm.gz\`
> \- Reason for change: Before we had two \`app.config\`, one for the native Java app, one for docker. This PR removes that maintenance burden.

The image is not available on dockerhub yet, but you can pull the associated branch and do a manual build:

```bash
docker build -t openrouteservice/openrouteservice:test_docker --build-arg OSM_FILE=./your_osm.pbf APP_CONFIG=./your.app.config .

```

Or even omit the `build-arg`s and specify those as environment variables in the `docker-compose.yml` to launch a container.

---

<div class="post-metadata">

### Author: ![jpmaniac](https://ask.openrouteservice.org/user_avatar/ask.openrouteservice.org/jpmaniac/32/487_2.png) [@jpmaniac](https://ask.openrouteservice.org/u/jpmaniac)
#### Post date: [June 16, 2020, 12:20pm UTC](https://ask.openrouteservice.org/t/own-hosted-openrouteservice-instance-not-working/1800/11 "2020-06-16T12:20:59Z")

</div>

I was able to get this version to run with the fix. Unfortunately, I’m unable to update the query limits as I had in the app.config. How should I increase the max time for isochrones in the Dockerfile?

---

<div class="post-metadata">

### Author: ![adam](https://ask.openrouteservice.org/user_avatar/ask.openrouteservice.org/adam/32/8_2.png) [@adam](https://ask.openrouteservice.org/u/adam)
#### Post date: [June 17, 2020, 6:28am UTC](https://ask.openrouteservice.org/t/own-hosted-openrouteservice-instance-not-working/1800/12 "2020-06-17T06:28:00Z")

</div>

You should be able to change it as before, but possibly it is using a cached image so I would try the build with the `--no-cache` parameter aswell

---

<div class="post-metadata">

### Author: ![nils](https://ask.openrouteservice.org/user_avatar/ask.openrouteservice.org/nils/32/6_2.png) [@nils](https://ask.openrouteservice.org/u/nils)
#### Post date: [June 17, 2020, 7:11am UTC](https://ask.openrouteservice.org/t/own-hosted-openrouteservice-instance-not-working/1800/13 "2020-06-17T07:11:28Z")

</div>

It’s a mapped path, there’s no cache. Whatever you change in there, will be immediately reflected inside the container and a restart of the container should load the new settings.

---

<div class="post-metadata">

### Author: ![jpmaniac](https://ask.openrouteservice.org/user_avatar/ask.openrouteservice.org/jpmaniac/32/487_2.png) [@jpmaniac](https://ask.openrouteservice.org/u/jpmaniac)
#### Post date: [June 17, 2020, 12:20pm UTC](https://ask.openrouteservice.org/t/own-hosted-openrouteservice-instance-not-working/1800/14 "2020-06-17T12:20:17Z")

</div>

Interesting. I tried to do this numerous times. Searched for anything with 3600 (isochrone time limit) and changed every app.config that I could find, just in case it was still somehow pulling from a different location. Well, nothing worked, so I force fed it in the Dockerfile, which worked for everything except the profile-car… Below is the Dockerfile. The new numbers are more or less arbitrary, just trying to ensure I can properly increase them before determining my needed limits. Of course, if I ever change these settings, I have to rebuild, not just restart the container.

```
FROM openjdk:8-jdk

ENV MAVEN_OPTS="-Dmaven.repo.local=.m2/repository -Dorg.slf4j.simpleLogger.log.org.apache.maven.cli.transfer.Slf4jMavenTransferListener=WARN -Dorg.slf4j.simpleLogger.showDateTime=true -Djava.awt.headless=true"
ENV MAVEN_CLI_OPTS="--batch-mode --errors --fail-at-end --show-version -DinstallAtEnd=true -DdeployAtEnd=true"

ARG APP_CONFIG=./openrouteservice/src/main/resources/app.config
ARG OSM_FILE=./openrouteservice/src/main/files/north-america-latest.osm.pbf

WORKDIR /ors-core

COPY openrouteservice /ors-core/openrouteservice
COPY $OSM_FILE /ors-core/data/osm_file.pbf
COPY $APP_CONFIG /ors-core/openrouteservice/src/main/resources/app.config

# Install tomcat
RUN wget -q https://archive.apache.org/dist/tomcat/tomcat-8/v8.0.32/bin/apache-tomcat-8.0.32.tar.gz -O /tmp/tomcat.tar.gz && \
    cd /tmp && \
    tar xvfz tomcat.tar.gz && \
    mkdir /usr/local/tomcat && \
    cp -R /tmp/apache-tomcat-8.0.32/* /usr/local/tomcat/ && \
    # Install dependencies and locales
    apt-get update -qq && apt-get install -qq -y locales nano maven moreutils jq && \
    locale-gen en_US.UTF-8 && \
    # Rename to app.config
    cp /ors-core/openrouteservice/src/main/resources/app.config.sample /ors-core/openrouteservice/src/main/resources/app.config && \
    # Replace paths in app.config to match docker setup
    jq '.ors.services.routing.sources[0] = "data/osm_file.pbf"' /ors-core/openrouteservice/src/main/resources/app.config |sponge /ors-core/openrouteservice/src/main/resources/app.config && \
    jq '.ors.services.routing.profiles.default_params.elevation_cache_path = "data/elevation_cache"' /ors-core/openrouteservice/src/main/resources/app.config |sponge /ors-core/openrouteservice/src/main/resources/app.config && \
    jq '.ors.services.routing.profiles.default_params.graphs_root_path = "data/graphs"' /ors-core/openrouteservice/src/main/resources/app.config |sponge /ors-core/openrouteservice/src/main/resources/app.config && \
# jq '.ors.services.isochrones.maximum_range_time[1].value = 3600000' /ors-core/openrouteservice/src/main/resources/app.config |sponge /ors-core/openrouteservice/src/main/resources/app.config && \
    #jq '.ors.services.isochrones.enabled = "false"' /ors-core/openrouteservice/src/main/resources/app.config |sponge /ors-core/openrouteservice/src/main/resources/app.config && \
    # init_threads = 1, > 1 been reported some issues
    jq '.ors.services.routing.init_threads = 1' /ors-core/openrouteservice/src/main/resources/app.config |sponge /ors-core/openrouteservice/src/main/resources/app.config && \
    # Increased Matrix Limits
    jq '.ors.services.matrix.maximum_search_radius = 5000000' /ors-core/openrouteservice/src/main/resources/app.config |sponge /ors-core/openrouteservice/src/main/resources/app.config && \
    # Increased Isochrones
    jq '.ors.services.isochrones.maximum_range_time[0] = { "profiles": "any", "value": 18000000 }' /ors-core/openrouteservice/src/main/resources/app.config |sponge /ors-core/openrouteservice/src/main/resources/app.config && \
    jq '.ors.services.isochrones.maximum_range_time[1] = { "profiles": "driving-car, driving-hgv", "value": 3600000 }' /ors-core/openrouteservice/src/main/resources/app.config |sponge /ors-core/openrouteservice/src/main/resources/app.config && \
    jq '.ors.services.isochrones.maximum_range_distance[0] = { "profiles": "any", "value": 50000000 }' /ors-core/openrouteservice/src/main/resources/app.config |sponge /ors-core/openrouteservice/src/main/resources/app.config && \
    jq '.ors.services.isochrones.maximum_range_distance[0] = { "profiles": "driving-car, driving-hgv", "value": 100000000 }' /ors-core/openrouteservice/src/main/resources/app.config |sponge /ors-core/openrouteservice/src/main/resources/app.config && \
    jq '.ors.services.isochrones.maximum_intervals = 10000' /ors-core/openrouteservice/src/main/resources/app.config |sponge /ors-core/openrouteservice/src/main/resources/app.config && \
    jq '.ors.services.isochrones.maximum_locations = 2000' /ors-core/openrouteservice/src/main/resources/app.config |sponge /ors-core/openrouteservice/src/main/resources/app.config && \

    # Increased Routing
    jq '.ors.services.routing.default_params.maximum_distance = 100000000' /ors-core/openrouteservice/src/main/resources/app.config |sponge /ors-core/openrouteservice/src/main/resources/app.config && \
    jq '.ors.services.routing.default_params.maximum_distance_dynamic_weights = 100000000' /ors-core/openrouteservice/src/main/resources/app.config |sponge /ors-core/openrouteservice/src/main/resources/app.config && \
    jq '.ors.services.routing.default_params.maximum_distance_avoid_areas = 100000000' /ors-core/openrouteservice/src/main/resources/app.config |sponge /ors-core/openrouteservice/src/main/resources/app.config && \
    jq '.ors.services.routing.default_params.maximum_waypoints = 5000' /ors-core/openrouteservice/src/main/resources/app.config |sponge /ors-core/openrouteservice/src/main/resources/app.config && \
    jq '.ors.services.routing.default_params.maximum_snapping_radius = 40000' /ors-core/openrouteservice/src/main/resources/app.config |sponge /ors-core/openrouteservice/src/main/resources/app.config && \
    jq '.ors.services.routing.default_params.maximum_avoid_polygon_area = 20000000000' /ors-core/openrouteservice/src/main/resources/app.config |sponge /ors-core/openrouteservice/src/main/resources/app.config && \
    jq '.ors.services.routing.default_params.maximum_avoid_polygon_extent = 20000000' /ors-core/openrouteservice/src/main/resources/app.config |sponge /ors-core/openrouteservice/src/main/resources/app.config && \
    jq '.ors.services.routing.default_params.maximum_distance_alternative_routes = 100000000' /ors-core/openrouteservice/src/main/resources/app.config |sponge /ors-core/openrouteservice/src/main/resources/app.config && \
    jq '.ors.services.routing.default_params.maximum_distance_round_trip_routes = 100000000' /ors-core/openrouteservice/src/main/resources/app.config |sponge /ors-core/openrouteservice/src/main/resources/app.config && \
# jq '.ors.services.profile-car.parameters.maximum_distance = 100000000' /ors-core/openrouteservice/src/main/resources/app.config |sponge /ors-core/openrouteservice/src/main/resources/app.config && \

    # Delete all profiles but car
    jq 'del(.ors.services.routing.profiles.active[1,2,3,4,5,6,7,8])' /ors-core/openrouteservice/src/main/resources/app.config |sponge /ors-core/openrouteservice/src/main/resources/app.config

COPY ./docker-entrypoint.sh /docker-entrypoint.sh

# Start the container
EXPOSE 8080
ENTRYPOINT ["/bin/bash", "/docker-entrypoint.sh"]
```
