A containerized, externalized and centralized configuration server implemented with Spring Cloud Config and Docker.
External clients request the config server about their configuration files. The config server fetches data from a remote Git repository and feeds it back to the requesting clients.
- Config Repo
Follow the instructions at Docker Hub or:
- Clone this repository:
$ git clone https://github.com/bandrefilipe/config-server.git
- Navigate into the
config-server
directory:
$ cd config-server
- Build the docker image:
$ docker build [OPTIONS] .
e.g.
$ docker build -t bandrefilipe/config-server .
- Create the docker container:
$ docker create [OPTIONS] IMAGE [ARG...]
e.g.
$ docker create -p 9999:8888 -e GIT_URI={url} -e GIT_USERNAME={username} -e GIT_PASSWORD={secret} --name config-server bandrefilipe/config-server
Consider using an env-file.
- Run the docker container:
$ docker start [OPTIONS] CONTAINER [CONTAINER...]
e.g.
$ docker start -a config-server
The application exposes a few customizable parameters which can be passed as environment variables during container creation (step 4, right above):
PARAMETER | DEFAULT | DESCRIPTION |
---|---|---|
GIT_URI |
n/a | (REQUIRED) The Git repository's URI from which the config server shall fetch clients' property files. |
GIT_USERNAME |
n/a | (REQUIRED) The Git repository's username. |
GIT_PASSWORD |
n/a | (REQUIRED) The Git repository's password. |
GIT_TIMEOUT |
4 |
The time, in seconds, that the config server will wait to acquire an HTTP connection. |
GIT_SKIP_SSL_VALIDATION |
false |
The config server's validation of the Git server's SSL certificate. |
GIT_SEARCH_PATHS |
{application} |
Refer to the Spring Cloud Config Server's documentation for the use of the git.searchPaths property. |
GIT_FORCE_PULL |
true |
Dictates if either the config server shall force pulling the remote repository content or not. |
GIT_DELETE_UNTRACKED_BRANCHES |
true |
Refer to the Spring Cloud Config Server's documentation for the use of the git.deleteUntrackedBranches property. |
GIT_REFRESH_RATE |
0 |
The time, in seconds, in which the config server will fetch updated configuration data from the Git repository. The default value (0 ) means: only when requested by clients. |
GIT_BASEDIR |
/tmp/.config-repo |
The location in which the checked out or cloned git or svn files will be stored. This location resides inside the container. It's of no use changing it, unless if you want to specify a custom location when creating a docker volume for local, non-volatile, file storage. |
Check, if necessary, the bootstrap.properties file for further documentation.