All Projects → hyness → spring-cloud-config-server

hyness / spring-cloud-config-server

Licence: Apache-2.0 license
Docker build of the spring-cloud-config-server

Programming Languages

kotlin
9241 projects

Projects that are alternatives of or similar to spring-cloud-config-server

spring-petclinic-microservices
Distributed version of Spring Petclinic built with Spring Cloud
Stars: ✭ 55 (-3.51%)
Mutual labels:  spring-cloud-config-server

Spring Cloud Config Server

A docker image of Spring Cloud Config Server.

CI Build Docker Image Version (latest semver) Docker Stars Docker Pulls Image Size License

Supported tags

  • 3.1.4-jre8, 3.1-jre8, jre8
  • 3.1.4-jdk8, 3.1-jdk8, jdk8
  • 3.1.4-jre11, 3.1-jre11, jre11, 3.1.4, 3.1, latest
  • 3.1.4-jdk11, 3.1-jdk11, jdk11
  • 3.1.4-jre17, 3.1-jre17, jre17
  • 3.1.4-jdk17, 3.1-jdk17, jdk17
Build updates for 3.1+
  • Default image is based on Java 11.
  • Java 8 support is deprecated, and will be removed in a future release
  • JRE builds are now available and the default for latest, 3.1, 3.1.4

Usage

docker run -it --name=spring-cloud-config-server \
      -p 8888:8888 \
      -v </path/to/config>:/config \
      hyness/spring-cloud-config-server

Parameters

  • -p 8888 Server port
  • -v /config Mounted configuration

Environment Variables

  • JAVA_OPTS Specify VM Options or System Properties

Configuring Spring Cloud Config Server

Spring Cloud Config Server is a normal Spring Boot application, it can be configured through all the ways a Spring Boot application can be configured. You may use environment variables or you can mount configuration in the provided volume. The configuration file must be named application and may be a properties or yaml file. See the Spring Boot documentation for further information on how to use and configure Spring Boot.

Configuration examples

Using a mounted config directory

docker run -it -p 8888:8888 \
      -v /path/to/config/dir:/config \
      hyness/spring-cloud-config-server

Using a mounted application.yml

docker run -it -p 8888:8888 \
      -v /path/to/application.yml:/config/application.yml \
      hyness/spring-cloud-config-server

Configure through environment variables without a configuration file

docker run -it -p 8888:8888 \
      -e SPRING_CLOUD_CONFIG_SERVER_GIT_URI=https://github.com/spring-cloud-samples/config-repo \
      hyness/spring-cloud-config-server

Configure through system properties without a configuration file

docker run -it -p 8888:8888 \
      -e JAVA_OPTS=-Dspring.cloud.config.server.git.uri=https://github.com/spring-cloud-samples/config-repo \
      hyness/spring-cloud-config-server

Configure through command line arguments without a configuration file

docker run -it -p 8888:8888 \
      hyness/spring-cloud-config-server \
      --spring.cloud.config.server.git.uri=https://github.com/spring-cloud-samples/config-repo

Verify Samples Above

$ curl http://localhost:8888/foo/development

Required Backend Configuration

Spring Cloud Config Server requires that you configure a backend to serve your configuration files. There are currently 6 backends to choose from...

Git

Remote git repo example

docker run -it -p 8888:8888 \
      -e SPRING_CLOUD_CONFIG_SERVER_GIT_URI=https://github.com/spring-cloud-samples/config-repo \
      hyness/spring-cloud-config-server

Local git repo example

docker run -it -p 8888:8888 \
      -v /path/to/config/files/dir:/config \
      -e SPRING_CLOUD_CONFIG_SERVER_GIT_URI=file:/config/my-local-git-repo \
      hyness/spring-cloud-config-server

Filesystem

docker run -it -p 8888:8888 \
      -v /path/to/config/files/dir:/config \
      -e SPRING_PROFILES_ACTIVE=native \
      hyness/spring-cloud-config-server

Vault

docker run -it -p 8888:8888 \
      -e SPRING_PROFILES_ACTIVE=vault \
      -e SPRING_CLOUD_CONFIG_SERVER_VAULT_HOST=localhost \
      -e SPRING_CLOUD_CONFIG_SERVER_VAULT_TOKEN=00000000-0000-0000-0000-000000000000 \
      hyness/spring-cloud-config-server

