Skip to content

Tisseo/Chaos

 
 

Repository files navigation

Chaos

Chaos is the web service which can feed Navitia with real-time disruptions. It can work together with Kirin which can feed Navitia with real-time delays.

API Documentation

Swagger

Installation

The hard way

Clone the Chaos repository

git clone git@github.com:CanalTP/Chaos.git
cd Chaos

Python requirements

  • Install Python sudo apt-get install python2.7 python2.7-dev
  • Install pip
  • Install virtualenv
virtualenv venv
source venv/bin/activate
pip install -r requirements.txt

Build protobufs

  • Install protoc sudo apt-get install protobuf-compiler (or build it from source: protobuf v2.6.1)
  • Build protobufs
git submodule init
git submodule update
./setup.py build_pbf

Create the database

sudo apt-get install postgresql libpq-dev
sudo -i -u postgres
# Create a user
createuser -P navitia (password "navitia")

# Create database
createdb -O navitia chaos

# Create database for tests
createdb -O navitia chaos_testing
ctrl + d

Cache configuration

To improve its performance Chaos can use Redis.

Install Redis

Installing Redis

Using Chaos without Redis

You can deactivate Redis usage in default_settings.py by changing 'CACHE_TYPE' to 'simple'

Using Chaos without cache

For development purpose you can deactivate cache usage in default_settings.py by forcing 'CACHE_TYPE' to 'null'

Run Chaos with honcho (optional)

Install honcho

You can use honcho for managing Procfile-based applications.

pip install honcho
create a .env file

Write this line inside

CHAOS_CONFIG_FILE=default_settings.py
Upgrade database
honcho run ./manage.py db upgrade
RabbitMQ (optional)

RabbitMQ is optional and you can deactivate it if you don't want to send disruptions to a queue.

# chaos/default_settings.py
ENABLE_RABBITMQ = False
Run Chaos
honcho start

The easy way (with Docker)

git clone git@github.com:CanalTP/Chaos.git
cd Chaos
git submodule init
git submodule update
docker-compose up -d

To watch logs output:

docker-compose logs -f

Chaos will be accessible on http://chaos_ws_1.docker if you are using the docker-gen-hosts tool, it will also be accessible on http://chaos-ws.local.canaltp.fr The database will be accessible at 'chaos_database_1.docker' and default RabbitMQ interface at 'http://chaos_rabbitmq_1.docker:15672'.

Tests

The following commands for tests are also working in Docker environment, you just have to run before:

docker-compose exec ws bash
cd tests

Unit tests

cd tests
honcho run nosetests

Functional tests

cd tests
honcho run lettuce

To stop directly on faulty test

cd tests
honcho run lettuce --failfast

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Gherkin 76.2%
  • Python 23.8%