Express 中文文档 Express 中文文档
指南
GitHub (opens new window)
指南
GitHub (opens new window)
  • 快速入门

    • 安装
    • 你好世界
    • Express 生成器
    • 基本路由
    • 静态文件
    • 更多示例
    • 常见问题
  • 使用指南

  • express()
  • 应用
  • 请求
  • 响应
  • 路由

VROOM Docker image


Master push

This image includes all dependencies and projects needed to successfully run an instance of vroom-express on top of vroom. Within 2 minutes you'll have a routing optimization engine running on your machine.

  1. ``` shell
  2. docker run -dt --name vroom \
  3.     --net host \  # or set the container name as host in config.yml and use --port 3000:3000 instead, see below
  4.     -v $PWD/conf:/conf \ # mapped volume for config & log
  5.     -e VROOM_ROUTER=osrm \ # routing layer: osrm, valhalla or ors
  6.     vroomvrp/vroom-docker:v1.13.0
  7. ```

If you want to build the image yourself, run a

docker build -t vroomvrp/vroom-docker:v1.13.0 --build-arg VROOM_RELEASE=v1.13.0 --build-arg VROOM_EXPRESS_RELEASE=v0.11.0 .

Note, you should have access to a self-hosted instance of OSRM, Valhalla or OpenRouteService for the routing server.


Tagging


The tagging scheme follows the release convention of vroom core.

Customization


Environment variables


VROOM_ROUTER : specifies the routing engine to be used, osrm, valhalla or ors. Default osrm.

The pre-configured host for the routing servers is localhost and port: 8080 for ORS, port: 5000 for OSRM and port: 8002 for Valhalla.

Note, the environment variable VROOM_ROUTER has precedence over the router setting in config.yml.


Volume mounting


All relevant files are located inside the container's /conf directory and can be shared with the host. These include:

access.log : the server log for vroom-express
config.yml : the server configuration file, which gives you full control over the vroom-express configuration. If you need to edit the configuration, run docker restart vroom to restart the server with the new settings.

Add a -v $PWD/vroom-conf:/conf to your docker run command.

Build arguments


If you prefer to build the image from source, there are 2 build arguments:

VROOM_RELEASE : specifies VROOM's git branch, commit hash or release (e.g. v1.11.0 ) to install in the container
VROOM_EXPRESS_RELEASE : specifies vroom-express 's git branch, commit hash or release (e.g. v0.11.0 ) to install in the container

Note, not all versions are compatible with each other


Routing Server


You have the option to use OSRM, Valhalla or OpenRouteService. However, the proper setup in Docker or docker-compose depends on how you run the routing server.

Routing server in local Docker container


If you started the routing layer in a separate Docker container via docker run and didn't create a docker network, you'll have to start the vroom container on the host network by adding --net host. The disadvantage is that you'll have to assign vroom-express configured port on the host machine. If port 3000 is already occupied on your machine, configure a different port in config.yml.

Alternatively you can add both containers to a private Docker network and change the routing server host(s) to the routing server container name(s) in config.yml before restarting the vroom container. However, the concepts involved are beyond the scope of this project.

Routing server on a remote server


In this case, you'll have to edit the mapped config.yml to include the host and port you published the routing server on.
Last Updated: 2023-08-24 08:51:03