How eduvirttul/eduvirt-backend works
Based on our analysis of the project’s complete file tree and the configuration details in the README, the project is a full-fledged Java Spring Boot backend application that primarily acts as a management and orchestration service for an oVirt-based virtualization environment. It is concerned with managing courses, reservations, clusters, teams, and a variety of resource groups. The project is also containerized (using Docker with docker-compose and Dockerfile) and integrates with several external systems, including a PostgreSQL database, oVirt Engine API, Keycloak for authentication, and an SMTP mail server.
Main Components
• Web/API Layer: Represent the REST controllers (e.g., AccessKeyController, ClusterController, CourseController, ReservationController, etc.) that expose endpoints for client interactions. Mark notes for authentication filters (like RefreshTokenFilter) and aspects that handle logging and exception resolution.
• Service Layer: Include the various service packages such as CourseService, ReservationService, VirtualMachineService, and also the oVirt integration services (OVirtClusterService, OVirtHostService, etc.). This layer encapsulates business logic and domain-specific operations.
• Persistence Layer: Highlight repositories (e.g., CourseRepository, ReservationRepository, UserRepository, etc.) combined with JPA entities and Liquibase-managed database schema (configuration/liquibase folder). Indicate the PostgreSQL database connection (via JDBC URL and credentials in environment variables).
• External Integrations:
• Mail Server: Illustrate connection details for sending emails using SMTP. Include configuration aspects (MAIL_HOST, MAIL_PORT, etc.).
• oVirt Engine API: Represent the integration with the oVirt Engine (ENGINE_URL, ENGINE_USERNAME, ENGINE_PASSWORD) where many service calls are routed.
• Keycloak: Show integration for SSO via Keycloak (KEYCLOAK_URL, KEYCLOAK_REALM, etc.).
• Cross-Cutting Concerns: Outline the aspects that intercept exceptions and log information (logging, exception aspects) and the use of JWT for security.
• Docker & Deployment: Add a containerization layer that includes Docker configuration (Dockerfile, docker/compose.yaml, db initialization scripts) to reflect the deployment environment.
• Configuration & Environment: Include the configuration settings read from environment variables (e.g., mail server, database credentials, and various external service endpoints).
Relationships and Data Flow
• That controllers delegate processing to the service layer, which in turn interacts with the persistence layer (repositories) to read/write data.
• References from the service layer to the cross-cutting concerns (aspects for logging/exception handling) to illustrate how these features are “woven” into the flow.
• The persistence layer should clearly connect to an external PostgreSQL database, as initialized with Liquibase scripts.
Architectural Patterns and Design Principles
• The project follows a layered (or n-tier) architecture with distinct responsibilities split between controllers, services, and repositories.
• Use of AOP (Aspect-Oriented Programming) is apparent (for logging and exception handling), which should be represented as an overlay or cross-cutting element applied across several layers.
• Integration patterns for external services, such as REST-based calls to oVirt and Keycloak, are key to the design.
• Containerization and CI/CD integration are emphasized via Docker and GitHub Actions (workflows under .github/workflows).
Relevant Technologies and Frameworks
• Java with Spring Boot is the core framework – show Spring’s role in REST API and dependency injection.
• Maven as the build tool (pom.xml, mvnw scripts).
• PostgreSQL as the database, with Liquibase for schema evolution.
• Docker for containerization.
• Integration with external services using SMTP (for emails), oVirt Engine API (for virtualization), and Keycloak (for authentication/SAML/OAuth flows).
• JWS & JWT mechanism for secure token management.