Quickstart
You will learn how to build configuration with Microconfig.
Setup
Get Example Config
Checkout with git
git clone https://github.com/microconfig/microconfig-quickstart.git
cd microconfig-quickstart
Or just download and unzip it directly.
Get Microconfig
Download the latest binary for your OS.
Config Structure
Our configuration example has 2 services:
payments-backendpayments-frontend
Services are combined into payments group.
We have environment specific values for 2 environments:
devprod
Each service expects 3 files:
application.yaml- application configdeploy.yaml- deployment configlogback.xml- logging configuration
Build
Examples assume that you run your build in quickstart repository dir.
Generate configuration for a service in a specific environment
Let's generate configuration for payments-backend service in dev
environment.
microconfig -r . -e dev -s payment-backend
Filtered 1 component(s) in [dev] env.
Copied 'payment-backend' template ../log/logback.xml -> logback.xml
Generated payment-backend/application.yaml
Generated payment-backend/deploy.yaml
Generated [dev] configs in 265ms
Parameters:
-r .specify root dir (optional)-e devgenerate fordevenvironment-s payments-backendgenerate forpayments-backendservice
As a result Microconfig created build folder with dev configs for
payments-backend.
build
└── payment-backend
├── application.yaml
├── deploy.yaml
└── logback.xml
Generate configuration for a group in a specific environment
Let's generate configuration for payments group in prod environment.
microconfig -e prod -g payments
Filtered 2 component(s) in [prod] env.
Copied 'payment-backend' template ../log/logback.xml -> logback.xml
Copied 'payment-frontend' template ../log/logback.xml -> logback.xml
Generated payment-backend/application.yaml
Generated payment-backend/deploy.yaml
Generated payment-frontend/application.yaml
Generated payment-frontend/deploy.yaml
Generated [prod] configs in 325ms
Parameters:
-e prodgenerate forprodenvironment-g paymentsgenerate forpaymentsgroup
As a result Microconfig created build folder with prod configs for
payments group.
build
├── payment-backend
│ ├── application.yaml
│ ├── deploy.yaml
│ └── logback.xml
└── payment-frontend
├── application.yaml
├── deploy.yaml
└── logback.xml
Generate configuration for all services in a specific environment
Let's generate configuration for all services in dev environment.
microconfig -e dev
Filtered 2 component(s) in [dev] env.
Copied 'payment-frontend' template ../log/logback.xml -> logback.xml
Copied 'payment-backend' template ../log/logback.xml -> logback.xml
Generated payment-backend/application.yaml
Generated payment-backend/deploy.yaml
Generated payment-frontend/application.yaml
Generated payment-frontend/deploy.yaml
Generated [dev] configs in 326ms
Parameters:
-e devgenerate fordevenvironment
As a result Microconfig created build folder with configs for all services defined in
dev
environment.
build
├── payment-backend
│ ├── application.yaml
│ ├── deploy.yaml
│ └── logback.xml
└── payment-frontend
├── application.yaml
├── deploy.yaml
└── logback.xml
Conclusion
We hope you agree that microconfig is easy to use. Now you can explore current example to see
Microconfig
syntax,
try out IDE plugin or deep dive into
Docs.