SHM is a C# (ASP.NET) and TypeScript (Next.js) web project that monitors the system health status of Docker containers and visualises them in real-time using charts and diagrams.
This project consists of 3 directories/components:
- MonitoringService (.NET microservice that runs on and monitors the Docker containers)
- SHM_MS (ASP.NET backend)
- frontend (Next.js frontend)
- Docker
- PostgreSQL (see below for more instructions on installing PostgreSQL on Windows)
- TimescaleDB (refer to their documentation for installation details)
- See below if you want to exclude TimescaleDB from the installation
- .NET 9.0 (see below for information on using .NET 8.0)
- Node.js (note that you cannot copy the
node_modulesfolder across OSes) - Minimum Chrome version 111
-
git clonethis repository. -
Run
docker compose up --pull missingto automatically pull the necessary images and run four containers running MonitoringService as well as the Kafka broker. -
Make sure your PostgreSQL + TimescaleDB database server is up and running.
-
Run
dotnet tool restorein the root directory. -
Navigate to the SHM_MS directory (
cd SHM_MS). -
Run the necessary database migrations with
dotnet ef database update. -
Run
dotnet runto start the backend. -
Configure the necessary variables for SHM_MS as specified in
appsettings.json.example, then rename the file by removing.example. -
Lastly, navigate to the frontend directory and run
npm install, followed bynpm run devto run the frontend. -
The frontend contains some E2E tests written with Cypress. To run these tests:
- If on Linux, install the necessary Cypress dependencies:
$ sudo apt-get install libgtk2.0-0t64 libgtk-3-0t64 libgbm-dev libnotify-dev libnss3 libxss1 libasound2t64 libxtst6 xauth xvfb
- Make sure that the backend server is running.
- Run
npx cypress openin the frontend directory. - Select E2E testing, then either Chrome or Electron.
If you would like to make changes to the MonitoringService code, you will need to update the Docker image. You can do that by running in the MonitoringService folder:
$ dotnet publish --os linux --arch x64 /t:PublishContainerNote that if you are not planning to make changes to its code, you can safely remove the MonitoringService project from the solution in Visual Studio.
-
Install PostgreSQL from this link.
-
Open a terminal in the
/binfolder of the PostgreSQL installation location. -
Run and replace
<DBDIR>with the directory you want to store the database in:
initdb -D <DBDIR>- Start the server with (note that if LOGFILEDIR is the
/binfolder, you will need adminstrator rights):
pg_ctl -D <DBDIR> -l <LOGFILEDIR>/logfile- The default user and database name will be
postgres.
It's possible to not install TimescaleDB. To do so, before running any migrations, comment out these lines from the following files:
- In
SHM_MS/Migrations/20250604031535_Initial.cs, comment out line 64:
migrationBuilder.Sql("SELECT create_hypertable('reports', by_range('timestamp'));");- In
SHM_MS/Migrations/20250610024800_AddDataRetentionPolicy.cs, comment out the entirety of theUpandDownfunction bodies.
It's possible to use .NET 8.0 instead of 9.0. Simply replace net9.0 with net8.0 in the following line in all .csproj files:
<TargetFramework>net9.0</TargetFramework>You will need to downgrade the NuGet package Microsoft.AspNetCore.Diagnostics.EntityFrameworkCore to version 8.
- Interactive, real-time charts from shadcn-ui (in turn from Recharts)
- Widget-like drag and drop and resizing of VM charts (from gridstack.js)
- Intuitive graph network based UI for configuring VM dependencies (from React Flow)
- Light/dark mode
- Dynamically spin up/down Docker containers directly from the frontend