
- Microservices Design Patterns Tutorial
- Microservices Design Patterns - Home
- Microservices Design Patterns - Overview
- Decomposition Design Patterns
- Decompose by Business Capability
- Decompose by Subdomain
- Decompose by Strangler
- Integration Design Patterns
- API Gateway
- Aggregator
- Proxy
- Client Side UI Composition
- Chain Of Responsibilities
- Branch
- Database Design Patterns
- Database per Service
- Shared Database per Service
- Command Query Responsibility Segregator
- Saga
- Aysynchronous Messaging
- Event Sourcing
- Observability Design Patterns
- Log Aggregation
- Performance Metrics
- Distributed Tracing
- Health Check
- Cross Cutting Concern Design Patterns
- External Configuration
- Service Discovery
- Circuit Breaker
- Blue Green Deployment
- Useful Resources
- Quick Guide
- Useful Resources
- Discussion
External Configuration
Problem Statement
Microservice architecture structures an application as a set of loosely coupled microservices and each service can be developed independently in agile manner to enable continous delivery/deployment. These services often interacts with infrastructure services or 3rd party services.
Insfrastructure services may include a service registry, a message broker, database server. 3rd party services can be payment services, email services, messaging services. Apart from varying services, environments often vary. Consider the following cases −
Configuration Data − Configurations to external/3rd party services should be provided to the micro services e.g. database credentials, network urls etc.
Multiple Environments − There are often varying environments like dev, qa, test, staging or pre-prod and production. A service should be deployed on each environments without any code modifications.
Varying configuration data − Configurations to external/3rd party services also varies from dev to production e.g. dev databse to production database, test payment processor vs original payment processor services.
Solution
We can externalize all configurations from database credentials to network urls. Service will read the configuration data during startup e.g. from a properties file/ system environment variables or using command line arguments. This pattern helps in deploying the microservices without any modification/recompilation needed.