From 367ffd9b25e9da308d0c1cc1b8c8e9120fb1f03b Mon Sep 17 00:00:00 2001 From: Neil Massey Date: Mon, 30 Sep 2024 10:03:29 +0100 Subject: [PATCH] Updated README.md instructions to use nlds-up --- README.md | 25 +++++++++++++++++++++---- test_run/nlds-up | 8 +------- 2 files changed, 22 insertions(+), 11 deletions(-) diff --git a/README.md b/README.md index 14971c0a..cb861151 100644 --- a/README.md +++ b/README.md @@ -96,8 +96,8 @@ Running the Server FastAPI displays automatically generated documentation for the REST-API, to browse this go to http://127.0.0.1:8000/docs/ -2. To run the microservices, you have two options: - * In individual terminals, after activating the virtual env, (e.g. +2. To run the microservices, you have three options: + 1. In individual terminals, after activating the virtual env, (e.g. `source ~/nlds-venv/bin/activate`), start each of the microservice consumers: ``` @@ -114,11 +114,28 @@ Running the Server This will send the output of each consumer to its own terminal (as well as whatever is configured in the logger). - * Alternatively, you can use the scripts in the `test_run/` directory, - notably `start_test_run.py` to start and `stop_test_run.py` to stop. + 2. Alternatively, you can use the scripts in the `test_run/` directory: + `start_test_run.py` to start and `stop_test_run.py` to stop. This will start a [screen](https://www.gnu.org/software/screen/manual/screen.html) session with all 8 processors (+ api server) in, sending each output to a log in the `./nlds_log/` directory. + This method is good for getting a whole NLDS infrastructure up and running + quickly, but is not so great for debugging. + + 3. Also in the `test_run/` directory is a script called `nlds-up` which will + activate the virtual environment and run one of the microservices listed above. + It requires the enviroment variable `NLDS_VENV` to be set to point to the + virtual environemnt created above (e.g. `~/nlds-venv/` - however, user paths + have to be expanded so, for the Mac, this would be + `/Users//nlds-venv`). + It is recommended to set the environment variable in your shell profile. For **bash** this is `~/.bash_profile`, and the environment can be set using the + line: + ``` + export NLDS_VENV="/Users//python-venvs/nlds-venv" + ``` + Running `nlds-up` then takes the name of one of the microservices above: e.g. + `nlds-up catalog_q` + Tests ----- diff --git a/test_run/nlds-up b/test_run/nlds-up index 63963480..8227ab27 100755 --- a/test_run/nlds-up +++ b/test_run/nlds-up @@ -1,3 +1,4 @@ +#! /usr/bin/env bash if [[ -z $NLDS_VENV ]]; then echo "NLDS_VENV environment variable not set" return 1 @@ -5,13 +6,6 @@ else source $NLDS_VENV/bin/activate fi -if [[ -z $NLDS_CODE ]]; then - echo "NLDS_CODE environment variable not set" - return 1 -else - cd $NLDS_CODE -fi - if [ $1 = 'nlds_q' ]; then nlds_q elif [ $1 = 'catalog_q' ]; then