A Mirror of Spring's PetClinic
Find a file
2025-04-11 09:34:20 +01:00
.devcontainer Add a Dockerfile for dev environments other than codespaces 2024-11-28 14:45:59 +00:00
.github added project key and org key to sonar.yml 2025-04-11 09:34:20 +01:00
.mvn/wrapper Update maven and gradle wrapper 2024-09-30 21:41:01 +01:00
gradle/wrapper Update maven and gradle wrapper 2024-09-30 21:41:01 +01:00
k8s Add Kubernetes support 2024-11-08 09:23:59 +00:00
performance-tests Initial setup of CI/CD pipeline for Spring PetClinic 2025-04-11 08:35:37 +01:00
src Use the java.util List.of() instead of the AssetJ Lists class 2025-03-26 08:52:01 +00:00
terraform Initial setup of CI/CD pipeline for Spring PetClinic 2025-04-11 08:35:37 +01:00
.editorconfig Add Gradle files indentation to .editorconfig 2024-02-20 17:14:43 +00:00
.gitattributes Gradle wrapper files should have correct line endings 2024-02-29 14:35:20 +00:00
.gitignore Update Spring Boot release, adding Gradle build and cleanup 2024-11-05 12:56:29 +00:00
.gitpod.yml Add devcontainer and gitpod 2022-06-09 11:24:17 +01:00
build.gradle Update Spring Boot to 3.4.2 2025-02-04 08:47:30 +00:00
docker-compose.yml Fix occasional stale volume in postgres tests 2024-11-28 14:40:54 +00:00
Dockerfile Initial setup of CI/CD pipeline for Spring PetClinic 2025-04-11 08:35:37 +01:00
gradlew Update maven and gradle wrapper 2024-09-30 21:41:01 +01:00
gradlew.bat Update maven and gradle wrapper 2024-09-30 21:41:01 +01:00
jmeter.log Initial setup of CI/CD pipeline for Spring PetClinic 2025-04-11 08:35:37 +01:00
LICENSE.txt Add license file 2021-10-05 16:49:36 +01:00
mvnw Upgrade to Maven 3.9.7 2024-05-26 20:17:34 +02:00
mvnw.cmd Upgrade to Maven 3.9.7 2024-05-26 20:17:34 +02:00
pom.xml Update Spring Boot to 3.4.2 2025-02-04 08:47:30 +00:00
README.md Initial setup of CI/CD pipeline for Spring PetClinic 2025-04-11 08:35:37 +01:00
settings.gradle Make build work with Gradle 2021-12-16 11:25:09 +00:00

Advanced CI/CD Pipeline for Spring PetClinic

This repository demonstrates a comprehensive CI/CD pipeline for the Spring PetClinic application, showcasing DevOps best practices for enterprise applications.

Architecture Overview

CI/CD Pipeline Architecture

The CI/CD pipeline implements a fully automated workflow from code commit to production deployment, with the following components:

  • Source Control: GitHub repository with branch protection rules
  • CI Pipeline: GitHub Actions for building, testing, and scanning
  • Security Scanning: SonarCloud, OWASP Dependency Check, Trivy, and ZAP
  • Infrastructure as Code: Terraform for provisioning AWS resources
  • Containerization: Docker for application packaging
  • Container Registry: Amazon ECR for storing Docker images
  • Deployment Targets: ECS clusters for dev, staging, and production environments
  • Performance Testing: JMeter for load and performance testing
  • Approval Workflows: Manual approvals for production deployments
  • Notifications: Slack integration for deployment notifications

Pipeline Workflow

  1. Code Commit:

    • Developer pushes code to a feature branch
    • Pull request is created for review
  2. CI Process:

    • Automated build and unit tests
    • Code quality and security scanning
    • Integration tests
  3. Artifact Creation:

    • Docker image is built and tagged
    • Image is pushed to ECR repository
  4. Deployment Process:

    • Infrastructure is provisioned/updated using Terraform
    • Application is deployed to the target environment
    • For production: manual approval is required
  5. Verification:

    • Automated tests verify the deployment
    • Performance tests validate application under load

Environment Setup

The pipeline manages three environments:

  • Development: Automatically updated with each commit to main
  • Staging: Used for pre-production testing
  • Production: Protected by manual approval workflow

Prerequisites

  • GitHub account
  • AWS account with appropriate permissions
  • SonarCloud account
  • Slack workspace (for notifications)

Getting Started

1. Fork and Clone the Repository

git clone https://github.com/YOUR_USERNAME/spring-petclinic.git
cd spring-petclinic

2. Configure GitHub Secrets

The following secrets need to be configured in your GitHub repository:

  • AWS_ACCESS_KEY_ID: AWS access key with permissions to create resources
  • AWS_SECRET_ACCESS_KEY: Corresponding AWS secret key
  • SONAR_TOKEN: SonarCloud authentication token
  • DB_USERNAME: Database username for RDS instances
  • DB_PASSWORD: Database password for RDS instances
  • VPC_ID: AWS VPC ID where resources will be deployed
  • SLACK_WEBHOOK_URL: Slack webhook URL for notifications

3. Set Up Infrastructure

Initialize the Terraform backend:

cd terraform
terraform init

4. Run the CI/CD Pipeline

The pipeline will automatically run on commits to the main branch. You can also manually trigger deployments from the GitHub Actions tab.

Security Considerations

  • Secrets are stored in GitHub Secrets and never exposed in logs
  • Infrastructure follows security best practices with proper IAM roles
  • Regular security scanning ensures vulnerabilities are identified early
  • Production deployments require manual approval

Monitoring and Observability

  • Application metrics are collected using CloudWatch
  • Logs are centralized for easy troubleshooting
  • Alerts are configured for critical thresholds

Extending the Pipeline

You can extend this pipeline by:

  • Adding more thorough security scanning
  • Implementing blue/green or canary deployments
  • Adding chaos engineering tests
  • Implementing infrastructure drift detection

Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

License

This project is licensed under the MIT License - see the LICENSE file for details.