Skip to content

Latest commit

 

History

History
145 lines (85 loc) · 4.48 KB

install.rst

File metadata and controls

145 lines (85 loc) · 4.48 KB

How to build kraken and run it

Dependencies

  1. C++
    • gcc 4.7 or newer
    • cmake
    • log4cplus
    • osmpbf (https://github.com/scrosby/OSM-binary)
    • boost (test, chrono, regex, system, serialization, date-time, thread, filesystem, iostreams, program-options)
    • zeromq 2.2
    • libpqxx 3
    • libgoogle-perftools-dev (tcmalloc)
    • protobuf
    • proj
  2. Python

    Each python module have a pip requirements.txt file that list it's dependencies.

    To install the dependencies for a module use pip (you can also wrap that in a virtualenv):

    pip install -r {path_to_navitia_source}/jormungandr/requirements.txt

  3. Other
    • RabbitMQ server
    • PostgreSQL (9.1+) and Postgis (2.0+)
    • Redis server

Build instruction

We hope you got the source code from git.

  1. Get the submodules: at the root of project :

    git submodule update --init

  2. With CMake you can build in a repository different than the source directory.

    By convention, you can have one build repository for each kind of build. Create a directory where everything will be built and enter it mkdir release cd release

  3. Run cmake

    cmake ../source Note: it will build in release mode. If you want to compile it with debug symbols run cmake -DCMAKE_BUILD_TYPE=Debug ../source

  4. Compile

    make -j4 Note: adjust -jX according to the number of cores you have

  5. Run the tests

    make test

Testing

  1. Overview

image

  1. Data configuration

    The data manager is called ed. It relies on GTFS and Open Street Map data centralized in a postgres database

  2. Configure the postgres database
    1. Install the postgis extension http://postgis.net/docs/postgis_installation.html
      1. if your postgis version is newer than 2.0, just call create extention

        su postgres; #or the user you installed postgres with

        psql -d yourdatabase -c "CREATE EXTENSION postgis;"

      2. else call the init_db.sh script with a settings file.

        Copy the file source/script/settings.sh and update it with your parameters

        su postgres; #or the user you installed postgres with

        cd source/scripts;

        ./init_db.sh your_settings.sh

    2. Update the database scheme (with the usual user, not with 'postgres' anymore)

      cd source/sql

      PYTHONPATH=. alembic -x dbname="postgresql://$db_user:$db_user_password@localhost/$db_name" upgrade head

      If you prefer, you can also copy the alembic.ini config file and update the sqlalchemy.url field with you db connection string

      PYTHONPATH=. alembic -c your_alembic.ini upgrade head

  3. Get some GTFS data. For instance from http://data.navitia.io

    Import them using the gtfs2ed tool

  4. Get some Open Street Map data. For instance from http://metro.teczno.com/

    Import them using the osm2ed tool

  5. Once ed has been loaded with all the data, you have to export the data for Kraken with the ed2nav tool

    This step will generate a compressed nav file that can be given as input to Kraken

  6. Running the Kraken backend
    1. To run Kraken, you need to supply some parameters. You can give those parameters either via a file or via the command-line. By default you can take the documentation/examples/config/kraken.ini configuration file. The configuration file needs at least the path of the exported nav file and the zmq socket used to communicate with Jörmungandr. Run kraken --help to see the list of arguments
    2. Run Kraken. It should tell you what data it tries to load, and give some figures about the data
  7. Running the Jörmungandr front-end. Note : this front-end is an API, and not oriented towards final users
    1. Edit if you want the Jormungandr.ini file.

      Note: If you want to put the file elsewhere, you can change the INSTANCES_DIR variable

      example file : :

      [instance]
      # name of the kraken
      key = some_region
      # zmq socket used to talk to the kraken, should be the same as the one defined by the zmq_socket param in kraken
      socket = ipc:///tmp/default_kraken
    2. Give him the configuration file (by default it uses source/jormungandr/default_settings.py) and run it

      JORMUNGANDR_CONFIG_FILE=your_config.py python manage.py runserver

    3. Grab a browser and open http://localhost:5000/v1/coverage/default_region