Skip to content

Latest commit

 

History

History
69 lines (46 loc) · 3.81 KB

readme.md

File metadata and controls

69 lines (46 loc) · 3.81 KB

Docker-Compose to use Road2, Route-Graph-Generator and PGRouting-Procedures

Introduction

Road2 is a route calculation service. To work, it must have access to a volume that contains the data generated by Route-Graph-Generator and to a PGRouting database.

Prerequisites

General

To use this docker-compose.yml, just:

  • Install docker and docker-compose.
  • Retrieve the sources of the tools useful for development. This is done via the GIT submodules: git submodule update --init at the root of the Road2 project.
  • Place yourself in the /docker/dev/ folder of the Road2 project.
  • Create a .env file next to the docker-compose.yml which will be an adapted copy of the compose.env.example

Proxy

If we use these Dockerfiles behind a proxy, it will be necessary to check that docker is already working correctly with the proxy:

  • the file /etc/systemd/system/docker.service.d/http-proxy.conf is correctly filled in and allows dockerd to download images from the internet.
  • the ~/.docker/config.json file is correctly populated and allows the docker CLI to provide the proxy to each image launched by the user.

DNS

If we use these Dockerfiles with a VPN, we will check that the DNS configurations used by Docker are the correct ones:

  • the /etc/docker/daemon.json file must be filled in to allow dockerd to specify which DNS to use for each image. We will therefore be careful to fill in the dns and dns-search attributes.

IP

If we use these Dockerfiles on a network with which there may be IP problems, it will be useful to dedicate a range of unused IPs to Docker:

  • The bip` attribute of the /etc/docker/daemon.json` file allows you to specify an IP range.
  • If bip has been filled in, we will ensure that this IP range is added to the docker0 interface. The sudo ip route add {ip_range} dev docker0 command allows you to do this.
  • We may also need to add a different IP range to use this compose: sudo ip route add {plage_ip_env} dev br-{id_du_network} proto kernel scope link src {ip_env_gateway} where the id is obtained by doing a docker network ls. The IP range and its gate are those defined in the .env.

HTTPS

If you want to test the server in HTTPS, some actions are necessary upstream:

  • generate a self-signed certificate to launch the application in HTTPS (eg openssl req -nodes -new -x509 -keyout server.key -out server.cert).
  • make sure no server is running on port 443.

Building images

It is possible to use the Dockerfiles of each project to build the images one by one. But it can be done automatically via docker-compose.

Just run the docker-compose build command.

Starting Services

To launch a service, just run the command docker-compose up $service with:

  • $service=road2 for Road2. This will also instantiate a PGRouting.
  • $service=pgrouting for PGRouting.
  • $service=r2gg for Route-Graph-Generator. This will also instantiate a PGRouting.

You can use the -d option to run in the background.

Services start order

To make the complete pipeline work, you must for the moment launch the services in the following order: docker-compose up -d pgrouting docker-compose up r2gg to generate data docker-compose up road2

Variable management

When building images and then when using services, there are several parameters that can vary. These parameters are indicated in the docker-compose.yml file by the ${var} syntax or by docker secrets.

The .env file

Parameters of the ${var} type are initialized in the .env file which is located next to the docker-compose.yml. This file does not exist. It must be created by copying and adapting the file compose.env.example. the .env is ignored by git.

The secrets

Secrets are used to transfer sensitive data. In our case, they are useful for connecting to the database which will generate a graph.