Centralized configuration management for Prometheus management for Cloud VPS projects

Clone this repo:

Branches

  1. c2b32b6 maintain-projects: Fix typo in variable name by Taavi Väänänen · 7 months ago master
  2. fc036ae Fix support for keystone projects where name is not equal to ID by Taavi Väänänen · 7 months ago
  3. 7f7b71b migrations: Re-format with latest black by Taavi Väänänen · 7 months ago
  4. a9eabda Relicense as AGPL-3.0-only by Taavi Väänänen · 10 months ago
  5. a56277e remove unnecessary workaround from migration by Taavi Väänänen · 1 year, 2 months ago

prometheus-manager

Centralized configuration management and storage for prometheus-configurator.

how-to

Setup local development environment

Export the path to the devel config (from the root of this repository):

$ export PROMETHEUS_MANAGER_CONFIG_PATH=$PWD/config.example.yaml

Start the mariadb instance using docker-compose:

$ docker compose up -d

Wait a few seconds, and then we need to create the non-admin user:

$ mariadb -h 127.0.0.1 --user=root --password=root -e "grant all privileges on prometheusconfig.* to 'prometheusconfig'@'%' identified by 'prometheusconfig';"

Now we can run the migrations to populate the database:

$ python3 scripts/pm-migrate
INFO  [alembic.runtime.migration] Context impl MySQLImpl.
INFO  [alembic.runtime.migration] Will assume non-transactional DDL.
INFO  [alembic.runtime.migration] Running upgrade  -> 639f4dd7f8c4, create projects table
...

Run the service:

$ flask run
 * Environment: production
   WARNING: This is a development server. Do not use it in a production deployment.
   Use a production WSGI server instead.
 * Debug mode: off
WARNING: This is a development server. Do not use it in a production deployment. Use a production WSGI server instead.
 * Running on http://127.0.0.1:5000

Create new database migrations

$ python3 scripts/pm-interactive
--- prometheus-manager interactive shell ---
>>> from prometheus_manager.database import alembic
>>> alembic.revision("create projects table")
INFO  [alembic.runtime.migration] Context impl MySQLImpl.
INFO  [alembic.runtime.migration] Will assume non-transactional DDL.
INFO  [alembic.autogenerate.compare] Detected added table 'projects'
  Generating /home/taavi/src/prometheus-manager/prometheus_manager/migrations/639f4dd7f8c4_create_projects_table.py ...  done
[Script('639f4dd7f8c4', None, branch_labels={'default'})]
>>>
now exiting InteractiveConsole...

$ python3 scripts/pm-migrate
INFO  [alembic.runtime.migration] Context impl MySQLImpl.
INFO  [alembic.runtime.migration] Will assume non-transactional DDL.
INFO  [alembic.runtime.migration] Running upgrade  -> 639f4dd7f8c4, create projects table

  NODES
HOME 1
os 3
server 4
text 3