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.
To use this docker-compose.yml
, just:
- Install
docker
anddocker-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 thedocker-compose.yml
which will be an adapted copy of thecompose.env.example
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 allowsdockerd
to download images from the internet. - the
~/.docker/config.json
file is correctly populated and allows thedocker
CLI to provide the proxy to each image launched by the user.
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 thedns
anddns-search
attributes.
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. Thesudo 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 adocker network ls
. The IP range and its gate are those defined in the.env
.
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.
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.
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.
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
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.
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.
Secrets are used to transfer sensitive data. In our case, they are useful for connecting to the database which will generate a graph.