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
A web application which you can search, buy or sell shares with current prices which provided by IEX.

CS50 - Stock Exchange A web application which you can search, buy or sell shares with current prices which provided by IEX. Table of Contents Setup St

null 1 May 28, 2022
Team10 backend - A service which accepts a VRM (Vehicle Registration Mark)

GreenShip - API A service which accepts a VRM (Vehicle Registration Mark) and re

3D Hack 1 Jan 21, 2022
This is sample project needed for security course to connect web service to database

secufaku This is sample project needed for security course to "connect web service to database". Why it suits alignment purpose It connects to postgre

Mark Nicholson 6 May 15, 2022
Tools for dos (denial-of-service) website / web server

DoS Attack Tools Tools for dos (denial-of-service) website / web server di buat olah NurvySec How to install on debian / ubuntu $ apt update $ apt ins

nurvy 1 Feb 10, 2022
pyRTOS is a real-time operating system (RTOS), written in Python.

pyRTOS Introduction pyRTOS is a real-time operating system (RTOS), written in Python. The primary goal of pyRTOS is to provide a pure Python RTOS that

Ben Williams 96 Dec 30, 2022
An unofficial python API for trading on the DeGiro platform, with the ability to get real time data and historical data.

DegiroAPI An unofficial API for the trading platform Degiro written in Python with the ability to get real time data and historical data for products.

Jorrick Sleijster 5 Dec 16, 2022
use Notepad++ for real-time sync after python appending new log text

FTP远程log同步工具 使用Notepad++配合来获取实时更新的log文档效果 适用于FTP协议的log远程同步工具,配合MT管理器开启FTP服务器使用,通过Notepad++监听文本变化,更便捷的使用电脑查看方法注入打印后的信息 功能 过滤器 对每行要打印的文本使用回调函数筛选,支持链式调用

Liuhaixv 1 Oct 17, 2021
Use a real time weather API to apply wind to your mouse cursor.

wind-cursor Use a real time weather API to apply wind to your mouse cursor. Requirements PyAutoGUI pyowm Usage This program uses the OpenWeatherMap AP

Andreas Schmid 1 Feb 7, 2022
Meera 2 May 12, 2022
🤖🤖 Jarvis is an virtual assistant which can some tasks easy for you like surfing on web opening an app and much more... 🤖🤖

Jarvis ?? ?? Jarvis is an virtual assistant which can some tasks easy for you like surfing on web opening an app and much more... ?? ?? Developer : su

null 1 Nov 8, 2021