Coder Social home page Coder Social logo

davidsche / consul-config-loader Goto Github PK

View Code? Open in Web Editor NEW

This project forked from jhipster/consul-config-loader

0.0 1.0 0.0 37 KB

A small docker based tool to load Spring Boot property files into Consul's K/V Store

License: Apache License 2.0

Shell 82.91% Dockerfile 17.09%

consul-config-loader's Introduction

Consul Config Loader

Azure DevOps Build Status Build Status Docker Pulls

A small docker based tool to load Spring Boot and/or Micronaut property files into Consul K/V Store. It features hot-reload as well as filesystem and git support.

Enabling Spring Boot and Micronaut support

Both Spring Boot and Micronaut frameworks are supported, and by default only Spring Boot is enabled. To control the compatibility for each framework you should use the following environnement variables: ENABLE_SPRING and ENABLE_MICRONAUT, with values true or false.

Filesystem mode

In this mode, the consul-config-loader agent pushes all YAML properties files in the config/ directory to consul K/V store. It automatically detects when files are added or edited to reload them into Consul.

To use this mode, configure those properties in bootstrap.yml:

spring:
    cloud:
        consul:
            config:
                format: yaml
                profile-separator: "-"

Then run docker-compose -f quickstart/consul-loader-filesystem.yml up to start a Consul server on localhost and and its agent. You can then access http://localhost:8500/ui/#/dc1/kv/config/ and watch as your Consul K/V store is synchronised with property files in the config/ directory.

Git mode

To use this mode, configure those properties in bootstrap.yml:

spring:
    cloud:
        consul:
            config:
                fail-fast: true
                format: files
                profile-separator: "-"

This mode is recommended for production, it is a wrapper around git2consul project. You will have to configure the config/git2consul.json file to have it load its configuration from your own git repository.

Simply run docker-compose -f quickstart/consul-loader-git.yml up to start Consul and the agent.

ACL security

To maintain security for KV access and service discovery, this config loader expects consul running with ACL enabled, which leads to the presence of a master ACL token (refered to the loader by environment variable MASTER_ACL_TOKEN). This token is used, to create a client ACL token (provided by CLIENT_ACL_TOKEN variable), with a default policy and for writing config changes. The default policy for the client ACL is to permit read to KV and write to service discovery. This policy can be changed using the HTTP API for ACL for custom policies. It is strongly recommended to use some random strings (like UUID) for the token values. MASTER_ACL_TOKEN and CLIENT_ACL_TOKEN must not be equal.

To make JHipster or Spring Cloud applications registering to consul using the ACL, just add the client ACL token to bootstrap.yml:

consul:
    token: my-client-acl-token

consul-config-loader's People

Contributors

alexzsas avatar bdbogjoe avatar danielfran avatar murdos avatar pascalgrimaud avatar pierrebesson avatar shaolans avatar sudharakap avatar taraspos avatar xetys avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.