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 Microconfig templating, so don't have to. Also it allows for 3rd party integrations like HashiCorp Vault 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

                02-10-2020 12:43:50.421 [INFO] o.s.b.StartupInfoLogger - Started MicroconfigServer in 8.781 seconds (JVM running for 9.494)
                

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 MCS_ADDRESS environment variable or specify it with --server flag. If you don't specify anything http://localhost:8080 is used.


microctl help

Use this command to show available commands and common flags


                    $ microctl help

                    Usage: microctl [command] [component] [flags]
                    Commands:
                        show:     fetch config and show it in console
                        save:     fetch config and save it to disk
                        version:  show cli version
                        help:     show this message
                    Common Flags:
                      --branch:  git branch to use
                      --tag:     git tag to use
                      --timeout: server calls timeout in seconds, by default 10
                      --server:  server url (or MCS_ADDRESS env variable), by default [http://localhost:8080]
                

microctl show

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


                    $ microctl show

                    Usage microctl show [component] [flags]
                    Generates configuration for component of specified type and outputs it to console
                    Flags:
                      -e, --env:   config environment
                      -t, --type:  config type, 'app' by default
                

                    $ 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 component config and save it to disk


                    $ microctl save

                    Usage microctl save [component] [flags]
                    Generates configuration for component and saves it to disk
                    Flags:
                      -e, --env:   config environment
                      -t, --type:  config type, all types by default
                      -d, --dir:   output directory, current dir by default
                

                    $ 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.1.4
                

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
                              command: [ "/bin/sh","-c", "microctl save payment-backend -e dev -d /config" ]
                              env:
                                - name: MCS_ADDRESS
                                  value: http://microconfig-server.default.svc.cluster.local
                              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!