• Stars
    star
    170
  • Rank 223,357 (Top 5 %)
  • Language
    Go
  • License
    MIT License
  • Created almost 9 years ago
  • Updated about 5 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

12factor apps configuration manager

Configo Build Status Goreport Join the chat at https://gitter.im/bsideup/configo Approved issues

Configo helps running 12factor (http://12factor.net/config) applications by loading environment variables from different sources.

Configuration

See wiki for detailed explanation of configuration options, supported sources and more examples: https://github.com/bsideup/configo/wiki

Usage

Imagine having an application that is configurable with environment variables. Let us assume that this is a self-contained (http://12factor.net/processes) NodeJS application, and that we have a Docker image for it:

FROM node

ADD . /app
WORKDIR /app

CMD ["node", "server.js"]

Surely you want to deploy this application to dev/qa/production. Some configuration is obviously required. We will use these environment variables for this configuration:

docker run \
  -e "DB_MONGO_URI=mongodb://user:[email protected]/db" \
  -e "DB_REDIS_URI=redis://some.redis.prod.domain.com/0" \
  -e "GOOGLE_ANALYTICS_KEY=UA-XXXXX-Y" \
  -e TWITTER_KEY=abcdefg \
  -e SEND_EMAILS=true \
  myAppImage

We also have a server to run some background jobs:

docker run \
  -e "DB_MONGO_URI=mongodb://user:[email protected]/db" \
  -e "DB_REDIS_URI=redis://some.redis.prod.domain.com/0" \
  -e TWITTER_KEY=abcdefg \
  -e SEND_EMAILS=true \
  -e RUN_JOBS=true \
  myAppImage

Since we have 5 servers in production, we have to configure these environment variables for each server. Would it not be nice to have a single source of configuration and load it for each app? And maybe some shared configuration as well? This is where Configo comes in.

Meet Configo!

First, change your Dockerfile ever so slightly:

FROM node

+RUN curl -L https://github.com/bsideup/configo/releases/download/v0.4.1/configo.linux-amd64 >/usr/local/bin/configo && \
+    chmod +x /usr/local/bin/configo

ADD . /app
WORKDIR /app

-CMD ["node", "server.js"]
+CMD ["configo", "node", "server.js"]

For this example, we will use an URL as a source for Configo. Other possible sources can be used - check the configuration section below for more information.

Upload your configuration files to your internal HTTP server:

$ curl -sSL https://my.server.com/common.yaml
db:
  mongo:
    uri: mongodb://user:[email protected]/db
  redis:
    uri: redis://some.redis.prod.domain.com/0
twitter:
  key: abcdefg
send_emails: true
$ curl -sSL https://my.server.com/server.yaml
google.analytics.key: UA-XXXXX-Y
$ curl -sSL https://my.server.com/jobs.yaml
run_jobs: true

We are now ready to start our applications:

docker run \
  -e CONFIGO_SOURCE_0='{"type": "http", "format": "yaml", "url": "https://my.server.com/common.yaml"}' \
  -e CONFIGO_SOURCE_100='{"type": "http", "format": "yaml", "url": "https://my.server.com/server.yaml"}' \
  myAppImage

docker run \
  -e CONFIGO_SOURCE_0='{"type": "http", "format": "yaml", "url": "https://my.server.com/common.yaml"}' \
  -e CONFIGO_SOURCE_100='{"type": "http", "format": "yaml", "url": "https://my.server.com/jobs.yaml"}' \
  myAppImage

Since we added Configo, it will now load configuration from the sources we specified. In addition, it will merge these settings and configure the environment variables for your application.

Thanks

More Repositories

1

jabel

Jabel - unlock Javac 9+ syntax when targeting Java 8
Java
800
star
2

liiklus

Reactive (RSocket/gRPC) Gateway for the event-based systems
Java
235
star
3

rx-connect

Glue your state and pure React components with RxJS
JavaScript
85
star
4

forward2docker

Utility to auto forward a port from localhost into ports on Docker containers running in a boot2docker or Docker Machine VM
Go
77
star
5

graphql-java-reactive

Reactive GraphQL execution strategy
Java
54
star
6

MacroGroovy

Groovy
41
star
7

IDEA-GitLab-Integration

Java
32
star
8

spring-boot-thrift

Java
29
star
9

tinsalver

Maven Central release helper to keep your private keys private
JavaScript
26
star
10

groovy-macro-methods

Java
16
star
11

gradle-maven-sync-plugin

Sync your Gradle build with the dependencies from pom.xml
Java
14
star
12

thrift-spring-boot-starter

Java
12
star
13

TLSignals

Signals for objective-c
Objective-C
12
star
14

groovy-pattern-match

Java
11
star
15

redis-maven-plugin

Embedded pure Java redis server for maven
Java
10
star
16

groovy-macro-methods-proposal

Apache Groovy proposal of macro methods implementation
9
star
17

spring-io-testcontainers-workshop

Java
9
star
18

GradleThrift

Groovy
8
star
19

Graxe

Groovy
8
star
20

macro-methods-workshop

Groovy
8
star
21

testcontainers-microservices-example

Java
8
star
22

javaagent-boilerplate

Java
7
star
23

testing-docker-images-with-testcontainers

Groovy
6
star
24

GOM

Groovy Object Mapper
Groovy
6
star
25

blog-custom-Jackson-annotations

https://bsideup.github.io/posts/custom_jackson_annotations/
Java
6
star
26

docker-call

Go
6
star
27

querydsl-gradle-idea

http://bsideup.blogspot.com/2015/04/querydsl-with-gradle-and-idea.html
Java
5
star
28

Vaadlin

Kotlin static DSL for Vaadin
Kotlin
5
star
29

spring-boot-sample-papertrail

Java
5
star
30

TrylogicFramework

flex-like (non flex-based) ActionScript framework for web development (games, social, etc)
ActionScript
4
star
31

AFQuickLookView

AFNetworking Extension for document previews of remote files
Objective-C
3
star
32

concourse-build-env

Dockerfile
2
star
33

healthy-cloud-demo

Healthy cloud for a HealthTech company - AWS Berlin meetup
Python
2
star
34

spring-boot-swift

Java
2
star
35

grpc-bidi

Java
2
star
36

bsideup.github.io

HTML
1
star
37

groovyastconsole

Groovy
1
star
38

TLBindings

Objective-c framework for bindings
Objective-C
1
star
39

OSSRH-60599

1
star
40

TrylogicUtils

Trylogic utils for TrylogicFramework
ActionScript
1
star
41

ecs-drainer

1
star
42

zero-to-cloud-demo

Ruby
1
star
43

TrylogicSignals

Signals for Java
Java
1
star
44

TestFlight-deployer

simple ant script to for deploying your *.ipa to TestFlight
1
star
45

IvyHelper

1
star
46

TLDropDownMenu

Drop down menu category from UINavigationBar for UINavigationController
Objective-C
1
star
47

flexmojos-create-rsl-maven-plugin

RSL creator for FlexMojos 5.*
Java
1
star
48

jmh-async-profiler

1
star
49

JUnitReportPrinter

ant task for printing junitreport's output in readable format (use it with flexunit)
1
star