Skip to content

ReeganExE/confd-base

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 

Repository files navigation

Confd Base Image | Docker Hub

Base Docker image that can be used for generating file config from environment/consul/...

This will helpful when you use a 3rd party application and it requires configuration from file. It might use as a sidekick service in Rancher.

Example Usage | Full Source

Create conf.d and templates directories and add files.

Structure

templates/
conf.d/
Dockerfile
entrypoint.sh

Dockerfile

FROM reeganexe/confd-base:0.16

COPY entrypoint.sh /
ENTRYPOINT [ "/entrypoint.sh" ]

conf.d/my-app.yml.toml

[template]
src  = "my-app.yml.tmpl"
dest = "/etc/my-app.yml"
keys = [
 "/first/name",
 "/db/schema"
]

templates/my-app.yml.tmpl

spring:
  apps:
    - name: {{getv "/first/name"}}
    - db: "jdbc:mysql://localhost/{{getv "/db/schema"}}?useSSL=true&requireSSL=true"

entrypoint.sh

#!/bin/sh

# Generate config from template
confd -onetime -backend env

# Print output
echo ---------------------------
cat /etc/my-app.yml

Run

docker build -t confd-example .
docker run --rm -it -e FIRST_NAME=beneficiary-app -e DB_SCHEMA=beneficiary confd-example

The output would look like this:

2018-08-26T06:33:06Z dac19b291159 confd[7]: INFO Backend set to env
2018-08-26T06:33:06Z dac19b291159 confd[7]: INFO Starting confd
2018-08-26T06:33:06Z dac19b291159 confd[7]: INFO Backend source(s) set to
2018-08-26T06:33:06Z dac19b291159 confd[7]: INFO Target config /etc/my-app.yml out of sync
2018-08-26T06:33:06Z dac19b291159 confd[7]: INFO Target config /etc/my-app.yml has been updated
---------------------------
spring:
  apps:
    - name: beneficiary-app
    - db: "jdbc:mysql://localhost/beneficiary?useSSL=true&requireSSL=true"

Example repo: https://github.com/ReeganExE/confd-example

About

Base image for confd

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages