Web service which feeds Navitia with real-time disruptions

Overview

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.

chaos schema global

API Documentation

OpenAPI

Published on https://canaltp.github.io/Chaos

How to contribute?

The documentation is maintained in OpenAPI format in documentation/swagger.yml. To test the website which will be published on GitHub pages, use the tool Act and run

act -W .github/workflows/publish_documentation.yml

The last step (publication to GitHub) will fail as intended since it is a local test. The website has been built during previous steps. Browse the documentation by opening the file documentation/slate/build/index.html.

FAQ

For french users, you can see this FAQ

Installation

The hard way

Clone the Chaos repository

git clone [email protected]:CanalTP/Chaos.git
cd Chaos

Requirements

  • PostgreSQL 9.6 sudo apt-get install postgresql-9.6 postgresql-server-dev-9.6 libpq-dev
  • RabbitMQ
Python
  • Install Python2.7 sudo apt-get install python2.7 python2.7-dev

    or sudo apt install python2 python2-dev on recent linux release

  • Install pip

  • Install virtualenv

virtualenv venv
source venv/bin/activate
pip install -r requirements.txt

Install & build protobuf

  • Install protobuf

You can use sudo apt-get install protobuf-compiler if you're sure it won't install version 3.x.x (incompatible).

Or install protoc building it from source : protobuf v2.6.1. After download, from inside the unziped folder :

./configure
make
make install
ldconfig
make clean

Check your version

protoc --version
  • Build protobuf, back into Chaos project folder
git submodule init
git submodule update
./setup.py build_pbf

Create the database

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
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 [email protected]: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'.

Security (optional)

If you want to add more security, you can add a file chaos/clients_tokens.json with the client code and navitia tokens like:

{
   "client_code": [
     "navitia_token1",
     "navitia_token2"
   ]
 }

client_code should be the same as the value of X-Customer-Id header in HTTP request and token should be the same as the value of Authorization header in HTTP request If the file doesn't exist, the security will be disabled.

You can add a 'master' key in the file. It will allow you to access all resources for all clients.

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

With docker

docker-compose -f docker-compose.test.yml build --pull
docker-compose -f docker-compose.test.yml up -d
docker-compose -f docker-compose.test.yml exec -T chaos /bin/sh ./docker/tests.sh
docker-compose -f docker-compose.test.yml down --remove-orphans

Copyright

Copyright © since 2001, Kisio Digital and/or its affiliates. All rights reserved. This project is part of Navitia surround, the sprawling API to build cool stuff with public transport.

Hope you'll enjoy and contribute to this project, powered by Kisio Digital (www.kisio.com).

Help us simplify mobility and open public transport: a non ending quest to the responsive locomotion way of traveling !

Licence

This program is free software; you can redistribute it and/or modify it under the terms of the GNU Affero General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more details.

You should have received a copy of the GNU Affero General Public License along with this program. If not, see http://www.gnu.org/licenses/.

Stay tuned

Twitter @navitia

Tchat channel #navitia on riot

Forum Navitia on googlegroups

www.navitia.io

You might also like...
Simple web application, which has a single endpoint, dedicated to annotation parsing and convertion.

Simple web application, which has a single endpoint, dedicated to annotation parsing and conversion.

A "multiclipboards" script for an efficient way to improve the original clipboards which are only able to save one string at a time

A "multiclipboards" script for an efficient way to improve the original clipboards which are only able to save one string at a time. Works on both Windows and Linux.

Flask-built web application that simulates a time and cost calculator for charging Electric Vehicles.

ev_charging_calculator Flask-built web application that simulates a time and cost calculator for charging Electric Vehicles. The project aims to simul

OnTime is a small python that you set a time and on that time, app will send you notification and also play an alarm.

OnTime Always be OnTime! What is OnTime? OnTime is a small python that you set a time and on that time, app will send you notification and also play a

Shutdown Time - A pretty much useless application that allows you to shut your computer down in x time with a GUI.
Shutdown Time - A pretty much useless application that allows you to shut your computer down in x time with a GUI.

A pretty much useless application that allows you to shut your computer down in x time with a GUI. Should eventually support Windows (all versions), Linux (v2.0+), MacOS (probably with Linux, idk)

A simple service that allows you to run commands on the server using text

Server Text A simple flask service that allows you to run commands on the server/computer over sms. Think of it as a shell where you run commands over

