Update README and environment configuration for Watcher Visio
All checks were successful
CI / ci (push) Successful in 14s

- Renamed the project from "SWatcher" to "Watcher Visio" in the README for clarity.
- Added new environment variables `WATCHER_ENDPOINT_NAME` and `WATCHER_INTERFACE_NAME` to `.env.example` for Watcher service configuration.
- Updated documentation to reflect the new cache TTL settings for dashboard statistics and source status.
- Introduced a new CI section in the README to outline the pipeline configurations for continuous integration.
This commit is contained in:
2026-02-12 23:26:43 +03:00
parent d4fc2e920f
commit b5e9b032d7
3 changed files with 22 additions and 2 deletions

View File

@@ -6,4 +6,9 @@
# PROMETHEUS_URL=http://127.0.0.1:1234/ # PROMETHEUS_URL=http://127.0.0.1:1234/
# OPENSTACK_CLOUD=distlab # OPENSTACK_CLOUD=distlab
# OPENSTACK_REGION_NAME=cl2k1distlab # OPENSTACK_REGION_NAME=cl2k1distlab
# WATCHER_ENDPOINT_NAME=infra-optim
# WATCHER_INTERFACE_NAME=public
# SECRET_KEY=your-secret-key # SECRET_KEY=your-secret-key
# Optional cache TTL (seconds); defaults in watcher_visio/settings.py
# DASHBOARD_CACHE_TTL=120
# SOURCE_STATUS_CACHE_TTL=30

View File

@@ -5,7 +5,7 @@
[![Python 3.12+](https://img.shields.io/badge/python-3.12+-blue.svg)](https://www.python.org/downloads/) [![Python 3.12+](https://img.shields.io/badge/python-3.12+-blue.svg)](https://www.python.org/downloads/)
[![Django 5.2](https://img.shields.io/badge/django-5.2-green.svg)](https://www.djangoproject.com/) [![Django 5.2](https://img.shields.io/badge/django-5.2-green.svg)](https://www.djangoproject.com/)
SWatcher is a web dashboard for OpenStack operators. It shows region and host counts, physical/virtual CPU and RAM usage, VM statistics, top flavors, and OpenStack Watcher audit results with migration recommendations and CPU load charts per host. Data is pulled from OpenStack (SDK and Watcher API) and Prometheus (node_exporter, libvirt, placement metrics). Watcher Visio is a web dashboard for OpenStack operators. It shows region and host counts, physical/virtual CPU and RAM usage, VM statistics, top flavors, and OpenStack Watcher audit results with migration recommendations and CPU load charts per host. Data is pulled from OpenStack (SDK and Watcher API) and Prometheus (node_exporter, libvirt, placement metrics).
--- ---
@@ -20,6 +20,7 @@ SWatcher is a web dashboard for OpenStack operators. It shows region and host co
- [Project structure](#project-structure) - [Project structure](#project-structure)
- [Architecture](#architecture) - [Architecture](#architecture)
- [Running tests](#running-tests) - [Running tests](#running-tests)
- [CI](#ci)
--- ---
@@ -48,8 +49,10 @@ Copy [.env.example](.env.example) to `.env` and set as needed. For Docker Compos
| `OPENSTACK_REGION_NAME` | OpenStack region (e.g. `cl2k1distlab`). | | `OPENSTACK_REGION_NAME` | OpenStack region (e.g. `cl2k1distlab`). |
| `USE_MOCK_DATA` | Set to `true`/`1`/`yes` to serve mock data (no OpenStack/Prometheus). Useful for local/dev. | | `USE_MOCK_DATA` | Set to `true`/`1`/`yes` to serve mock data (no OpenStack/Prometheus). Useful for local/dev. |
| `SECRET_KEY` | Django secret key; override in production. | | `SECRET_KEY` | Django secret key; override in production. |
| `WATCHER_ENDPOINT_NAME` | Watcher service type (default: `infra-optim`). |
| `WATCHER_INTERFACE_NAME` | Watcher API interface (default: `public`). |
Defaults for Prometheus and OpenStack are in [watcher_visio/settings.py](watcher_visio/settings.py). Defaults for Prometheus, OpenStack, and Watcher are in [watcher_visio/settings.py](watcher_visio/settings.py). Cache TTLs: `DASHBOARD_CACHE_TTL` (120 s) for stats/audits, `SOURCE_STATUS_CACHE_TTL` (30 s) for source-status; override in settings if needed.
### OpenStack (`clouds.yaml`) ### OpenStack (`clouds.yaml`)
@@ -121,6 +124,7 @@ Source: [static/css/main.css](static/css/main.css). Output: `static/css/output.c
| `GET /` | Dashboard page. With `USE_MOCK_DATA=true`, rendered with mock context; otherwise skeleton, with data loaded via the API. | | `GET /` | Dashboard page. With `USE_MOCK_DATA=true`, rendered with mock context; otherwise skeleton, with data loaded via the API. |
| `GET /api/stats/` | JSON: region, pCPU/vCPU, pRAM/vRAM, VM stats, top flavors. Cached for `DASHBOARD_CACHE_TTL` seconds (see settings). | | `GET /api/stats/` | JSON: region, pCPU/vCPU, pRAM/vRAM, VM stats, top flavors. Cached for `DASHBOARD_CACHE_TTL` seconds (see settings). |
| `GET /api/audits/` | JSON: `{ "audits": [ ... ] }` — list of Watcher audits with migrations and chart data (host labels, cpu_current, cpu_projected). Same cache TTL. | | `GET /api/audits/` | JSON: `{ "audits": [ ... ] }` — list of Watcher audits with migrations and chart data (host labels, cpu_current, cpu_projected). Same cache TTL. |
| `GET /api/source-status/` | JSON: status of data sources (Prometheus, OpenStack) — `ok` / `error` / `mock` per source. Cached for `SOURCE_STATUS_CACHE_TTL` seconds (see settings). |
--- ---
@@ -195,3 +199,12 @@ docker compose -f docker-compose.yml -f docker-compose.dev.yml run --rm watcher-
``` ```
With the base compose only, the container uses the code baked into the image at build time. After code or test changes, either rebuild the image or use the dev override above so tests see the latest files. With the base compose only, the container uses the code baked into the image at build time. After code or test changes, either rebuild the image or use the dev override above so tests see the latest files.
---
## CI
Pipelines are in [.gitea/workflows/](.gitea/workflows/):
- **ci.yml** — on push/PR to `main` and `develop`: set up Python 3.12, install dependencies, run Ruff lint, `python manage.py test dashboard`, and Bandit security check.
- **docker-build.yml** — on push to `main`: build Docker image, push to Gitea Container Registry, create a release with a version tag.

View File

@@ -78,3 +78,5 @@ Returns:
- `CACHE_KEY_AUDITS` — serialized audits list - `CACHE_KEY_AUDITS` — serialized audits list
- `CACHE_KEY_CURRENT_CLUSTER` — raw current_cluster (host_labels, cpu_current lists) - `CACHE_KEY_CURRENT_CLUSTER` — raw current_cluster (host_labels, cpu_current lists)
- `CACHE_KEY_SOURCE_STATUS` — source status result - `CACHE_KEY_SOURCE_STATUS` — source status result
TTL for stats and audits is set by `DASHBOARD_CACHE_TTL` in `watcher_visio/settings.py` (default 120 s). TTL for source-status is set by `SOURCE_STATUS_CACHE_TTL` (default 30 s).