--- title: "Petclinic Service" generated_by: documentor-agent generated_at: "2026-06-08T16:23:20+00:00" human_edited: false source_entity: "Component/default/petclinic" source_repo: "https://gitea.kyndemo.live/validate/petclinic" --- ## Overview The Petclinic service is a Spring Boot application designed to manage veterinary clinic operations, including scheduling appointments, managing pet records, and handling customer information. It serves as a foundational component of the broader Petclinic system, providing essential business logic and data management capabilities. This service is deployed in the `demo-apps` namespace and managed via ArgoCD. It integrates with OpenTelemetry for observability, supports load testing via k6, and includes chaos engineering capabilities through Chaos Mesh. The application is built using Java 17 and can be run locally or deployed in containerized environments. ## Repository | Field | Value | |----------------|-----------------------------------------------------------------------------------------------------------------| | **Source Repo**| [Petclinic Repository](https://gitea.kyndemo.live/validate/petclinic) | | **Branch** | `main` | | **ArgoCD App** | [petclinic](https://argocd.kyndemo.live/applications/petclinic) | | **Namespace** | `demo-apps` | ## Architecture The Petclinic service is a Spring Boot application that communicates with an in-memory H2 database by default. It supports integration with MySQL and PostgreSQL for persistent storage, configurable via Spring profiles. The service is instrumented with OpenTelemetry for tracing and metrics, and its deployment is managed by ArgoCD, ensuring continuous synchronization with the source repository. Key architectural components: - **Spring Boot Framework**: Provides the application runtime and dependency management. - **Database Options**: Default H2 database, with optional MySQL or PostgreSQL configurations. - **Observability**: OpenTelemetry instrumentation for metrics, traces, and logs. - **Deployment**: Managed via ArgoCD in the `demo-apps` namespace. ## Configuration | Configuration Option | Description | |----------------------------|-------------------------------------------------------------------------------------------------| | `spring.profiles.active` | Sets the active Spring profile (`mysql`, `postgres`, or default for H2). | | `MYSQL_USER` | MySQL username for database connection. | | `MYSQL_PASSWORD` | MySQL password for database connection. | | `POSTGRES_USER` | PostgreSQL username for database connection. | | `POSTGRES_PASSWORD` | PostgreSQL password for database connection. | ## Operations ### Running Locally 1. Clone the repository: ```bash git clone https://gitea.kyndemo.live/validate/petclinic.git cd petclinic ``` 2. Start the application: - Using Maven: ```bash ./mvnw spring-boot:run ``` - Using Gradle: ```bash ./gradlew bootRun ``` 3. Access the application at [http://localhost:8080](http://localhost:8080). ### Container Deployment 1. Build the container image: ```bash ./mvnw spring-boot:build-image ``` 2. Run the container: ```bash docker run -p 8080:8080 docker.io/library/spring-petclinic:latest ``` ### Database Configuration - Default: In-memory H2 database. - MySQL: ```bash docker run -e MYSQL_USER=petclinic -e MYSQL_PASSWORD=petclinic -e MYSQL_ROOT_PASSWORD=root -e MYSQL_DATABASE=petclinic -p 3306:3306 mysql:9.6 ``` - PostgreSQL: ```bash docker run -e POSTGRES_USER=petclinic -e POSTGRES_PASSWORD=petclinic -e POSTGRES_DB=petclinic -p 5432:5432 postgres:18.3 ``` ## Observability The Petclinic service is fully instrumented with OpenTelemetry for observability. Metrics, traces, and logs are exported to the OTel Collector and visualized in Grafana. - **Grafana Dashboard**: [Petclinic Observability](https://grafana.kyndemo.live/d/otel-app-observability-v2/opentelemetry-application-observability?orgId=1&var-service=petclinic) - **Alerting**: Configured via Grafana with label selector `app=petclinic`. ## Dependencies - `component:default/argocd-service` - `resource:default/k6-operator` - `resource:default/otel-collector` - `resource:default/veterinary-platform` ## Links - [Live Application](https://petclinic.kyndemo.live) - [Repository](https://gitea.kyndemo.live/validate/petclinic) - [ArgoCD App](https://argocd.kyndemo.live/applications/petclinic) - [Grafana Dashboard](https://grafana.kyndemo.live/d/otel-app-observability-v2/opentelemetry-application-observability?orgId=1&var-service=petclinic)