{"id":24884314,"url":"https://github.com/elinazoldnere/dockerized-microservices-demo","last_synced_at":"2026-05-09T04:33:45.278Z","repository":{"id":264853031,"uuid":"892602863","full_name":"ElinaZoldnere/Dockerized-Microservices-Demo","owner":"ElinaZoldnere","description":"A microservice architecture deployed in Docker containers, demonstrating distributed systems principles and containerization using Spring Boot, RabbitMQ, Docker Compose, and Elastic Stack monitoring.","archived":false,"fork":false,"pushed_at":"2026-03-13T18:37:31.000Z","size":1474,"stargazers_count":0,"open_issues_count":0,"forks_count":1,"subscribers_count":1,"default_branch":"main","last_synced_at":"2026-03-14T07:02:51.485Z","etag":null,"topics":["docker","elasticstack","java","microservices","rabbitmq","spring-boot"],"latest_commit_sha":null,"homepage":"","language":"Java","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/ElinaZoldnere.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2024-11-22T12:30:29.000Z","updated_at":"2026-03-13T18:37:26.000Z","dependencies_parsed_at":"2025-03-27T09:42:58.913Z","dependency_job_id":"ef12fd9c-44b0-47a8-a5d1-851a588e2c22","html_url":"https://github.com/ElinaZoldnere/Dockerized-Microservices-Demo","commit_stats":null,"previous_names":["elinazoldnere/dockerized-microservices-demo"],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/ElinaZoldnere/Dockerized-Microservices-Demo","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ElinaZoldnere%2FDockerized-Microservices-Demo","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ElinaZoldnere%2FDockerized-Microservices-Demo/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ElinaZoldnere%2FDockerized-Microservices-Demo/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ElinaZoldnere%2FDockerized-Microservices-Demo/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ElinaZoldnere","download_url":"https://codeload.github.com/ElinaZoldnere/Dockerized-Microservices-Demo/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ElinaZoldnere%2FDockerized-Microservices-Demo/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":32807265,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-08T08:22:46.396Z","status":"online","status_checked_at":"2026-05-09T02:00:06.633Z","response_time":123,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["docker","elasticstack","java","microservices","rabbitmq","spring-boot"],"created_at":"2025-02-01T14:26:49.961Z","updated_at":"2026-05-09T04:33:45.269Z","avatar_url":"https://github.com/ElinaZoldnere.png","language":"Java","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Dockerized Microservices Demo\nThis repository contains a microservice architecture deployed in Docker containers. It demonstrates distributed systems \nprinciples and containerization using Spring Boot, RabbitMQ, Docker Compose, and Elastic Stack for monitoring.\n\n![Build Status](https://github.com/ElinaZoldnere/Dockerized-Microservices-Demo/actions/workflows/build.yaml/badge.svg)\n\n## About the Process\nThis project I initially developed in a private repository before migrating here, so the commit history unfortunately \ndoes not reflect the full process (around 200 more commits). The project was built from scratch, incrementally adding \nand refactoring features following a common industry design example, but with various additions and improvements.\n### Key Extensions \u0026 Contributions\n- Distributed tracing with Micrometer Tracing and Brave (including RabbitMQ tracing beyond out-of-the-box support).\n- Spring Security (Basic Auth) for securing REST endpoints (and generally everything other excluding web) with\ndifferent authorization levels.\n- Optimized asynchronous processing with RabbitMQ Dead Letter Exchange (DLX).\n- Optimized tests using an abstract template method pattern, parameterized tests, dynamic tests from stream.\n- Cross-cutting aspects for logging.\n- Caching with Caffeine.\n- Modern Java usage with sealed classes for response handling and records for immutable DTOs.\n- Visual system design with C4 model.\n- Static code analysis with Checkstyle, including custom filters.\n\n## Overview\nThe core of the system is the **Insurance Calculator Application Web Service**, which calculates insurance premiums based on\nuser requests. The project extends the core application into a microservice architecture by introducing two additional \nservices:\n- **Blacklist Service**: A synchronously integrated service to verify whether a person is not on a blacklist.\n- **Proposal Generator**: An asynchronously integrated service (via RabbitMQ) for generating insurance proposals in \nPDF format.\n\nThe system uses RabbitMQ for message brokering and MySQL as the database. For monitoring and observability, the \nElastic Stack is utilized, including Filebeat, Metricbeat, Logstash, Elasticsearch, and Kibana for data visualization.\n\nAll services and supporting components are containerized and orchestrated using Docker Compose. Once the necessary\ncustom images are created, the entire system can be started with a single command.\n\n## Limitations\n- Scalability: Currently, services are single-instance without load balancing.\n- Resilience: Lacks circuit breakers and fallback mechanisms.\n- Service Discovery: No dynamic service registration or discovery implemented.\n- Deployment: Not deployed on an orchestrated platform like Kubernetes.\n\nThese limitations are considered potential areas for future extension.\n\n## Key Features\n- Microservices architecture: 10 Docker containers, each representing a distinct service, for modular development and \ndeployment.\n- Spring Boot applications: JDK 21, Spring Boot 3.5, builds, dependencies, and container image creation managed with \nGradle and Google Jib.\n- Configuration management: externalized environment variables and configurations, and Spring Profiles for different\nenvironments.\n- Message brokering: RabbitMQ for asynchronous communication, featuring Dead-Letter Queues and Exchanges to handle\nmessage failures.\n- Database management: automated database initialization using `mysql-init`, and schema migrations with Liquibase.\n- Container orchestration: services coordinated using Docker Compose.\n- Monitoring and observability: Elastic Stack (Filebeat, Metricbeat, Logstash, Elasticsearch, and Kibana) for\n monitoring and visualization.\n- Data persistence: mounted volumes for export data persistence.\n- Local access support: provided local access through port mappings.\n- Static code analysis: Checkstyle for code quality analysis.\n\n\u003e More information about the core application, its features, and initial design can be found here:\n[Insurance Application Part 1](https://github.com/ElinaZoldnere/Insurance-Application-Part-1).\n\n## Model with C4 Container Diagram\n![container_view](documentation/c4_diagrams/C4_Container_view.png)\u003cbr\u003e\n\n## How to Run the Project\nAlthough images could also be built with `docker-compose.yaml`, a separate Gradle and Jib step for Spring Boot \napplications was preferred. This approach provides better control, and makes the workflow easier to inspect and debug. \nCompared to previously used Palantir plugin, Jib produces a layered exploded image layout, so dependency layers can \nremain cached when only application code changes.\n\n### Prerequisites\n- **Java Development Kit (JDK) 21** – it can be downloaded either within IDE (like IntelliJ IDEA, Eclipse) or manually -\n  [Download JDK 21 Here](https://aws.amazon.com/corretto/?filtered-posts.sort-by=item.additionalFields.createdDate\u0026filtered-posts.sort-order=desc)\u003cbr\u003e\n  Ensure that the project SDK is set to JDK 21 in your IDE settings (e.g., Project Structure in IntelliJ IDEA).\n- **Gradle** - only if you are running the project outside an IDE that handles Gradle automatically –\n  [Download Gradle Here](https://gradle.org/install/)\n- **Docker Desktop** - to run the Docker containers locally -\n  [Download Docker Desktop Here](https://www.docker.com/products/docker-desktop) \u003cbr\u003e\n  This may require updating Windows:\n\n  - Navigate to: *Settings -\u003e Update \u0026 Security -\u003e Windows Update -\u003e Advanced Options*.\nEnable the option: *Receive updates for other Microsoft products when you update Windows*.\n\n  - Return to:*Settings -\u003e Update \u0026 Security -\u003e Windows Update*.\nClick *Check for updates*.\n\n  - Ensure WSL2 (Windows Subsystem for Linux) is updated for Docker Desktop to function correctly.\n\n  - In Docker Desktop, after installation: Open Settings.\nUnder the General tab, enable the option: *Expose daemon on tcp://localhost:2375 without TLS*.\nFor local development it is generally safe.\n\n- **Postman (Desktop App)** - to perform POST/GET requests to the REST API endpoints -\n  [Download Postman Here](https://www.postman.com/downloads/)\n\n### Steps to Run\n1. Clone the repository and navigate to the project directory:\u003cbr\u003e\n```bash\ngit clone https://github.com/ElinaZoldnere/Dockerized-Microservices-Demo.git\ncd Dockerized_Microservices_Demo \n```\n2. Open the project in your IDE (e.g., IntelliJ IDEA or Eclipse).\n3. Locate the `.env.example` file in the project root directory. Rename it to `.env`. Review the `.env` file and update \nvalues if necessary to match your setup, but sample values should also work.\n```bash\nmv .env.example .env\n```\n4. Build the project custom images using Gradle:\n```bash\n./gradlew :black-list-app:jibDockerBuild\n./gradlew :doc-generator-app:jibDockerBuild\n./gradlew :insurance-calculator-app:jibDockerBuild\ndocker compose filebeat metricbeat logstash\n```\n5. Start the Docker containers using Docker Compose:\n```bash\ndocker-compose up\n```\nYou can also run the containers in detached mode with the `-d` flag:\n```bash\ndocker-compose up -d\n```\nTo stop and remove containers later use:\n```bash\ndocker-compose down\n```\n6. Access the application:\n- REST API/POST v1: http://localhost:8080/insurance/travel/api/v1/\n- REST API/POST v2: http://localhost:8080/insurance/travel/api/v2/\n- REST API/GET:     http://localhost:8080/insurance/travel/api/internal/agreement/{agreement-uuid-here}\n- Web Interface v1: http://localhost:8080/insurance/travel/web/v1/\n- Web Interface v2: http://localhost:8080/insurance/travel/web/v2/\n\nREST API endpoints you can test via Postman Desktop App.\u003cbr\u003e\nAs endpoints are secured with Basic Authentication, you have to select `Basic Auth` and provide the username and\npassword in the request. Username: `admin` and password: `javaguru3` will work for all REST endpoints.\u003cbr\u003e\n![Postman_Basic_Auth](assets/Postman_Basic_Auth.png)\n\u003cbr\u003e\n\u003cbr\u003e\nExample JSON (request body content) for testing REST API/POST v1 at http://localhost:8080/insurance/travel/api/v1/\n```json\n{\n  \"personFirstName\": \"Jānis\",\n  \"personLastName\": \"Bērziņš\",\n  \"personalCode\": \"123456-12345\",\n  \"personBirthDate\": \"1990-01-01\",\n  \"agreementDateFrom\": \"2025-03-10\",\n  \"agreementDateTo\": \"2025-03-11\",\n  \"selectedRisks\": [\n    \"TRAVEL_MEDICAL\",\n    \"TRAVEL_LOSS_BAGGAGE\"\n  ],\n  \"country\": \"SPAIN\",\n  \"medicalRiskLimitLevel\": \"LEVEL_15000\"\n}\n```\nExample JSON (request body content) for testing REST API/POST at http://localhost:8080/insurance/travel/api/v2/\n```json\n{\n  \"agreementDateFrom\": \"2025-03-10\",\n  \"agreementDateTo\": \"2025-03-11\",\n  \"selectedRisks\": [\"TRAVEL_MEDICAL\"],\n  \"country\": \"SPAIN\",\n  \"persons\": [\n    {\n      \"personFirstName\": \"Jānis\",\n      \"personLastName\": \"Bērziņš\",\n      \"personalCode\": \"123456-12345\",\n      \"personBirthDate\": \"1990-01-01\",\n      \"medicalRiskLimitLevel\": \"LEVEL_15000\"\n    },\n    {\n      \"personFirstName\": \"Kārlis\",\n      \"personLastName\": \"Krūmiņš\",\n      \"personalCode\": \"234567-23456\",\n      \"personBirthDate\": \"1989-01-01\",\n      \"medicalRiskLimitLevel\": \"LEVEL_15000\"\n    }\n  ]\n}\n```\nPlease, take into account, the application supports limited number of countries, risk types and limit levels.\u003cbr\u003e\nSome of the values you can use for testing:\u003cbr\u003e\nCountries: \"LATVIA\", \"SPAIN\", \"JAPAN\".\u003cbr\u003e\nRisk types: \"TRAVEL_MEDICAL\", \"TRAVEL_CANCELLATION\".\u003cbr\u003e\nMedical risk limit levels: \"LEVEL_5000\", \"LEVEL_10000\", \"LEVEL_15000\".\u003cbr\u003e\n\u003cbr\u003e\n\nOptionally after performing at least one successful request, you can check the results in the database. Picking a valid \nagreement UUID from the table **agreements**, you can test the REST API/GET endpoint providing the UUID in the URL.\n- REST API/GET:     http://localhost:8080/insurance/travel/api/internal/agreement/{agreement-uuid-here}\n\nThe web interface can be tested filling in the form fields and submitting the request. No authentication required.\u003cbr\u003e\n- Web Interface v1: http://localhost:8080/insurance/travel/web/v1/\n- Web Interface v2: http://localhost:8080/insurance/travel/web/v2/\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Felinazoldnere%2Fdockerized-microservices-demo","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Felinazoldnere%2Fdockerized-microservices-demo","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Felinazoldnere%2Fdockerized-microservices-demo/lists"}