Microconfig Server Beta


MicroConfig Server was built to simplify configuration delivery to microservices. It provides a REST API (MicroConfig Server) and binary CLI (microctl) to fetch different configuration types for your services.

MicroConfig Server handles all configuration repo GIT operations and templating, so you don't have to. Also it allows for 3rd party integrations like HashiCorp Vault Coming Soon and Spring Boot Coming Soon

You can see a schema below for a deployment of orders-service pod using MicroConfig Server. Your deploy task fetches Helm values.yaml and uses them to deploy application pod. At startup orders-service pod fetches it's own application.yaml.

Microconfig Server

Server Setup


MicroConfig Server was designed to be Cloud Native from the start, so all you need is Docker

This will start your server on port 8080 with microconfig-quickstart as it's configuration repo.


                docker run -p 8080:80 microconfig/server:latest
                    ......
                16-03-2021 18:45:37.909 [INFO] o.s.b.StartupInfoLogger - Started MicroconfigServerKt in 13.973 seconds (JVM running for 16.68)
                

Available Environment Variables:

Variable Description Default
REMOTE_URL your configuration repo git url microconfig-quickstart repo
USERNAME git repo username open
PASSWORD git repo password source
CONFIG_BRANCH main git branch master
LOG_LEVEL log level DEBUG


Cli Setup


Microctl is a cli binary to fetch your configs from server. You can get it from GitHub releases

You can also use HomeBrew


                brew tap microconfig/microctl
                brew install microctl
                

Cli Usage


After you installed microctl and started your server you can fetch configuration.

All examples assume that you have your server running on http://localhost:8080 with microconfig-quickstart repo.

To use your own server url you can either use MC_ADDRESS environment variable or specify it with --server flag. If you don't specify anything http://localhost:8080 is used.

Almost all flags are doubled with environment variables


microctl help

Use this command to show available commands and common flags


                    $ microctl help

                    Usage: microctl [command] [service] [flags]
                    Commands:
                      show:     fetch config and show it in console (MC_CMD=show)
                      save:     fetch config and save it to disk (MC_CMD=save)
                      version:  show cli version
                      help:     show this message
                    Service:
                      Generate configs for this service name (MC_SERVICE)
                    Common Flags:
                      --ref [master]: git branch or tag to use, by default master (MC_REF)
                      --timeout [10]: server calls timeout in seconds, by default 10 (MC_TIMEOUT)
                      --server [url]:  server url, by default [http://localhost:8080] (MC_ADDRESS)
                      --skip-tls: skip server tls certificate verification (MC_SKIP_TLS=true)
                      --tls-root-ca [path]: expected Root CA certificate (MC_ROOT_CA)
                

Notice --skip-tls and --tls-root-ca flags. They allow to work with self-signed certificates or private Certificate Authority.

microctl show

Use this command to fetch service config and show it in console


                    $ microctl show

                    Usage microctl show [service] [flags]
                    Generates configuration of specified type for service and outputs it to console
                    Flags:
                      -e, --env  [name]: config environment (MC_ENV)
                      -t, --type [name]: config type, 'app' by default (MC_TYPE)
                      -s, --set  [foo=bar]: override values for placeholders and vars
                

                    $ microctl show payment-backend -t deploy -e dev

                    image: "payment-backend:latest"

                    replicas: 1

                    ingress:
                      host: http://payment-backend.local

                    probes:
                      health: /monitoring/health
                      ready: /monitoring/ready
                

microctl save

Use this command to fetch service config and save it to disk


                    $ microctl save

                    Usage microctl save [service] [flags]
                    Generates configuration for service and saves it to disk
                    Flags:
                      -e, --env  [name]: config environment (MC_ENV)
                      -t, --type [name]: config type, all types by default (MC_TYPE)
                      -d, --dir  [path]: output directory, current dir by default (MC_DIR)
                      -s, --set  [foo=bar]: override values for placeholders and vars
                

                    $ microctl save payment-backend -t app -e dev -d config

                    $ ls config
                    327 application.yaml
                    264 logback.xml
                

microctl version

Display microctl version


                    $ microctl version

                    Version 0.5.0
                

Kubernetes Usage


You can use microctl in your init container to fetch configuration at pod's startup.


Example Deployment of payment-backend pod


                    apiVersion: apps/v1
                    kind: Deployment
                    metadata:
                      name: payment-backend
                      namespace: default
                    spec:
                      replicas: 1
                      selector:
                        matchLabels:
                          app: payment-backend
                      template:
                        metadata:
                          labels:
                            app: payment-backend
                        spec:
                          volumes:
                            - name: config
                              emptyDir: { }
                          initContainers:
                            - name: microconfig
                              image: "microconfig/server-cli:latest"
                              imagePullPolicy: Always
                              env:
                                - name: MC_ADDRESS
                                  value: http://microconfig-server.default.svc.cluster.local
                                - name: MC_CMD
                                  value: save
                                - name: MC_SERVICE
                                  value: payment-backend
                                - name: MC_ENV
                                  value: dev
                                - name: MC_DIR
                                  value: "/config"
                              volumeMounts:
                                - name: config
                                  mountPath: "/config"
                          containers:
                            - name: payment-backend
                              image: "alpine:latest"
                              imagePullPolicy: Always
                              command: [ "sleep", "infinity" ]
                              volumeMounts:
                                - name: config
                                  mountPath: "/config"
                

Feedback


Microconfig Server is in active development and currently in Beta. If you have any issues or suggestions you can contact us on Github or Join our Slack!