diff --git a/docker-orchestration/osrm-backend/Dockerfile b/docker-orchestration/osrm-backend/Dockerfile index 40a39c54d..1235903bd 100644 --- a/docker-orchestration/osrm-backend/Dockerfile +++ b/docker-orchestration/osrm-backend/Dockerfile @@ -36,7 +36,7 @@ FROM debian:stretch-slim as runstage RUN DEBIAN_FRONTEND=noninteractive apt-get update && \ DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends libboost-program-options1.62.0 libboost-regex1.62.0 \ libboost-date-time1.62.0 libboost-chrono1.62.0 libboost-filesystem1.62.0 \ - libboost-iostreams1.62.0 libboost-thread1.62.0 expat liblua5.2-0 libtbb2 && \ + libboost-iostreams1.62.0 libboost-thread1.62.0 expat liblua5.2-0 libtbb2 curl ca-certificates && \ rm -rf /var/lib/apt/lists/* RUN mkdir /osrm-build diff --git a/docker-orchestration/osrm-backend/README.md b/docker-orchestration/osrm-backend/README.md index ab7aa6273..4e2d21036 100644 --- a/docker-orchestration/osrm-backend/README.md +++ b/docker-orchestration/osrm-backend/README.md @@ -12,3 +12,7 @@ $ DOCKER_BUILDKIT=1 docker build -t telenav/osrm-backend . $ DOCKER_BUILDKIT=1 docker build -t telenav/osrm-backend:telenav-import-internal-pbf --build-arg BRANCH_NAME=feature/telenav-import-internal-pbf . ``` + +## Example +- [Build Berlin Server with OSM data](./example-berlin-osm.md) + diff --git a/docker-orchestration/osrm-backend/docker-entrypoint.sh b/docker-orchestration/osrm-backend/docker-entrypoint.sh index 7f2be4daa..f4c137f96 100755 --- a/docker-orchestration/osrm-backend/docker-entrypoint.sh +++ b/docker-orchestration/osrm-backend/docker-entrypoint.sh @@ -10,13 +10,13 @@ if [ "$1" = 'routed_startup' ]; then ./osrm-routed $DATA_PATH/$2.osrm -a MLD --max-table-size 8000 & child=$! wait "$child" -elif [ "$1" = 'compile_mapdata']; then +elif [ "$1" = 'compile_mapdata' ]; then trap _sig SIGKILL SIGTERM SIGHUP SIGINT EXIT if [ ! -f $DATA_PATH/$2.osrm ]; then if [ ! -f $DATA_PATH/$2.osm.pbf ]; then curl $3 > $DATA_PATH/$2.osm.pbf fi - ./osrm-extract $DATA_PATH/$2.osm.pbf -p profile.lua + ./osrm-extract $DATA_PATH/$2.osm.pbf -p profiles/car.lua ./osrm-partition $DATA_PATH/$2.osrm ./osrm-customize $DATA_PATH/$2.osrm fi diff --git a/docker-orchestration/osrm-backend/example-berlin-osm.md b/docker-orchestration/osrm-backend/example-berlin-osm.md new file mode 100644 index 000000000..d1d402572 --- /dev/null +++ b/docker-orchestration/osrm-backend/example-berlin-osm.md @@ -0,0 +1,34 @@ +# Build OSRM server based on Berlin OSM data + +- Generate docker image +```bash +DOCKER_BUILDKIT=1 docker build --no-cache -t telenav/osrm-backend:docker-orchestration-perry --build-arg BRANCH_NAME=feature/docker-orchestration-perry . +``` + +- Generate OSRM data +```bash + docker run -d -v /Users/ngxuser/osrm-data/berlin_osm:/osrm-data --name osrm-data telenav/osrm-backend:docker-orchestration-perry compile_mapdata berlin "https://download.geofabrik.de/europe/germany/berlin-latest.osm.pbf" +``` + +- Start OSRM server +```bash +docker run -d -p 5000:5000 -v /Users/ngxuser/osrm-data/berlin_osm:/osrm-data --name osrm-api telenav/osrm-backend:docker-orchestration-perry routed_startup berlin +``` +You should see such logs in docker +``` +# docker logs -f container_id +[info] starting up engines, v5.22.0 +[info] Threads: 10 +[info] IP address: 0.0.0.0 +[info] IP port: 5000 +[info] http 1.1 compression handled by zlib version 1.2.8 +[info] Listening on: 0.0.0.0:5000 +[info] running and waiting for requests +``` + +- Test +```bash +curl "http://127.0.0.1:5000/table/v1/driving/13.388860,52.517037;13.397634,52.529407;13.428555,52.523219" +``` + +