|
3 | 3 | [](https://github.com/AliceO2Group/WebUi/actions) |
4 | 4 | [](https://codecov.io/gh/AliceO2Group/WebUi) |
5 | 5 |
|
| 6 | +## Contents |
| 7 | + |
6 | 8 | - [InfoLogger GUI (ILG)](#infologger-gui-ilg) |
| 9 | + - [Contents](#contents) |
| 10 | + - [Introduction](#introduction) |
7 | 11 | - [Interface User Guide](#interface-user-guide) |
8 | 12 | - [Requirements](#requirements) |
9 | | - - [Installation](#installation) |
10 | | - - [Dummy InfoLogger test server](#dummy-infologger-test-server) |
11 | | - - [InfoLogger insights](#infologger-insights) |
12 | | - - [Continuous Integration Workflows](#continuous-integration-workflows) |
| 13 | + - [Project Layout](#project-layout) |
| 14 | + - [Backend](#backend) |
| 15 | + - [Frontend](#frontend) |
| 16 | + - [Local Development](#local-development) |
| 17 | + - [First-time setup](#first-time-setup) |
| 18 | + - [Query \& Live mode Against a remote backend (e.g. a staging instance)](#query--live-mode-against-a-remote-backend-eg-a-staging-instance) |
| 19 | + - [Live mode against synthetic logs (thoroughly test Live mode)](#live-mode-against-synthetic-logs-thoroughly-test-live-mode) |
| 20 | + - [Query against a local DB](#query-against-a-local-db) |
| 21 | + - [Testing](#testing) |
| 22 | + - [Integration tests (now run elsewhere)](#integration-tests-now-run-elsewhere) |
| 23 | + - [CI](#ci) |
13 | 24 | - [infologger.yml](#infologgeryml) |
14 | 25 | - [release.yml](#releaseyml) |
| 26 | + - [system-configuration pipeline](#system-configuration-pipeline) |
| 27 | + - [InfoLogger Insights](#infologger-insights) |
| 28 | + |
| 29 | +## Introduction |
15 | 30 |
|
16 | | -Web user interface of [InfoLogger](https://github.com/AliceO2Group/InfoLogger) logging system. |
| 31 | +The Web User Interface for [**ALICE O2 InfoLogger**](https://github.com/AliceO2Group/InfoLogger). The application operates in two distinct modes: |
17 | 32 |
|
18 | | -It interfaces with the system using two modes: |
| 33 | +- **Query** - historical logs from a database. |
| 34 | +- **Live** - real-time logs from a TCP endpoint over the InfoLogger protocol. |
19 | 35 |
|
20 | | -- **Query**: Querying historical logs from a database |
21 | | -- **Live**: Receiving Real-Time logs from a TCP endpoint over InfoLogger protocol (v1.3, v1.4) |
| 36 | +Screenshot of the current interface, running locally against a fake InfoLoggerServer emitting synthetic logs: |
22 | 37 |
|
23 | 38 |  |
24 | 39 |
|
25 | 40 | ## Interface User Guide |
| 41 | + |
26 | 42 | - Use upper panel to: |
27 | | - - match and/or exclude filters (Supports SQL Wildcard `%`) |
| 43 | + - match and/or exclude filters (Supports SQL Wildcard `%`, empty value toggling) |
| 44 | + - control the zoom level of the log table |
28 | 45 | - limit the number of logs displayed |
29 | 46 | - match severity and level |
30 | 47 | - reset the filters |
31 | 48 | - Show/hide columns by clicking on labels on top of page |
32 | 49 | - Click "Query" or "Live" button to start the respective mode |
33 | 50 | - Double click on a log or toggle the inspector view from the bottom right corner to see all fields of the log |
34 | | -- Use arrows keys to navigate quickly between logs |
| 51 | +- Right-click a log to open a context menu with copy / use-as-filter / open inspector actions |
| 52 | +- Use arrow keys to navigate quickly between logs |
35 | 53 | - Download the logs in a file via the top left download icon |
36 | 54 |
|
37 | 55 | ## Requirements |
38 | | -- `nodejs` >= `16.x` |
| 56 | + |
| 57 | +- `nodejs` >= `22.x` |
39 | 58 | - InfoLogger MariaDB database for Query mode |
40 | 59 | - InfoLoggerServer endpoint for Live mode |
41 | 60 |
|
42 | | -## Installation |
43 | | -1. `git clone https://github.com/AliceO2Group/WebUi.git; cd WebUi/InfoLogger` |
44 | | -2. `npm install --prod` |
45 | | -3. `cp config-default.js config.js` |
46 | | -4. Modify `config.js` file to set InfoLogger database and endpoint details |
47 | | -5. Start web app: `npm start` |
48 | | -6. Open browser and navigate to http://localhost:8080 |
49 | | - |
50 | | -## Development database installation |
51 | | -In order to run queries in the InfoLogger a MariaDB server is required. To run a local MariaDB server that can easily be updated/wiped/configured you will need Docker installed. |
52 | | -1. Follow the instructions specific for you platform: [docker desktop install](https://www.docker.com/products/docker-desktop/) |
53 | | -2. Create a `compose.yaml` file somewhere on your pc with the following content: |
54 | | -``` |
55 | | -services: |
56 | | - mariadb: |
57 | | - image: mariadb |
58 | | - restart: unless-stopped |
59 | | - ports: |
60 | | - - 3306:3306 |
61 | | - environment: |
62 | | - MARIADB_ROOT_PASSWORD: root |
63 | | - # (this is just an example, not intended to be a production configuration) |
64 | | - phpmyadmin: |
65 | | - image: phpmyadmin |
66 | | - restart: unless-stopped |
67 | | - ports: |
68 | | - - 9090:80 |
69 | | - environment: |
70 | | - - PMA_HOST=mariadb |
71 | | -``` |
72 | | -This will get you a MariaDB server with phpmyadmin. |
73 | | -Should you ever feel the need to test a specific version of MariaDB then change the image to `mariadb:11.5` where 11.5 is the version. By default the compose.yaml will get you the latest MariaDB image. |
74 | | - |
75 | | -3. Execute the following command in the same directory as the compose.yaml file: `docker compose up -d` this will start the containers and the `-d` parameter makes sure you can close your commandline window by running in daemon mode. |
76 | | -4. You should now be able to visit `http://localhost:9090/` in your browser of choice, enter user and password root to login. |
77 | | -5. Create the `INFOLOGGER` database by clicking `New` in the phpMyAdmin UI on the left side. |
78 | | -6. In the phpMyAdmin UI select `SQL` on the top of the page. Then enter the contents of the `InfoLogger/docs/database-specs.sql` file in the field and pressing the `Go` button. |
79 | | -7. Edit `config.js` to point to your local database: |
80 | | -``` |
81 | | -mysql: { |
82 | | - host: '127.0.0.1', |
83 | | - user: 'root', |
84 | | - password: 'root', |
85 | | - database: 'INFOLOGGER', |
86 | | - port: 3306, |
87 | | - timeout: 60000, |
88 | | - retryMs: 5000, |
89 | | -}, |
| 61 | +## Project Layout |
| 62 | + |
| 63 | +ILG is a Node.js API Gateway and Single-Page Application built on top of the `@aliceo2/web-ui` framework. It serves as a unified interface to two separate operational backends: a **MariaDB database** for historical queries and an **InfoLoggerServer TCP endpoint** for live log streaming. |
| 64 | + |
| 65 | +## Backend |
| 66 | + |
| 67 | +- **Entry point** - [index.js](index.js) starts the `HttpServer` from `@aliceo2/web-ui` and attaches a `WebSocket`. [lib/api.js](lib/api.js) instantiates the services, wires them to the DB and InfoLoggerServer, and registers HTTP routes. Config is loaded by [configProvider.js](lib/configProvider.js). |
| 68 | +- **Query** - `POST /query` and `GET /query/stats` → [QueryController](lib/controller/QueryController.js) → [QueryService](lib/services/QueryService.js). Both routes are gated by [serviceAvailabilityCheck](lib/middleware/serviceAvailabilityCheck.middleware.js). |
| 69 | +- **Live** - [LiveService](lib/services/LiveService.js) wraps `InfoLoggerReceiver`, parses each TCP line per the [InfoLogger protocol](docs/il-protocol.md), and broadcasts to connected clients over WebSocket. |
| 70 | +- **Status / Config** - [StatusController](lib/controller/StatusController.js) reports DB / Server / GUI health; [ConfigController](lib/controller/ConfigController.js) exposes the runtime config to the frontend. |
| 71 | +- **Profiles** - [ProfileService](lib/ProfileService.js) persists per-user column visibility/width to a JSON file ([JSONFileConnector](lib/JSONFileConnector.js)) via `getUserProfile` / `saveUserProfile`. The named-profile endpoint (`getProfile`) is a stub - it returns the hard-coded defaults regardless of the profile requested. |
| 72 | +- **Utilities** - [utils/](lib/utils/) contains the InfoLogger message-command parser, SQL to native error mapping, prepared-statement parsing, and query cancellation. |
| 73 | + |
| 74 | +## Frontend |
| 75 | + |
| 76 | +Static files served from [public/](public/); no build step. A lightweight MVC app on top of `@aliceo2/web-ui`. |
| 77 | + |
| 78 | +- **App shell** - [index.html](public/index.html) bootstraps [index.js](public/index.js), which mounts the top-level [Model](public/Model.js) and renders [view.js](public/view.js). |
| 79 | +- **Sub-models** - [log/Log.js](public/log/Log.js) drives the log table (rendering in `tableLogs*.js`, inspector, status bar, context menu, zoom, etc.). [logFilter/LogFilter.js](public/logFilter/LogFilter.js) owns the filter inputs. [table/Table.js](public/table/Table.js) holds shared table state. |
| 80 | +- **Supporting code** - [services/](public/services/), [constants/](public/constants/), [common/](public/common/), [about/](public/about/) (about component). |
| 81 | +- **Styles** - [app.css](public/app.css), layered on the framework's [bootstrap.css](../Framework/Frontend/css/src/bootstrap.css). |
| 82 | + |
| 83 | +## Local Development |
| 84 | + |
| 85 | +### First-time setup |
| 86 | + |
| 87 | +```bash |
| 88 | +git clone https://github.com/AliceO2Group/WebUi.git |
| 89 | +cd WebUi/InfoLogger |
| 90 | +npm ci |
| 91 | +cp config-default.js config.js |
90 | 92 | ``` |
91 | | -8. Run the InfoLogger and check for the following message in the console: `info: Connection to DB successfully established: 127.0.0.1:3306` |
92 | | - |
93 | | -## Dummy InfoLogger test server |
94 | | -InfoLoggerServer can be simulated by running `npm run simul`. The dummy server binds `localhost:6102` endpoint. |
95 | | -## InfoLogger insights |
96 | | -- [Message protocol](docs/il-protocol.md) |
97 | | -- [Database structure](docs/database-specs.sql) |
98 | | - |
99 | | -## Continuous Integration Workflows |
100 | | -InfoLogger project makes use of two workflows. |
101 | | -### [infologger.yml](./../.github/workflows/infologger.yml) |
102 | | -* Checks that tests of the project are running successfully on two virtual machines: |
103 | | - * `ubuntu` |
104 | | - * `macOS` |
105 | | -* Make sure that the proposed changes are not reducing the current code-coverage percent |
106 | | -* Sends a code coverage report to [CodeCov](https://codecov.io/gh/AliceO2Group/WebUi) |
| 93 | + |
| 94 | +Edit `config.js` for the setup you're using below. |
| 95 | + |
| 96 | +`npm run dev` runs the backend under nodemon. The frontend has no hot reload - refresh the browser to pick up changes. |
| 97 | + |
| 98 | +### Query & Live mode Against a remote backend (e.g. a staging instance) |
| 99 | + |
| 100 | +1. Point `mysql` and `infoLoggerServer` in `config.js` at the remote host and port. |
| 101 | +2. `npm start`, then open [http://localhost:8080](http://localhost:8080). |
| 102 | + |
| 103 | +### Live mode against synthetic logs (thoroughly test Live mode) |
| 104 | + |
| 105 | +The bundled [fake InfoLoggerServer](test/live-simulator/) emits a log every 0-100 ms, shuffling through [test/live-simulator/fakeData.json](test/live-simulator/fakeData.json). |
| 106 | + |
| 107 | +1. Set `infoLoggerServer` in `config.js` to `localhost:6102`. |
| 108 | +2. Terminal 1: `npm run simul`. |
| 109 | +3. Terminal 2: `npm run dev`. |
| 110 | +4. Open [http://localhost:8080](http://localhost:8080) and click **Live**. |
| 111 | + |
| 112 | +### Query against a local DB |
| 113 | + |
| 114 | +Requires [Docker Desktop](https://www.docker.com/products/docker-desktop/). |
| 115 | + |
| 116 | +1. In a working dir, create `compose.yaml`: |
| 117 | + |
| 118 | + ```yaml |
| 119 | + services: |
| 120 | + mariadb: |
| 121 | + image: mariadb |
| 122 | + restart: unless-stopped |
| 123 | + ports: ['3306:3306'] |
| 124 | + environment: |
| 125 | + MARIADB_ROOT_PASSWORD: root # this is just an example, not intended to be a production configuration |
| 126 | + phpmyadmin: |
| 127 | + image: phpmyadmin |
| 128 | + restart: unless-stopped |
| 129 | + ports: ['9090:80'] |
| 130 | + environment: |
| 131 | + - PMA_HOST=mariadb |
| 132 | + ``` |
| 133 | +
|
| 134 | + Gives you a MariaDB server with phpMyAdmin on the latest image. Pin a specific version (e.g. `mariadb:11.5`) by changing the `image:` tag. |
| 135 | + |
| 136 | +2. `docker compose up -d`. |
| 137 | +3. Open [http://localhost:9090/](http://localhost:9090/) → log in `root` / `root` → **New** → create database `INFOLOGGER`. |
| 138 | +4. Open the **SQL** tab, paste [docs/database-specs.sql](docs/database-specs.sql), click **Go**. |
| 139 | +5. In `config.js`: |
| 140 | + |
| 141 | + ```js |
| 142 | + mysql: { |
| 143 | + host: '127.0.0.1', |
| 144 | + user: 'root', |
| 145 | + password: 'root', |
| 146 | + database: 'INFOLOGGER', |
| 147 | + port: 3306, |
| 148 | + timeout: 60000, |
| 149 | + retryMs: 5000, |
| 150 | + }, |
| 151 | + ``` |
| 152 | + |
| 153 | +6. `npm run dev` - startup should log `Connection to DB successfully established: 127.0.0.1:3306`. |
| 154 | + |
| 155 | +## Testing |
| 156 | + |
| 157 | +- `npm test` - eslint + mocha. `npm run mocha` runs the suite alone. |
| 158 | + - Backend tests: [test/lib/](test/lib). |
| 159 | + - Frontend tests: [test/public/](test/public). |
| 160 | + - Add or update the matching test when fixing a bug. |
| 161 | +- `npm run eslint` - config in [eslint.config.js](eslint.config.js). Lint failures block CI. |
| 162 | + |
| 163 | +### Integration tests (now run elsewhere) |
| 164 | + |
| 165 | +ILG integration tests live in the **system-configuration** repo and run in its pipeline against a pipeline ILG. They are **not** executed by this repo's CI. To run them locally, clone system-configuration and run `npx mocha ilg-main.js`. |
| 166 | + |
| 167 | +> ⚠️ Files under [test/integration/](test/integration) here are a historical FLP-Suite copy, unmaintained for years. If you change behaviour covered by integration tests, update the system-configuration suite during the next ILG release. |
| 168 | + |
| 169 | +## CI |
| 170 | + |
| 171 | +### [infologger.yml](../.github/workflows/infologger.yml) |
| 172 | + |
| 173 | +Runs on every PR touching `InfoLogger/**`. Must pass to merge: |
| 174 | + |
| 175 | +- `npm test` (eslint + mocha) on `ubuntu-latest`. |
| 176 | +- `npm run coverage` with a CodeCov report; **coverage cannot decrease**. |
107 | 177 |
|
108 | 178 | ### [release.yml](../.github/workflows/release.yml) |
109 | | -* Releases a new version of the project to the [NPM Registry](npmjs.com/) under the tag [@aliceo2/infologger](https://www.npmjs.com/package/@aliceo2/infologger) |
110 | | -* Builds a `tgz` file which contains an archive of the project. This can be used for local repositories installations. |
| 179 | + |
| 180 | +- Publishes a new version to the [NPM Registry](https://www.npmjs.com/) under [@aliceo2/infologger](https://www.npmjs.com/package/@aliceo2/infologger). |
| 181 | +- Builds a `tgz` archive of the project for local-repository installations. |
| 182 | + |
| 183 | +### [system-configuration pipeline](https://gitlab.cern.ch/AliceO2Group/system-configuration) |
| 184 | + |
| 185 | +Runs the integration suite against a pipeline instance. Runs separately from this repo's CI, so run the suite locally before merging and flag any required changes to the team at release time. |
| 186 | + |
| 187 | +## InfoLogger Insights |
| 188 | + |
| 189 | +- [InfoLogger message protocol](docs/il-protocol.md) |
| 190 | +- [Database schema](docs/database-specs.sql) |
0 commit comments