Skip to main content

Databases

OpenVLE uses three different database systems, each specialized for different tasks: MariaDB for structured core data, MongoDB for activities and logs, and Redis as a task queue and cache.

Overview

DatabaseTypeStored DataPersistence
MariaDBRelational (SQL)Core entities: users, roles, permissions, environments, events, VMs, VM templatesVolume ./mariadb/data
MongoDBDocument-based (NoSQL)Activities, system events, audit logs, change historiesVolume ./mongodb
RedisIn-Memory (Key-Value)Task queue, cache, worker/scheduler communicationAOF persistence (appendonly yes)

MariaDB

MariaDB is the primary database and stores all structured core entities of the system:

  • Users and Roles -- Accounts, role assignments, password hashes
  • Permissions -- Permission definitions and assignments (see Permission System)
  • Environments and Events -- Environments, event schedules, participant assignments
  • VMs and VM Templates -- Virtual machines, their status, and assignment to events
  • System Settings -- Global configuration and settings

Initialization and Migration

On first startup, the backend and worker containers automatically handle database initialization and migration. Which container performs the migration is controlled via a lock mechanism -- the container that acquires the lock first executes the migration. This creates the database schema and initial data (e.g., the default administrator account and default permissions).

MongoDB

MongoDB stores non-relational data that does not require a fixed table structure:

  • Activities -- User actions (e.g., "User X started VM Y") that are displayed in the activity overview of the user interface

Access is exclusively through the backend. MongoDB is not directly accessible from outside.

Redis

Redis does not serve as a traditional database but rather as a communication layer between application components:

  • Task Queue -- The backend enqueues tasks into Redis queues that are processed by the worker (see Task System)
  • Scheduler Queue -- The scheduler places periodic tasks into Redis
  • Cache -- Temporary storage for frequently accessed data

Redis is configured with AOF (Append Only File), so queue data is preserved even after a restart. Access is password-protected.

Separation of Databases

The division into three systems follows the principle of using each database for its area of strength:

RequirementDatabaseRationale
Structured data with relationsMariaDBForeign keys, transactions, ACID guarantees
Flexible, schema-free documentsMongoDBVarying document structures, efficient logging
Fast queue operationsRedisIn-memory speed, native queue support

Further Information