A simple Spring Boot application demonstrating CI/CD with GitHub Actions, Docker, and Kubernetes.
- Spring Boot 3.2.0
- Java 17
- Docker containerization
- GitHub Actions CI/CD pipeline
- Maven build system
- Kubernetes deployment
- Datadog monitoring
- Java 17 or later
- Maven 3.6.3 or later
- Docker (for local development)
- Git
- Kubernetes cluster
- Datadog API key
- Bugsnag API key
mvn clean packagemvn spring-boot:runThe application will be available at http://localhost:8080
GET /- Welcome messageGET /health- Health check endpoint
docker build -t dhiraj143/helloworld .## Kubernetes Deployment
### Prerequisites
1. Kubernetes cluster
2. Docker Hub credentials
3. Datadog API key
4. Bugsnag API key
### Deployment Steps
1. Create Kubernetes secrets for API keys:
```bash
kubectl create secret generic datadog-secrets \
--from-literal=api-key=<your-datadog-api-key>
kubectl create secret generic bugsnag-secrets \
--from-literal=api-key=<your-bugsnag-api-key>- Deploy the application:
kubectl apply -f kubernetes/deployment.yaml- Deploy monitoring:
kubectl apply -f kubernetes/monitoring.yaml- Create a new dashboard in Datadog
- Add the following metrics:
app.devops-spring-app.response_timeapp.devops-spring-app.request_countapp.devops-spring-app.error_countjvm.memory.usedjvm.cpu.time
- Create a new project in Bugsnag
- Configure error notifications
- Set up release tracking
The application has two types of health checks:
-
Liveness Probe:
- Path:
/actuator/health/liveness - Initial delay: 30 seconds
- Period: 10 seconds
- Timeout: 5 seconds
- Failure threshold: 3
- Path:
-
Readiness Probe:
- Path:
/actuator/health/readiness - Initial delay: 30 seconds
- Period: 10 seconds
- Timeout: 5 seconds
- Failure threshold: 3
- Path:
GitHub Actions are configured to:
- Build and test the application
- Build and push Docker image
- Deploy to Kubernetes
- Run performance tests
The application is monitored using:
- Datadog for metrics and logs
- Bugsnag for error tracking
- Kubernetes health checks
For any issues or questions, please open an issue in the GitHub repository. docker run -p 8080:8080 dhiraj143/helloworld
## CI/CD Pipeline
The project includes a GitHub Actions workflow that:
1. Builds and tests the application on every push
2. Builds and pushes a Docker image to Docker Hub on the main branch
### Required Secrets
Add these secrets to your GitHub repository:
- `DOCKER_HUB_USERNAME` - Your Docker Hub username
- `DOCKER_HUB_TOKEN` - Your Docker Hub access token
## Project Structure
. ├── .github/workflows/ # GitHub Actions workflows ├── src/ # Source code │ ├── main/java/ # Java source files │ └── main/resources/ # Configuration files ├── .gitignore # Git ignore file ├── Dockerfile # Docker configuration ├── mvnw # Maven wrapper (Unix) ├── mvnw.cmd # Maven wrapper (Windows) └── pom.xml # Maven configuration
## License
This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.