简体   繁体   English

Spring Cloud Consul 配置版本控制

[英]Spring Cloud Consul Configuration Versioning

I am trying to figure out how are you supposed to be versioning the Consul configurations.我想弄清楚你应该如何对 Consul 配置进行版本控制。

My goal is to be able to prepare the production configurations for the next version without touching the existing ones.我的目标是能够在不触及现有配置的情况下为下一个版本准备生产配置。 And also to be able to revert to the old configurations if I downgrade.如果我降级,还可以恢复到旧配置。

My first and only solution is to use the spring.cloud.consul.config.data-key我的第一个也是唯一的解决方案是使用spring.cloud.consul.config.data-key

By default data-key=data , so the configurations would be:默认情况下data-key=data ,所以配置是:

config/testApp,dev/data
config/testApp/data
config/application,dev/data
config/application/data

I can change the key to be data-key=v1 :我可以将密钥更改为data-key=v1

config/testApp,dev/v1
config/testApp/v1
config/application,dev/v1
config/application/v1

And on every configuration change, I will increment the version and everything should be fine.在每次配置更改时,我都会增加版本,一切都应该没问题。

But my idea breaks when there are many applications sharing the config/application* configurations但是当有许多应用程序共享config/application*配置时,我的想法就中断了

Maybe the solution is to not version the application configurations which is probably not possible with the current version of Spring Cloud Consul.也许解决方案是不对当前版本的 Spring Cloud Consul 可能无法实现的应用程序配置进行版本化。 Or maybe even not having common configurations at all?或者甚至可能根本没有通用配置?

Am I on the right track?我在正确的轨道上吗? Do I need to version my Consul configurations?我需要对我的 Consul 配置进行版本控制吗? How do you manage them?你如何管理它们?

It will easy if you check-in those config(production) in separate repository for example config_DEV, Config_Stage, Config_PROD maintain your repository based on which env it will get deployed.如果您在单独的存储库中签入这些配置(生产),例如 config_DEV、Config_Stage、Config_PROD 将根据将要部署的环境维护您的存储库,这将很容易。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM