Skip to content

jacob-majesty/microservices

Repository files navigation

Microservices Development with Java, Spring Boot, Spring Cloud, Docker, Kubernetes, Helm, and Microservices Security

image

Welcome to the repository for developing microservices using modern technologies and best practices! This project demonstrates how to build, deploy, and secure microservices using a combination of Java, Spring Boot, Spring Cloud, Docker, Kubernetes, Helm, and microservices security techniques.

Table of Contents

  1. Overview
  2. Technologies Used
  3. Features
  4. Getting Started
  5. Documentation
  6. Running the Microservices
  7. Microservices Security
  8. Contributing

Overview

This repository provides a comprehensive example of building microservices using Java and Spring Boot. It includes integration with Spring Cloud for service discovery, configuration management, and API gateway. The microservices are containerized using Docker, orchestrated with Kubernetes, and deployed using Helm charts. Additionally, the project incorporates security best practices to protect microservices.


Technologies Used

  • Java: The primary programming language for building microservices.
  • Spring Boot: Framework for creating stand-alone, production-grade Spring-based applications.
  • Spring Cloud: Tools for building distributed systems (e.g., service discovery, configuration management, API gateway).
  • Docker: Containerization platform for packaging microservices.
  • Kubernetes: Container orchestration for deploying and managing microservices.
  • Helm: Package manager for Kubernetes to simplify deployment.
  • Microservices Security: Techniques like OAuth2, JWT, and Spring Security for securing microservices.

Features

  • Service Discovery: Using Spring Cloud Netflix Eureka or Consul.
  • API Gateway: Built with Spring Cloud Gateway.
  • Configuration Management: Centralized configuration using Spring Cloud Config.
  • Containerization: Docker images for each microservice.
  • Orchestration: Kubernetes manifests for deploying microservices.
  • Helm Charts: Pre-configured Helm charts for easy deployment.
  • Security: OAuth2, JWT, and Spring Security for securing APIs.

Getting Started

Prerequisites

Before running the project, ensure you have the following installed:

  • Java JDK 17 or higher
  • Maven or Gradle
  • Docker
  • Kubernetes (Minikube or a Kubernetes cluster)
  • Helm
  • IDE (IntelliJ IDEA, Eclipse, or VS Code)

Installation

  1. Clone the repository:

    git clone https://github.com/your-username/your-repo-name.git
    cd your-repo-name
  2. Build the project:

    mvn clean install
  3. Build Docker images:

    docker-compose build

Documentation

### OpenAPI Documentation
Access the API documentation after running the application:
- **Swagger UI**: `http://localhost:8080/swagger-ui.html`
- **OpenAPI JSON**: `http://localhost:8080/v3/api-docs`

Running the Microservices

Local Development

  1. Start the services using Docker Compose:

    docker-compose up
  2. Access the services:

    • Eureka Dashboard: http://localhost:8761
    • API Gateway: http://localhost:8080

Docker

  1. Build Docker images:

    docker-compose build
  2. Run the containers:

    docker-compose up

Kubernetes

  1. Start Minikube (if using local Kubernetes):

    minikube start
  2. Apply Kubernetes manifests:

    kubectl apply -f kubernetes/
  3. Access the services:

    • Use kubectl get services to find the external IPs.

Helm

  1. Install Helm charts:

    helm install microservices helm/
  2. Upgrade Helm charts:

    helm upgrade microservices helm/

Microservices Security

This project includes the following security features:

  • OAuth2: For authentication and authorization.
  • JWT (JSON Web Tokens): For stateless authentication.
  • Spring Security: For securing endpoints and role-based access control.

To enable security, configure the application.yml files in each microservice with the appropriate security settings.


Contributing

Contributions are welcome! Please follow these steps:

  1. Fork the repository.
  2. Create a new branch (git checkout -b feature/YourFeatureName).
  3. Commit your changes (git commit -m 'Add some feature').
  4. Push to the branch (git push origin feature/YourFeatureName).
  5. Open a pull request.

Feel free to explore the code, raise issues, or contribute to the project. Happy coding! 🚀

About

Microservices With Spring, Docker, Kubernetes

Topics

Resources

License

Stars

2 stars

Watchers

1 watching

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages