From 89401ce85f4dddf858461c796f54c79704ce29b4 Mon Sep 17 00:00:00 2001 From: James Kirk <james.kirk@noc.ac.uk> Date: Thu, 9 Feb 2023 11:19:39 +0000 Subject: [PATCH] docs: updated README with compose instructions refactor: MQ_HOST default in run-compose script --- README.md | 23 ++++++++++++----------- run-compose.sh | 4 ++++ 2 files changed, 16 insertions(+), 11 deletions(-) diff --git a/README.md b/README.md index fdd1d8c..29b10f2 100644 --- a/README.md +++ b/README.md @@ -2,14 +2,6 @@ Communications Backbone by C2 Team (NOC) -## DJ prototype - -I did this in freedom-fire-day so it doesn't currently follow the flask template. - -It's also a bit weird because it writes to a local ignored `clients.json` file -instead of using a database. I did this as a placeholder because we've not yet -decided what the infrastructure looks like. - ### Data flow - Client A sends to `client-a-outbox` (or POSTs to API /send - not yet implemented) @@ -31,14 +23,23 @@ which queues it reads from. Subsequent requests to the client endpoint return the client_id but not the secret. -### Setup +### 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: + +- `MQ_HOST` - The hostname of our `rabbitmq` instance. This defaults to `rmq` which matches the container name of the `rabbitmq` instance in the compose yaml file +- `DATA_DIR` - Where to mount the volume of the API container on your local system. This defaults to the result of `pwd`, which should be within the `communications-backbone` repo +- `SOAR_TOKEN_LIFETIME` (Optional) - The number of hours until a newly created token expires +- `SOAR_TOKEN_SECRET` (Optional) - A secret key used to encrypt/decrypt token data. If specified the value should be set using TokenModel.getKey() + +### Running manually + +#### Setup ``` pipenv install ``` -### Running - #### RabbitMQ `docker run --rm -p 5672:5672 -d --hostname rmq --name rmq rabbitmq:management` diff --git a/run-compose.sh b/run-compose.sh index 3e00d7e..eb6ff2d 100755 --- a/run-compose.sh +++ b/run-compose.sh @@ -5,4 +5,8 @@ if [[ -z "${DATA_DIR}" ]]; then DATA_DIR=$(pwd) fi +if [[ -z "${MQ_HOST}" ]]; then + MQ_HOST=rmq +fi + docker-compose -f docker/docker-compose.yaml up --build \ No newline at end of file -- GitLab