From 91f5c1a9bff96ec505b87592c5aec3ad6568032d Mon Sep 17 00:00:00 2001 From: Mikhail Volkov <47795110+mikhail-vl@users.noreply.github.com> Date: Thu, 19 Dec 2024 22:21:54 -0500 Subject: [PATCH] Update Actions and JSON Server (#23) * Update Actions and JSON Server * Update README.md * Update README.md --- README.md | 21 ++++++++++++++------- docker-compose.yml | 2 +- json-server/server.ts | 2 +- package.json | 2 ++ 4 files changed, 18 insertions(+), 9 deletions(-) diff --git a/README.md b/README.md index b8dce49..83d6cd7 100644 --- a/README.md +++ b/README.md @@ -22,7 +22,7 @@ The Business Intelligence provides an accessible platform for business users: 1. Start Grafana container ``` -docker compose --profile grafana up +docker compose --profile grafana up -d ``` 2. Create Service Account and update `GRAFANA_TOKEN` in the `.env` file. @@ -30,24 +30,31 @@ docker compose --profile grafana up 3. Start the Business Engine, Timescale database, and Prometheus ``` -docker compose --profile engine up +docker compose --profile engine up -d ``` -4. Download and start the Business Studio from [Releases](https://github.com/VolkovLabs/business-intelligence/releases). +4. Start JSON Server to test Actions (optional) -5. Configure Actions and Alert Rules: +``` +docker compose --profile actions up -d +``` + +5. Download and start the Business Studio from [Releases](https://github.com/VolkovLabs/business-intelligence/releases). + +6. Configure Actions and Alert Rules: -- Use JSON server `http://json-server:3000` for HTTP Request Action to create event and message files when alert triggered. +- Use JSON server `http://json-server:3000` for HTTP Request Action to create event and message files when alert triggered if started. - Use provisioned `Test Dashboard` for adding Alert Rules based on thresholds and Regex pattern. ![Engine Overview](https://raw.githubusercontent.com/VolkovLabs/business-intelligence/main/img/overview.png) -6. Check performance and Prometheus metrics using provisioned `Business Engine` dashboard. +7. Check performance and Prometheus metrics using provisioned `Business Engine` dashboard. -7. Stop the Business Intelligence platform +8. Stop the Business Intelligence platform ``` docker compose --profile engine down +docker compose --profile actions down docker compose --profile grafana down ``` diff --git a/docker-compose.yml b/docker-compose.yml index b4f1925..4f03630 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -49,4 +49,4 @@ services: volumes: - ./json-server/events:/app/events profiles: - - engine + - actions diff --git a/json-server/server.ts b/json-server/server.ts index b4d557d..9d44508 100644 --- a/json-server/server.ts +++ b/json-server/server.ts @@ -84,7 +84,7 @@ const server = http.createServer(function (req, res) { */ fs.writeFile( `./events/${fileName}.txt`, - JSON.stringify(parsedBody.message, null, 2), + parsedBody.message, "utf-8", (error) => { if (error) { diff --git a/package.json b/package.json index 167af6c..fb38300 100644 --- a/package.json +++ b/package.json @@ -5,8 +5,10 @@ "license": "Commercial", "name": "business-intelligence", "scripts": { + "start:actions": "docker compose --profile actions pull && docker compose --profile actions up", "start:engine": "docker compose --profile engine pull && docker compose --profile engine up", "start:grafana": "docker compose --profile grafana pull && docker compose --profile grafana up", + "stop:actions": "docker compose --profile actions down", "stop:engine": "docker compose --profile engine down", "stop:grafana": "docker compose --profile grafana down" }