0596f1d9c1
Sweeps README, docs/, example configs, code docstrings, report and notification subject lines, plugin catalog URL default, and stray comments in Dockerfile/entrypoint.sh/.gitignore. Adds a legacy note to docs/core/configuration.md explaining the FABLEDSCRYER_* fallback. docker-compose DB credentials intentionally left as fabledscryer to preserve the existing pgdata volume.
139 lines
5.6 KiB
Markdown
139 lines
5.6 KiB
Markdown
# Code Map
|
|
|
|
Quick reference for where key functions, models, and entry points live in the codebase.
|
|
|
|
---
|
|
|
|
## Application Bootstrap
|
|
|
|
| What | File | Function / Class |
|
|
|---|---|---|
|
|
| App factory | `roundtable/app.py` | `create_app()` |
|
|
| CLI entry point | `roundtable/cli.py` | `main()` |
|
|
| Bootstrap config loading | `roundtable/config.py` | `load_bootstrap()` |
|
|
| Secret key resolution | `roundtable/config.py` | `_resolve_secret_key()` |
|
|
| DB engine init | `roundtable/database.py` | `init_db()` |
|
|
| Core migrations | `roundtable/core/migration_runner.py` | `run_core_migrations()` |
|
|
| Plugin migrations | `roundtable/core/migration_runner.py` | `run_plugin_migrations()` |
|
|
| Core task registration | `roundtable/app.py` | `_register_core_tasks()` |
|
|
| Scheduler loop | `roundtable/core/scheduler.py` | `start_scheduler()` |
|
|
|
|
---
|
|
|
|
## Settings System
|
|
|
|
| What | File | Function |
|
|
|---|---|---|
|
|
| All defaults | `roundtable/core/settings.py` | `DEFAULTS` dict |
|
|
| Read a setting | `roundtable/core/settings.py` | `get_setting(session, key)` |
|
|
| Write a setting | `roundtable/core/settings.py` | `set_setting(session, key, value)` |
|
|
| Read all settings | `roundtable/core/settings.py` | `get_all_settings(session)` |
|
|
| Sync load at startup | `roundtable/core/settings.py` | `load_settings_sync(db_url)` |
|
|
| Extract SMTP dict | `roundtable/core/settings.py` | `to_smtp_cfg(settings)` |
|
|
| Extract webhook dict | `roundtable/core/settings.py` | `to_webhook_cfg(settings)` |
|
|
| Extract Ansible dict | `roundtable/core/settings.py` | `to_ansible_cfg(settings)` |
|
|
| Extract plugins dict | `roundtable/core/settings.py` | `to_plugins_cfg(settings)` |
|
|
|
|
---
|
|
|
|
## Plugin System
|
|
|
|
| What | File | Function |
|
|
|---|---|---|
|
|
| Plugin loading | `roundtable/core/plugin_manager.py` | `load_plugins(app)` |
|
|
| ScheduledTask dataclass | `roundtable/core/scheduler.py` | `ScheduledTask` |
|
|
| Task runner | `roundtable/core/scheduler.py` | `start_scheduler(tasks)` |
|
|
|
|
---
|
|
|
|
## Alert Pipeline
|
|
|
|
| What | File | Function |
|
|
|---|---|---|
|
|
| Write metric + evaluate alerts | `roundtable/core/alerts.py` | `record_metric(session, source_module, resource_name, metric_name, value)` |
|
|
| Init alert pipeline | `roundtable/core/alerts.py` | `init_alerts(app)` |
|
|
| Rule evaluation | `roundtable/core/alerts.py` | `_evaluate_rule()` (internal) |
|
|
| Notification dispatch | `roundtable/core/alerts.py` | `_dispatch_notification()` (internal) |
|
|
| Email + webhook send | `roundtable/core/notifications.py` | `dispatch_notifications()` |
|
|
|
|
---
|
|
|
|
## Monitors
|
|
|
|
| What | File | Function |
|
|
|---|---|---|
|
|
| Ping a host | `roundtable/monitors/ping.py` | `ping_check(host, session)` |
|
|
| DNS check a host | `roundtable/monitors/dns.py` | `dns_check(host, session)` |
|
|
| Data cleanup | `roundtable/core/cleanup.py` | `run_cleanup(app)` |
|
|
|
|
---
|
|
|
|
## Auth
|
|
|
|
| What | File | Function / Class |
|
|
|---|---|---|
|
|
| Role-based access decorator | `roundtable/auth/middleware.py` | `@require_role(UserRole.X)` |
|
|
| Login / session handling | `roundtable/auth/middleware.py` | `login_user()`, `logout_user()` |
|
|
| User count (for first-run) | `roundtable/auth/middleware.py` | `get_user_count(app)` |
|
|
|
|
---
|
|
|
|
## Data Models
|
|
|
|
| Model | File | Table |
|
|
|---|---|---|
|
|
| `Host` | `roundtable/models/hosts.py` | `hosts` |
|
|
| `PingResult` | `roundtable/models/monitors.py` | `ping_results` |
|
|
| `DnsResult` | `roundtable/models/monitors.py` | `dns_results` |
|
|
| `AlertRule` | `roundtable/models/alerts.py` | `alert_rules` |
|
|
| `AlertState` | `roundtable/models/alerts.py` | `alert_states` |
|
|
| `AlertEvent` | `roundtable/models/alerts.py` | `alert_events` |
|
|
| `PluginMetric` | `roundtable/models/metrics.py` | `plugin_metrics` |
|
|
| `AnsibleRun` | `roundtable/models/ansible.py` | `ansible_runs` |
|
|
| `User` | `roundtable/models/users.py` | `users` |
|
|
| `AppSetting` | `roundtable/models/settings.py` | `app_settings` |
|
|
| `TraefikMetric` | `plugins/traefik/models.py` | `traefik_metrics` |
|
|
| SQLAlchemy `Base` | `roundtable/models/base.py` | (shared declarative base) |
|
|
|
|
---
|
|
|
|
## HTTP Routes
|
|
|
|
| URL pattern | Blueprint | File |
|
|
|---|---|---|
|
|
| `/` (dashboard) | `dashboard_bp` | `roundtable/dashboard/routes.py` |
|
|
| `/auth/login`, `/auth/logout` | `auth_bp` | `roundtable/auth/routes.py` |
|
|
| `/hosts/` | `hosts_bp` | `roundtable/hosts/routes.py` |
|
|
| `/ping/`, `/ping/rows`, `/ping/settings` | `ping_bp` | `roundtable/ping/routes.py` |
|
|
| `/dns/`, `/dns/rows` | `dns_bp` | `roundtable/dns/routes.py` |
|
|
| `/alerts/` | `alerts_bp` | `roundtable/alerts/routes.py` |
|
|
| `/ansible/` | `ansible_bp` | `roundtable/ansible/routes.py` |
|
|
| `/settings/` | `settings_bp` | `roundtable/settings/routes.py` |
|
|
| `/plugins/traefik/`, `/plugins/traefik/widget` | `traefik_bp` | `plugins/traefik/routes.py` |
|
|
| `/health` | (inline) | `roundtable/app.py` |
|
|
|
|
---
|
|
|
|
## Templates
|
|
|
|
| Template | Purpose |
|
|
|---|---|
|
|
| `roundtable/templates/base.html` | Layout, navigation, full CSS design system |
|
|
| `roundtable/templates/dashboard/index.html` | Dashboard with stat strip and widget grid |
|
|
| `roundtable/templates/ping/rows.html` | HTMX fragment: ping pill rows (shared by dashboard and /ping/) |
|
|
| `roundtable/templates/ping/index.html` | Full /ping/ page |
|
|
| `roundtable/templates/dns/rows.html` | HTMX fragment: DNS status rows |
|
|
| `roundtable/templates/dns/index.html` | Full /dns/ page |
|
|
| `plugins/traefik/templates/traefik/widget.html` | HTMX fragment: Traefik dashboard widget |
|
|
| `plugins/traefik/templates/traefik/index.html` | Full Traefik detail page |
|
|
|
|
---
|
|
|
|
## Migrations
|
|
|
|
| Location | Covers |
|
|
|---|---|
|
|
| `roundtable/migrations/versions/` | Core schema (hosts, users, monitors, alerts, app_settings) |
|
|
| `plugins/traefik/migrations/versions/` | `traefik_metrics` table |
|
|
| `alembic.ini` | Alembic config; `version_locations` lists all migration directories |
|