Skip to content

docker images and docker compose files for easy navitia's use

License

Notifications You must be signed in to change notification settings

wearedevx/navitia-docker-compose

 
 

Repository files navigation

navitia_docker_compose

docker-compose with micro containers, one for each navitia's service

This repository is not actively maintained, and not ready for production use. It's currently for testing only, as far as Hove (ex. Kisio Digital, ex. CanalTP) is concerned.

How to use

You'll need docker and docker-compose (tested with docker v1.12.1 and docker-compose v1.8.1)

Run them all

docker-compose up

Provide safir data

./set-dataset-local.sh

Provide data

The most common provided data formats are:

  • OSM .pbf for street-network data
  • NTFS for Public Transport data (most tested in Navitia)
    You can as well provide GTFS directly to Navitia, but it will be deprecated. This will be replaced by using first gtfs2ntfs converter available in navitia_model, then providing the NTFS output to navitia.

You can then add some data in the default coverage:

The input dir in in tyr_beat in /srv/ed/input/<name_of_the_coverage>.

The easiest way is to copy the data via docker:

docker cp data/dumb_ntfs.zip navitiadockercompose_tyr_worker_1:/srv/ed/input/default/

navitiadockercompose_tyr_worker_1 is the name of the container, it can be different since it's dependant of the directory name.

(or you can change the docker-compose and make a shared volume).

Query Navitia API

Then you can query jormungandr:

http://localhost:9191/v1/coverage/default/lines

On Windows, Linux containers are created inside a virtual machine that runs on Windows host OS. This virtual machine gets assigned an IP. To query jormungandr, you should use this IP instead of localhost.

To know the IP assigned to the virtual machine, run the docker-machine ls command. You will get output similar to the following:

$ docker-machine ls
NAME      ACTIVE   DRIVER       STATE     URL                         SWARM   DOCKER        ERRORS
default   *        virtualbox   Running   tcp://192.168.99.100:2376           v18.05.0-ce

In this case, the IP is 192.168.99.100 instead of localhost, and you can query jormungandr on : http://192.168.99.100:9191/v1/coverage/default/lines

See https://stackoverflow.com/questions/50890981/docker-port-mapping-is-not-working-on-windows-10

Additional instances

If you need additional instances, you can use the docker-instances.jinja2 to generate another docker-compose file (if you want to do some shiny service discovery instead of this quick and dirty jinja template, we'll hapilly accept the contribution 😉 )

You'll need to install j2cli

pip install "j2cli[yaml]"

You need to provide the list of instances (the easiest way is to give it as a yaml file, check artemis/artemis_instances_list.yml for an example)

j2 docker-instances.jinja2 my_instances_list.yml > additional_navitia_instances.yml

Then you need to start the docker-compose with the additional instances

docker-compose -f docker-compose.yml -f additional_navitia_instances.yml up

To add data to a given instance, you'll need to do:

docker cp data/dumb_ntfs.zip navitiadockercompose_tyr_worker_1:/srv/ed/input/<my_instance>

Tweak images

By default, the tag :latest will be used when images are pulled. If you want to use diferent tags, set the TAG envar. For instance, to run the dev images for development purposes, run:

TAG=dev docker-compose -f docker-compose.yml -f additional_navitia_instances.yml up

Environment variables

TAG and KIRIN_TAG, as described above, latest is fine

DOCKER_REGISTRY path the container image registry, such as gcr.io/<project_name>

UPDATER_PORT the port the updater listens on JORMUNGANDR_PORT the port the search API listens on TYR_WEB_PORT the port the tyr-web service listens on

UPDATER_AUTH_TOKEN the token used to authenticte requests to the updater

About

docker images and docker compose files for easy navitia's use

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Shell 49.6%
  • JavaScript 35.8%
  • Dockerfile 10.7%
  • Jinja 2.4%
  • Python 1.5%