diff --git a/catalog/component/default/demo-db/README.md b/catalog/component/default/demo-db/README.md new file mode 100644 index 0000000..da166c7 --- /dev/null +++ b/catalog/component/default/demo-db/README.md @@ -0,0 +1,104 @@ +--- +title: "demo-db" +generated_by: documentor-agent +generated_at: "2026-06-08T16:23:01+00:00" +human_edited: false +source_entity: "Component/default/demo-db" +source_repo: "https://gitea.kyndemo.live/validate/petclinic" +--- + +## Overview + +The `demo-db` service is a critical component of the Spring PetClinic application, providing database functionality for the broader system. It supports both in-memory (H2) and persistent database configurations (MySQL and PostgreSQL), enabling flexibility for development and production environments. The service is part of the `petclinic` system and integrates with other platform tools such as OpenTelemetry for observability, K6 for load testing, and Chaos Mesh for chaos engineering. + +This service plays a key role in ensuring data persistence and retrieval for the application, supporting features like user management, veterinary records, and appointment scheduling. It is deployed and managed via ArgoCD in the `demo-apps` namespace, with observability and testing capabilities integrated into the deployment pipeline. + +## Repository + +| Field | Value | +|----------------|-----------------------------------------------------------------------------------------------------------------| +| **Source Repo**| [https://gitea.kyndemo.live/validate/petclinic](https://gitea.kyndemo.live/validate/petclinic) | +| **Branch** | `main` | +| **ArgoCD App** | [petclinic](https://argocd.kyndemo.live/applications/petclinic) | +| **Namespace** | `demo-apps` | + +## Architecture + +The `demo-db` service is designed to support multiple database configurations, including H2 (in-memory), MySQL, and PostgreSQL. It uses Spring Boot profiles to switch between database types, ensuring flexibility for different deployment scenarios. The service integrates with the following platform tools: + +- **OpenTelemetry**: Provides instrumentation for tracing, metrics, and logs, enabling detailed observability. +- **K6**: Facilitates load testing to ensure the service can handle high traffic scenarios. +- **Chaos Mesh**: Enables chaos engineering experiments to test the resilience of the service. + +Data flows from the application layer to the database, with Spring Boot managing the connection and configuration. Persistent databases are supported via Docker containers or local installations, with profiles enabling seamless switching. + +## Configuration + +| Configuration Option | Description | +|----------------------------|-------------------------------------------------------------------------------------------------| +| `spring.profiles.active` | Specifies the active profile (`mysql`, `postgres`, or default for H2). | +| `MYSQL_USER` | MySQL username for the database. | +| `MYSQL_PASSWORD` | MySQL password for the database. | +| `POSTGRES_USER` | PostgreSQL username for the database. | +| `POSTGRES_PASSWORD` | PostgreSQL password for the database. | +| `POSTGRES_DB` | PostgreSQL database name. | + +## 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). + +### Persistent Database Setup + +- **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 + ``` + +### Rollback + +1. Open the [ArgoCD UI](https://argocd.kyndemo.live/applications/petclinic). +2. Click **History and Rollback**. +3. Select the desired revision and click **Rollback**. + +Alternatively, revert the commit in Git and push — ArgoCD will auto-sync the rollback. + +## Observability + +This service is configured with OpenTelemetry instrumentation. Observability data is exported to the OTel Collector and visualized in Grafana. + +- **Grafana Dashboard**: [View Dashboard](https://grafana.kyndemo.live/d/otel-app-observability-v2/opentelemetry-application-observability?orgId=1&var-service=demo-db) +- **Alerting**: Alerts are configured via Grafana with the label selector `app=demo-db`. + +## 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=demo-db) \ No newline at end of file