I am probably missing something here, but what is a good solution for properties versioning?
For example, in a blue-green deployment scenario with property value cha
Spring Cloud Config's Environment
resources are parametrized by three variables:
{application}
maps to spring.application.name
on the client side{profile}
maps to spring.active.profiles
on the client{label}
which is a server side feature labelling a versioned set
of config files.Since in case of Blue-Green deployments, you're using the same application in the same profile, the best option is to use Versioned config files by using git Tags.
The basic idea is to create tags for different versions of config files and tell your application to use configurations related to an specific tag using spring.cloud.config.label
in your bootstrap.properties
.
For example, you can tag two different commits with v1.0
and v2.0
:
And use spring.cloud.config.label=v1.0
for old instance and spring.cloud.config.label=v2.0
for new instance.
as we scale to the config repo to multiple apps and their respective branches evolve into different directions.
In order to avoid this problem, I suggest to only save common and cross application properties in application-{profile}.properties
config files. The better approach is that to each application has its own config file, e.g. recommender.properties
for recommender service and search.properties
for search service. Then you can use profile specific and versioned properties for each of them by defining the appropriate spring.application.name
. This way you can achieve to some level of Single Responsibility Principle in your configuration files.