Skip to main content
Version: Next 🚧

Deviser Overview

Deviser is a specialized maintenance service within the Krateo Composable Portal (KCP) backend. Its primary responsibility is to manage the lifecycle, partitions, and data retention of the PostgreSQL databases used by Krateo.

Key Responsibilities​

  • PostgreSQL Partition Management: Automatically creates and maintains daily partitions for time-series data (e.g., resources and events), ensuring optimal query performance.
  • Data Retention & Quotas: Enforces retention policies by dropping expired partitions and managing storage quotas.
  • Soft-Delete Purge: Periodically performs hard-deletes of resources marked as soft-deleted in the krateo_resources table.
  • Database Readiness: Ensures the database schema is correctly applied and ready for use by other KCP components at startup.

How it works​

Deviser Flow

Deviser runs a scheduled main loop that performs the following routine:

  1. DB Connect: Checks connectivity to the PostgreSQL instance.
  2. Schema Check: Validates and applies required SQL schemas.
  3. Partition Ensure: Creates partitions for a configured number of days ahead.
  4. Partition Maintenance: Drops old partitions based on expiration or storage quotas.
  5. Soft-Delete Purge: Cleans up resources that have been marked for deletion.

Technical Reference​

Environment Variables​

NameDescriptionDefault
PORTService port for health probes (/livez, /readyz)8081
DB_HOSTDatabase hostlocalhost
DB_PORTDatabase port5432
DB_NAMEDatabase name-
DB_USERDatabase username-
DB_PASSDatabase password-
DB_PARTITIONS_DAYSNumber of days ahead to create partitions7
PM_MAX_PARTITIONS_SIZEMaximum allowed total size of all partitions10GB
PM_RETENTION_DAYSNumber of days to retain partitions2
PM_TRIGGER_RATIOFraction of max size to trigger cleanup0.75
PM_DRY_RUNIf true, cleanup actions are logged but not executedfalse
OTEL_ENABLEDEnable OpenTelemetry metrics exportertrue

Documentation​