more index cleanups to optimise space
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
2026-02-08 15:40:42 +11:00
parent a993aedf79
commit c66679a71f
13 changed files with 590 additions and 61 deletions

View File

@@ -53,7 +53,7 @@ Monthly summary rows keep the same aggregate fields as daily summaries and recom
The RPM installs the service and defaults under `/usr/bin`, config under `/etc/dtms`, and data under `/var/lib/vctp`:
- Binary: `/usr/bin/vctp-linux-amd64`
- Systemd unit: `/etc/systemd/system/vctp.service`
- Defaults/env: `/etc/dtms/vctp.yml` (override with `-settings`), `/etc/default/vctp` (environment)
- Defaults/config: `/etc/dtms/vctp.yml` (override with `-settings`), `/etc/default/vctp` (optional env flags)
- TLS cert/key: `/etc/dtms/vctp.crt` and `/etc/dtms/vctp.key` (generated if absent)
- Data: SQLite DB and reports default to `/var/lib/vctp` (reports under `/var/lib/vctp/reports`)
- Scripts: preinstall/postinstall handle directory creation and permissions.
@@ -84,7 +84,7 @@ vctp -settings /path/to/vctp.yml -db-cleanup
By default the app uses SQLite and creates/opens `db.sqlite3`.
PostgreSQL support is currently **experimental** and not a production target. To enable it,
set `VCTP_ENABLE_EXPERIMENTAL_POSTGRES=1` and update the settings file:
set `settings.enable_experimental_postgres: true` in the settings file:
- `settings.database_driver`: `sqlite` (default) or `postgres` (experimental)
- `settings.database_url`: SQLite file path/DSN or PostgreSQL DSN
@@ -93,10 +93,12 @@ Examples:
```yaml
settings:
database_driver: sqlite
enable_experimental_postgres: false
database_url: ./db.sqlite3
settings:
database_driver: postgres
enable_experimental_postgres: true
database_url: postgres://user:pass@localhost:5432/vctp?sslmode=disable
```
@@ -110,12 +112,10 @@ Hourly and daily snapshot table retention can be configured in the settings file
- `settings.daily_snapshot_max_age_months` (default: 12)
## Runtime Environment Flags
These flags are read from the process environment (for example via `/etc/default/vctp` on systemd installs):
These optional flags are read from the process environment (for example via `/etc/default/vctp`):
- `VCTP_ENCRYPTION_KEY`: optional explicit key source for credential encryption/decryption.
Recommended for stable behavior across host migrations/rebuilds.
- `VCTP_ENABLE_EXPERIMENTAL_POSTGRES`: set to `1` to enable experimental PostgreSQL driver startup.
- `VCTP_ENABLE_LEGACY_API`: set to `1` to re-enable deprecated legacy API endpoints temporarily.
- `DAILY_AGG_GO`: set to `1` (default in `src/vctp.default`) to use the Go daily aggregation path.
- `MONTHLY_AGG_GO`: set to `1` (default in `src/vctp.default`) to use the Go monthly aggregation path.
## Credential Encryption Lifecycle
At startup, vCTP resolves `settings.vcenter_password` using this order:
@@ -132,7 +132,7 @@ Behavior notes:
- Legacy encrypted values can still be migrated forward automatically.
## Deprecated API Endpoints
These endpoints are considered legacy and are disabled by default unless `VCTP_ENABLE_LEGACY_API=1`:
These endpoints are considered legacy and are disabled by default unless `settings.enable_legacy_api: true`:
- `/api/event/vm/create`
- `/api/event/vm/modify`
@@ -151,7 +151,8 @@ General:
- `settings.log_output`: log format, `text` or `json`
Database:
- `settings.database_driver`: `sqlite` or `postgres` (experimental; requires `VCTP_ENABLE_EXPERIMENTAL_POSTGRES=1`)
- `settings.database_driver`: `sqlite` or `postgres` (experimental)
- `settings.enable_experimental_postgres`: set `true` to allow PostgreSQL startup
- `settings.database_url`: SQLite file path/DSN or PostgreSQL DSN
HTTP/TLS:
@@ -162,9 +163,12 @@ HTTP/TLS:
- `settings.tls_key_filename`: PEM private key path (TLS mode)
vCenter:
- `settings.encryption_key`: optional explicit key source for credential encryption/decryption.
If unset, vCTP derives a host key from hardware/host identity.
- `settings.vcenter_username`: vCenter username
- `settings.vcenter_password`: vCenter password (auto-encrypted on startup if plaintext length > 2)
- `settings.vcenter_insecure`: `true` to skip TLS verification
- `settings.enable_legacy_api`: set `true` to temporarily re-enable deprecated legacy endpoints
- `settings.vcenter_event_polling_seconds`: deprecated and ignored
- `settings.vcenter_inventory_polling_seconds`: deprecated and ignored
- `settings.vcenter_inventory_snapshot_seconds`: hourly snapshot cadence (seconds)
@@ -172,14 +176,13 @@ vCenter:
- `settings.vcenter_addresses`: list of vCenter SDK URLs to monitor
Credential encryption:
- `VCTP_ENCRYPTION_KEY`: optional environment variable used to derive the encryption key.
If unset, vCTP derives a host key from hardware/host identity.
- New encrypted values are written with `enc:v1:` prefix.
Snapshots:
- `settings.hourly_snapshot_concurrency`: max concurrent vCenter snapshots (0 = unlimited)
- `settings.hourly_snapshot_max_age_days`: retention for hourly tables
- `settings.daily_snapshot_max_age_months`: retention for daily tables
- `settings.hourly_index_max_age_days`: age gate for keeping per-hourly-table indexes (`-1` disables cleanup, `0` trims all)
- `settings.snapshot_cleanup_cron`: cron expression for cleanup job
- `settings.reports_dir`: directory to store generated XLSX reports (default: `/var/lib/vctp/reports`)
- `settings.hourly_snapshot_retry_seconds`: interval for retrying failed hourly snapshots (default: 300 seconds)