VirtualBox Power Driver for MAAS (Metal as a Service)
VirtualBox Power Driver for MAAS (Metal as a Service)

vboxpower VirtualBox Power Driver for MAAS (Metal as a Service) A way to manage the power of VirtualBox virtual machines via the MAAS webhook driver.

An alternative site to emplea.do due to inconsistent service of the app.

feline a agile and fast alternative to emplea.do License: MIT Settings Moved to settings. Basic Commands Setting Up Your Users To create a normal user

Simple Denial of Service Program yang di bikin menggunakan bahasa pemograman Python,

Peringatan Tujuan kami share code Indo-DoS hanya untuk bertujuan edukasi / pembelajaran! Dilarang memperjual belikan source ini / memperjual-belikan s

Releases(v1.4.1)
  • v1.4.1(Mar 25, 2022)

    What's Changed

    • Proto share message notification false by @dvdn in https://github.com/CanalTP/Chaos/pull/522

    Full Changelog: https://github.com/CanalTP/Chaos/compare/v1.4.0...v1.4.1

    Source code(tar.gz)
    Source code(zip)
  • v1.4.0(Mar 23, 2022)

    What's Changed

    • Add sorting feature on disruptions/_search API by @tchevily in https://github.com/CanalTP/Chaos/pull/504
    • [DOC] Message notification_date addition by @dvdn in https://github.com/CanalTP/Chaos/pull/505
    • DOC: "status" removed from PUT and POST /disruptions. by @Msaglier in https://github.com/CanalTP/Chaos/pull/507
    • [Notification Date] manage notification_date by message by @dvdn in https://github.com/CanalTP/Chaos/pull/506
    • Swagger doc version++ by @Msaglier in https://github.com/CanalTP/Chaos/pull/509
    • Feature notification_date by Message by @dvdn in https://github.com/CanalTP/Chaos/pull/508
    • [Feature] multi messages on same channel by @dvdn in https://github.com/CanalTP/Chaos/pull/510
    • Filter impacts with severities by @tchevily in https://github.com/CanalTP/Chaos/pull/515
    • Bump protobuf from 2.6.0 to 3.15.0 by @dependabot in https://github.com/CanalTP/Chaos/pull/513
    • chaos proto update by @dvdn in https://github.com/CanalTP/Chaos/pull/514
    • Protobuff downgrade by @Msaglier in https://github.com/CanalTP/Chaos/pull/518
    • Add id field to impact messages by @tchevily in https://github.com/CanalTP/Chaos/pull/516
    • Add read only by @pthegner in https://github.com/CanalTP/Chaos/pull/519
    • Now send_notification accept null value by @Fahmus in https://github.com/CanalTP/Chaos/pull/520

    Full Changelog: https://github.com/CanalTP/Chaos/compare/v1.3.5...v1.4.0

    Source code(tar.gz)
    Source code(zip)
  • v1.3.5(Dec 27, 2021)

    What's Changed

    • Redoc integration by @martinraynov in https://github.com/CanalTP/Chaos/pull/489
    • Add Navitia Logo in the swagger file by @martinraynov in https://github.com/CanalTP/Chaos/pull/490
    • Documentation generation GitHub action by @martinraynov in https://github.com/CanalTP/Chaos/pull/491
    • Push to gh-pages by @martinraynov in https://github.com/CanalTP/Chaos/pull/492
    • Fix sonarcloud errors by @Fahmus in https://github.com/CanalTP/Chaos/pull/493
    • [documentation] use slate engine by @pascal-vs in https://github.com/CanalTP/Chaos/pull/495
    • Update test.jenkinsfile by @pthegner in https://github.com/CanalTP/Chaos/pull/496
    • Add drafts API by @pthegner in https://github.com/CanalTP/Chaos/pull/503

    New Contributors

    • @martinraynov made their first contribution in https://github.com/CanalTP/Chaos/pull/489
    • @pascal-vs made their first contribution in https://github.com/CanalTP/Chaos/pull/495

    Full Changelog: https://github.com/CanalTP/Chaos/compare/v1.3.4...v1.3.5

    Source code(tar.gz)
    Source code(zip)
  • v1.3.4(Sep 13, 2021)

  • v1.3.3(Sep 7, 2021)

  • v1.3.2(Aug 19, 2021)

    Fix order severity and updated impact #486

    :exclamation: Note : this release includes a data migration on Severity. From now-on default value is '0'. All existing 'NULL' values in this table is transformed into '0'.

    Source code(tar.gz)
    Source code(zip)
  • v1.3.1(Aug 16, 2021)

  • v1.3.0(Jun 17, 2021)

  • v1.2.33(Jun 17, 2021)

    #472 : Disable the requirement of line_section id #473 : Update documentation on install protobuff #477 : Add index that improve some performance #483 : Add new disruption type "unexpected" (use only for filter / display)

    Source code(tar.gz)
    Source code(zip)
  • v1.2.32(Mar 23, 2021)

  • v1.2.31(Feb 8, 2021)

    Persist 'timezone' information into 'pattern' #460 Chaos: Publish application period period pattern if present #454

    [exports api] order for export list #452

    [Tests auto] new JDR data #451 [Tests auto] Refs #BOT-2230 Now we use test.jenkinsfile for test #449

    Return error from authorization navitia #450 Doc: application_periods required for impact creation #453

    Clean line_section (step 3/3) update chaos-proto (#444)

    Source code(tar.gz)
    Source code(zip)
  • v1.2.30(Aug 25, 2020)

    #443 : Clean line section with migrate file #442 : Fix empty pt object filter on impacts/_search API #439 : [docker] patch UWSGI to allow http 'chunked' #438 : DOC: x-contributors and x-customer-id update. #437 : [Doc] Install on recent linux distro #436 : Doc explaining Client Contributor

    Source code(tar.gz)
    Source code(zip)
  • v1.2.29(Apr 6, 2020)

  • v1.2.28(Mar 16, 2020)

  • v1.2.27(Feb 19, 2020)

  • v1.2.26(Feb 3, 2020)

  • v1.2.25(Jan 21, 2020)

    https://github.com/CanalTP/Chaos/pull/429 Newrelic update https://github.com/CanalTP/Chaos/pull/428 Add single quote in ptobject not found error message https://github.com/CanalTP/Chaos/pull/430 #BOT-1795 - Bugfix when we post or put a disruption with invalid cause id

    Source code(tar.gz)
    Source code(zip)
  • v1.2.24(Dec 17, 2019)

    new route POST contributor (#427)

    Channels required resolution (#426) Add single quote in ptobject not found error message (#428) Bugfix when we POST or PUT disruption with cause of another client (#425)

    Source code(tar.gz)
    Source code(zip)
  • v1.2.23(Nov 25, 2019)

    #420 GET [Disruptions] native SQL requests

    #424 [Disruptions] Display 20 impacts by default instead of 10 #422 [Disruptions] Display all impacts but non archived #423 Patch some comments copyrights

    Source code(tar.gz)
    Source code(zip)
  • v1.2.22(Nov 15, 2019)

  • v1.2.21(Nov 13, 2019)

    #419 feature-bot-1652-delete-cause

    #413 #418 Update swagger 2 to openapi 3

    #411 feature-BOT-1306-simplify-export CSV

    #414 Add line_section validation entry #417 patch-wording-resol

    Source code(tar.gz)
    Source code(zip)
  • v1.2.20(Oct 25, 2019)

  • v1.2.18(Sep 23, 2019)

    https://github.com/CanalTP/Chaos/pull/404 Update the key cache ptobject navitia search https://github.com/CanalTP/Chaos/pull/405 Return ptobject error on stoparea of line_section

    Source code(tar.gz)
    Source code(zip)
  • v1.2.17(Sep 9, 2019)

  • v1.2.16(Aug 22, 2019)

  • v1.2.15(Jul 23, 2019)

  • v1.2.14(Jun 18, 2019)

  • v1.2.13(Jun 7, 2019)

  • v1.2.12(Jun 6, 2019)

  • v1.2.11(May 29, 2019)

Owner
KISIO Digital
Captain of Navitia
KISIO Digital
This is a Poetry plugin that will make it possible to build projects using custom TOML files

Poetry Multiproject Plugin This is a Poetry plugin that will make it possible to build projects using custom TOML files. This is especially useful whe

David Vujic 69 Dec 25, 2022
Discover and load entry points from installed packages

Entry points are a way for Python packages to advertise objects with some common interface. The most common examples are console_scripts entry points,

Thomas Kluyver 69 Jul 05, 2022
emoji-math computes the given python expression and returns either the value or the nearest 5 emojis as measured by cosine similarity.

emoji-math computes the given python expression and returns either the value or the nearest 5 emojis as measured by cosine similarity.

Andrew White 13 Dec 11, 2022
Simplified web browser made in python for a college project

Python browser Simplified web browser made in python for a college project. Web browser has bookmarks, history, multiple tabs, toolbar. It was made on

AmirHossein Mohammadi 9 Jul 25, 2022
Курс "Искусственный интеллект и машинное обучение"

Искусственный интеллект и машинное обучение О курсе Данный репозиторий содержит в себе сопроводительный учебный материал для курса "Искусственный инте

Dmitry Aladin 19 Dec 04, 2022
The program calculates the BMI of people

Programmieren Einleitung: Das Programm berechnet den BMI von Menschen. Es ist sehr einfach zu handhaben, so können alle Menschen ihren BMI berechnen.

2 Dec 16, 2021
A simple program to run through inputs for a 3n+1 problem

Author Tyler Windemuth Collatz_Conjecture A simple program to run through inputs for a 3n+1 problem Purpose: doesn't really have a purpose, did this t

0 Apr 22, 2022
YourCity is a platform to match people to their prefect city.

YourCity YourCity is a city matching App that matches users to their ideal city. It is a fullstack React App made with a Redux state manager and a bac

Nico G Pierson 6 Sep 25, 2021
Library for managing git hooks

Autohooks Library for managing and writing git hooks in Python. Looking for automatic formatting or linting, e.g., with black and pylint, while creati

Greenbone 165 Dec 16, 2022
WordlistPasswordGenerator - Shuhfab Basheer

WordlistPasswordGenerator - Shuhfab Basheer Python wordlist generator MAINTAINER

1 Dec 31, 2021
Turn crypto miner on/off depending on powerwall charge level

Mining Crypto with Tesla Solar and Powerwalls This script turns a crypto miner on and off when the Tesla Powerwall level drops/rises above a certain t

Matt 1 Nov 09, 2021
Additional useful operations for Python

Pyteal Extensions Additional useful operations for Python Available Operations MulDiv64: calculate m1*m2/d with no overflow on multiplication (TEAL 3+

Ulam Labs 11 Dec 14, 2022
Code for Crowd counting via unsupervised cross-domain feature adaptation.

CDFA-pytorch Code for Unsupervised crowd counting via cross-domain feature adaptation. Pre-trained models Google Drive Baidu Cloud : t4qc Environment

Guanchen Ding 6 Dec 11, 2022
Dapp / Forge traces enhancer

traces-explorer Dapp / Forge traces enhancer Usage traces.py and pattern_* files should be in the same directory make test traces.txt py traces.

1 Feb 02, 2022
BlackIP-Rep is a tool designed to gather the reputation and information of Bulk IP's.

BlackIP-Rep is a tool designed to gather the reputation and information of Bulk IP's. Focused on increasing the workflow of Security Operations(SOC) team during investigation.

0LiVEr 6 Dec 12, 2022
Материалы для курса VK Углубленный Python, весна 2022

VK Углубленный Python, весна 2022 Материалы для курса VK Углубленный Python, весна 2022 Лекции и материалы (слайды, домашки, код с занятий) Введение,

10 Nov 02, 2022
resultados (data) de elecciones 2021 y código para extraer data de la ONPE

elecciones-peru-2021-ONPE Resultados (data) de elecciones 2021 y código para extraer data de la ONPE Data Licencia liberal, pero si vas a usarlo por f

Ragi Yaser Burhum 21 Jun 14, 2021
Manually Install Python 2.7 pip without any problem !

Python2.7_install_pip Manually Install Python 2.7 pip without any problem ! Download installPip.py to your system and Run the code using this Command

Ali Jafari 1 Dec 09, 2021
Small scripts to learn about GNOME internals

gnome-hacks This is a collection of APIs that allow programmatic manipulation of the GNOME shell. If you use GNOME (the default graphical shell in Ubu

Alex Nichol 5 Oct 22, 2021
Performance monitoring and testing of OpenStack

Browbeat Browbeat is a performance tuning and analysis tool for OpenStack. Browbeat is free, Open Source software. Analyze and tune your Cloud for opt

cloud-bulldozer 83 Dec 14, 2022