Feature/docker orchestration perry (#19)
* fix: Fix the issue in shell script to build docker image - Fix the issue in the if * fix: Fix the issue in shell script to build docker image - Fix the issue related with profile, currently use car.lua to build data * fix: Fix the issue in shell script to build docker image - Need curl installed in docker image to download pbf file * fix: Fix the issue in shell script to build docker image - To download osm data from geofabrik, need ca-certificates otherwise will meet error like: curl: (77) error setting certificate verify locations * doc: Add document to record how to use docker-orchestration/osrm-backend
This commit is contained in:
parent
99fa6f63a1
commit
79d565b2ec
@ -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
|
||||
|
||||
@ -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)
|
||||
|
||||
|
||||
@ -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
|
||||
|
||||
34
docker-orchestration/osrm-backend/example-berlin-osm.md
Normal file
34
docker-orchestration/osrm-backend/example-berlin-osm.md
Normal file
@ -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"
|
||||
```
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user