Backend for Resource Optimization Service
The Red Hat Insights resource optimization service enables RHEL customers to assess and monitor their public cloud usage and optimization. The service exposes workload metrics for CPU, memory, and disk-usage and compares them to resource limits recommended by the public cloud provider. Currently ROS only provides suggestions for AWS RHEL instances. To enable ROS, customers need to perform a few prerequisite steps on targeted systems via Ansible playbook.
Underneath, ROS uses Performance Co-Pilot (PCP) to monitor and report workload metrics.
This project uses poetry to manage the development and production environments.
Once you have poetry installed, do the following:
The latest version is supported on Python 3.11, install it and then switch to 3.11 version:
poetry env use python3.11There are some package dependencies, install those:
dnf install tar gzip gcc python3.11-devel libpq-develInstall the required dependencies:
poetry installAfterwards you can activate the virtual environment by running:
poetry shellA list of configurable environment variables is present inside .env.example file.
The application depends on several parts of the insights platform. These dependencies are provided by the
docker-compose.yml file in the scripts directory.
To run the dependencies, just run following command:
cd scripts && docker-compose up insights-inventory-mq db-ros insights-engineTo run the full application ( With ros components within docker)
docker-compose up ros-processor ros-apiIn order to properly run the application from the host machine, you may optionally modify your /etc/hosts file for convenience.
Check the README.md file in scripts directory for details and important networking considerations.
Run the following commands to execute the db migration scripts.
export FLASK_APP=manage.py
flask db upgrade
flask seedThe processor component connects to kafka, and listens on topics for system archive uploads/ system deletion messages.
python -m ros.processor.mainThe web api component provides a REST api view of the app database.
python -m ros.api.mainIt is possible to run the tests using pytest:
poetry install
poetry run pytest --cov=ros testsResource Optimization REST API documentation can be found at /api/ros. It is accessible at raw OpenAPI definition here.
On a local instance it can be accessed on http://localhost:8000/api/ros/v1/openapi.json.
For local development setup, remember to use the x-rh-identity header encoded from account number and org_id, the one used while running make insights-upload-data command.