This project is designed for rapid deployment and initialization of a Java full-stack application using Docker-based microservices architecture. The backend services are modularized, and each module contains its own initialization configuration file to define dependencies and required settings.
- Docker-based Microservices Architecture: All services are containerized for easy deployment and scaling.
- Customizable Initialization: Each backend module includes a configuration file for defining dependencies and other initialization details.
- Automated Scripts: Repetitive initialization and configuration tasks are automated with scripts for quick setup and consistent environments.
project-root/
├── backend/
│ ├── java-stack-microservice/
│ │ ├── spring-eureka/
│ │ │ ├── application.yml
│ │ │ ├── build-config.yml
│ │ │ ├── Dockerfile
│ │ │ └── ...
│ │ ├── spring-cloud-config/
│ │ │ ├── application.yml
│ │ │ ├── build-config.yml
│ │ │ ├── Dockerfile
│ │ │ └── ...
│ │ ├── spring-cloud-gateway/
│ │ │ ├── application.yml
│ │ │ ├── build-config.yml
│ │ │ ├── Dockerfile
│ │ │ └── ...
│ │ ├── docker-compose-dev.yml
│ │ ├── docker-compose-prod.yml
│ │ ├── start.sh
│ │ ├── stop.sh
│ │ └── ...
└── start.sh
└── stop.sh
└── docker-compose-dev.yml
└── docker-compose-prod.yml
└── ...
-
java-stack-microservice: A set of microservices implemented in Java using Spring Boot.
- core-business: Handles the main business logic.
- msg-consumer: Consumes messages from Kafka topics.
- msg-producer: Produces messages to Kafka topics.
- spring-cloud-config: Centralized configuration management for microservices.
- spring-cloud-gateway: API gateway for routing requests to microservices.
- spring-eureka: Service discovery and registration.
- spring-security: Security module for authentication and authorization.
-
nocode-standalone-instance: Contains independent services for various infrastructure components.
- db:
- main-db: Main database.
- redis: Caching and message brokering service.
- replication-db: Replicated database instance for read scaling.
- kafka: Message broker using Kafka.
- log: Centralized logging service.
- monitoring:
- grafana: Visualization and monitoring.
- influx: Time-series database for metrics.
- prometheus: Metrics collection and alerting.
- db:
- Placeholder for frontend-related code and components.
- Contains infrastructure scripts and configurations for deployment.
All services are containerized using Docker, making it easy to manage, scale, and deploy.
- Automated deployment scripts for each service.
- Build and run each module in stages through docker profiles. java-stack-microservice and nocode-standalone-instance.
docker-compose
files for development and production environments:- docker-compose-dev.yml: For local development.
- docker-compose-prod.yml: For production setups.
- docker-compose.override.yml: Custom overrides for specific configurations.
- Docker and Docker Compose installed.
- jq installed.
- start.sh: Starts all services.
- stop.sh: Stops all services.
- build-image.sh: Builds Docker images for services.
- init-java-stack-services.sh: Generate Java basic code using SpringBoot CLI & Build docker image with jar package
- Clone the repository.
clone https://github.com/bakboem/docker-springboot-microservice.git cd docker-springboot-microservice
- Grant permissions to script files
chmod +x start.sh stop.sh \ build-image.sh init-java-stack-services.sh \ create-jwt-token-keypair.sh
- Start projects with docker compose :
./start.sh
- Stop projects with docker compose :
./stop.sh
- Implement business logic for microservices in the
java-stack-microservice
folder. - Extend monitoring capabilities with custom dashboards.
- Optimize database queries and caching for high performance.
- Integrate the frontend with the backend services.
For further assistance, reach out to the project maintainer.