diff --git a/README.md b/README.md index a2b15ce75a8f3c90c8145fdd82eb15a3e2e5b3e7..01708a3a63e1d0e9ffb249bbbc8fe03af42560f0 100644 --- a/README.md +++ b/README.md @@ -23,6 +23,17 @@ which queues it reads from. Subsequent requests to the client endpoint return the client_id but not the secret. +### Testing + +Current coverage: + +- API: yes +- Pika RabbitMQ implementation: no + +``` +pytest +``` + ### Running via docker-compose Using `docker-compose` will mean that everything is setup automatically, this includes the `rabbitmq` container, the backbone API, and the backbone bus. The `run-compose.sh` script has been provided to simplify this even further - all you have to do is set whatever env vars you need in the `.env` file and then run `./run-compose.sh` (the defaults in `.env` are fine for local dev work, but ones not labelled `optional` will need setting in a production setting). The env vars are: @@ -35,8 +46,10 @@ Using `docker-compose` will mean that everything is setup automatically, this in #### Setup +In a virtual environment + ``` -pipenv install +pip install -r requirements-dev.txt ``` #### RabbitMQ @@ -46,29 +59,38 @@ pipenv install #### API ``` -pipenv run python api.py +python api.py ``` -#### Create some clients - -`POST` to `http://localhost:3000/clients` - #### Event bus ``` -pipenv run python soar_bus.py +python soar_bus.py ``` +### Usage + +To use the backbone you have to create a client. +The client id and name should be unique but human +readable. A client secret is returned by the API +and client credential grants using this client_id +and secret are used to authenticate client +application connections. + +#### Create some clients + +`POST` to `http://localhost:3000/clients` + #### Send / Receive directly ``` # Send a message -pipenv run python client_send.py noc-c2-outbox 'soar.noc.slocum.something' from noc-c2 +python client_send.py noc-c2-outbox 'soar.noc.slocum.something' from noc-c2 ``` ``` # Receive messages -pipenv run python client_read.py noc-sfmc-inbox +python client_read.py noc-sfmc-inbox ``` #### Receive via API @@ -80,14 +102,3 @@ secret matches before allowing the request. This should be replaced with a proper auth layer. `GET http://localhost:5000/receive?client_id=[client_id]&secret=[secret]` - -### Components - -- `soar_bus.py` - Run all the components threaded based on existing clients -- `soar_forward.py` - Listen for messages on queue A and forward messages to queue B -- `soar_publish.py` - Listen for messages on queue A and publish on exchange B -- `soar_broadcast.py` - Listen for messages on queue A and broadcast on exchange B -- `soar_subscribe.py` - Create subscriptions to both the publish and broadcast exchange - deliver to queue A - (I think this should probably be 2 separate functions to keep things nice and simple) -- `soar_push.py` - Not yet implemented - Listen for messages on queue A and POST to the client's webhook URL -