AWS Parameter Store

docker run -it -p 8888:8888 \
      -e SPRING_PROFILES_ACTIVE=awsparamstore \
      -e SPRING_CLOUD_CONFIG_SERVER_AWSPARAMSTORE_REGION=us-east-1 \
      hyness/spring-cloud-config-server

AWS S3

docker run -it -p 8888:8888 \
      -e SPRING_PROFILES_ACTIVE=awss3 \
      -e SPRING_CLOUD_CONFIG_SERVER_AWSS3_REGION=us-east-1 \
      -e SPRING_CLOUD_CONFIG_SERVER_AWSS3_BUCKET=sample-bucket \
      hyness/spring-cloud-config-server

AWS Secrets Manager

docker run -it -p 8888:8888 \
      -e SPRING_PROFILES_ACTIVE=awssecretsmanager \
      -e SPRING_CLOUD_CONFIG_SERVER_AWSSECRETSMANAGER_REGION=us-east-1 \
      hyness/spring-cloud-config-server

Redis

docker run -it -p 8888:8888 \
      -e SPRING_PROFILES_ACTIVE=redis \
      -e SPRING_REDIS_HOST=localhost
      -e SPRING_REDIS_PORT=6379
      hyness/spring-cloud-config-server

JDBC

docker run -it -p 8888:8888 \
      -e SPRING_PROFILES_ACTIVE=jdbc \
      -e SPRING_DATASOURCE_URL=jdbc:postgresql://localhost:5432/database_name \
      -e SPRING_DATASOURCE_USERNAME=myuser \
      -e SPRING_DATASOURCE_PASSWORD=mypassword \
      hyness/spring-cloud-config-server

Supported Databases

  • Firebird
  • MariaDB
  • MS-SQL
  • Postgres

See the docker-compose examples for more details

Additional Features

Push notifications with Spring Cloud Bus

Spring Cloud Bus links the nodes of a distributed system with a lightweight message broker. It allows clusters of applications configured with RefreshScope to automatically reload configuration without restarting.

See the Spring Cloud Conifg and Spring Cloud Bus documentation for more details

Supported Message Brokers

Kafka

docker run -it -p 8888:8888 \
      -e SPRING_PROFILES_ACTIVE=cloud-bus-kafka \
      -e SPRING_CLOUD_CONFIG_SERVER_GIT_URI=https://github.com/spring-cloud-samples/config-repo \
      -e SPRING_KAFKA_BOOTSTRAP-SERVERS=localhost:9092 \
      hyness/spring-cloud-config-server

RabbitMQ

docker run -it -p 8888:8888 \
      -e SPRING_PROFILES_ACTIVE=cloud-bus-rabbit \
      -e SPRING_CLOUD_CONFIG_SERVER_GIT_URI=https://github.com/spring-cloud-samples/config-repo \
      -e SPRING_RABBITMQ_HOST=localhost \
      hyness/spring-cloud-config-server

Actuator

The Spring Boot actuator is enabled by default. See the Spring Boot documentation for configuration options. The actuator can be disabled entirely by including the no-actuator profile

Prometheus Metrics

To enable support for an additional prometheus metrics endpoint, enable the prometheus endpoint, as well as ensuring the endpoint is exposed.

docker run -it -p 8888:8888 \
      -v /path/to/config/files/dir:/config \
      -e SPRING_CLOUD_CONFIG_SERVER_GIT_URI=file:/config/my-local-git-repo \
      -e MANAGEMENT_ENDPOINT_PROMETHEUS_ENABLED=true \
      -e MANAGEMENT_ENDPOINTS_WEB_EXPOSURE_INCLUDE=* \
      hyness/spring-cloud-config-server

Security

Spring Security can be enabled through the security profile.

Basic Security

docker run -it -p 8888:8888 \
      -e SPRING_PROFILES_ACTIVE=security \
      -e SPRING_SECURITY_USER_NAME=myuser -e SPRING_SECURITY_USER_PASSWORD=mypassword \
      hyness/spring-cloud-config-server

Thank You

Project Contributors

Thank you to all of the contributors who have helped make this project better through code contributions and bug reports.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].