Nathan Coad 434c7136e9
All checks were successful
continuous-integration/drone/push Build is passing
more optimisation
2026-01-14 21:30:10 +11:00
2026-01-14 21:30:10 +11:00
2026-01-14 09:28:30 +11:00
2026-01-14 09:28:30 +11:00
2026-01-14 21:30:10 +11:00
2026-01-14 09:28:30 +11:00
2026-01-14 10:30:29 +11:00
2026-01-14 21:30:10 +11:00
2024-09-12 08:57:44 +10:00
2024-09-12 08:57:44 +10:00
2026-01-14 09:28:30 +11:00
2024-09-12 08:57:44 +10:00
2026-01-14 09:28:30 +11:00
2026-01-14 09:28:30 +11:00
2024-09-12 12:47:10 +10:00
2026-01-14 15:08:59 +11:00
2026-01-13 20:09:19 +11:00
2024-09-12 08:57:44 +10:00
2024-09-12 08:57:44 +10:00
2024-09-12 08:57:44 +10:00
2024-09-12 08:57:44 +10:00
2024-09-12 08:57:44 +10:00
2026-01-14 15:16:31 +11:00

Initial setup

Pre-requisite tools

go install github.com/a-h/templ/cmd/templ@latest
go install github.com/sqlc-dev/sqlc/cmd/sqlc@latest
go install github.com/swaggo/swag/cmd/swag@latest

Database

This project now uses goose for DB migrations.

Install via brew install goose on a mac, or install via golang with command go install github.com/pressly/goose/v3/cmd/goose@latest

Create a new up/down migration file with this command

goose -dir db/migrations sqlite3 ./db.sqlite3 create init sql
sqlc generate

HTML templates

Run templ generate -path ./components to generate code based on template files

Documentation

Run swag init --exclude "pkg.mod,pkg.build,pkg.tools" -o server/router/docs

Settings File

Configuration now lives in the YAML settings file. By default the service reads /etc/dtms/vctp.yml, or you can override it with the -settings flag.

vctp -settings /path/to/vctp.yml

Database Configuration

By default the app uses SQLite and creates/opens db.sqlite3. You can opt into PostgreSQL by updating the settings file:

  • settings.database_driver: sqlite (default) or postgres
  • settings.database_url: SQLite file path/DSN or PostgreSQL DSN

Examples:

settings:
  database_driver: sqlite
  database_url: ./db.sqlite3

settings:
  database_driver: postgres
  database_url: postgres://user:pass@localhost:5432/vctp?sslmode=disable

PostgreSQL migrations live in db/migrations_postgres, while SQLite migrations remain in db/migrations.

Snapshot Retention

Hourly and daily snapshot table retention can be configured in the settings file:

  • settings.hourly_snapshot_max_age_days (default: 60)
  • settings.daily_snapshot_max_age_months (default: 12)

Settings Reference

All configuration lives under the top-level settings: key in vctp.yml.

General:

  • settings.log_level: logging verbosity (e.g., debug, info, warn, error)
  • settings.log_output: log format, text or json

Database:

  • settings.database_driver: sqlite or postgres
  • settings.database_url: SQLite file path/DSN or PostgreSQL DSN

HTTP/TLS:

  • settings.bind_ip: IP address to bind the HTTP server
  • settings.bind_port: TCP port to bind the HTTP server
  • settings.bind_disable_tls: true to serve plain HTTP (no TLS)
  • settings.tls_cert_filename: PEM certificate path (TLS mode)
  • settings.tls_key_filename: PEM private key path (TLS mode)

vCenter:

  • settings.vcenter_username: vCenter username
  • settings.vcenter_password: vCenter password (encrypted at startup)
  • settings.vcenter_insecure: true to skip TLS verification
  • settings.vcenter_event_polling_seconds: event polling interval (0 disables)
  • settings.vcenter_inventory_polling_seconds: inventory polling interval (0 disables)
  • settings.vcenter_inventory_snapshot_seconds: hourly snapshot cadence (seconds)
  • settings.vcenter_inventory_aggregate_seconds: daily aggregation cadence (seconds)
  • settings.vcenter_addresses: list of vCenter SDK URLs to monitor

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.snapshot_cleanup_cron: cron expression for cleanup job

Filters/chargeback:

  • settings.tenants_to_filter: list of tenant name patterns to exclude
  • settings.node_charge_clusters: list of cluster name patterns for node chargeback
  • settings.srm_activeactive_vms: list of SRM Active/Active VM name patterns
Description
No description provided
Readme 15 MiB
Languages
Go 92.1%
templ 5.4%
Shell 2%
Dockerfile 0.2%
Makefile 0.2%