0
votes

I am using cloud-config-client in my NodeJS applications to get the external configuration, like Spring Boot application. It works fine, if I start the Node application.

I was looking to auto refresh the configuration in my NodeJS application whenever I push any new configuration or edit the configuration properties in the repo. My Spring Boot applications works fine for auto refresh, because I used "spring-cloud-bus", "spring-cloud-starter-stream-rabbit", "spring-boot-starter-actuator", the @AutoRefresh annotation and bound my spring boot application with RabbitMQ service. I was looking same kind of feature for my Node application, but I could not find any good article on this.

Can anybody help me on this who already used this kind of auto refresh of config for their NodeJS client application? From config properties repo to config-server, it works fine. I can see those new configuration which I pushed in the config repo when I access the config-server URL with application. So, now the only thing is that how my Node client application should refresh themselves without restart.

1

1 Answers

0
votes

While not able to get proper solution, I did one workaround.

I added "/refresh" endpoint in my NodeJS client application where it reload the cloud config, if this endpoint got called. I configured this "/refresh" endpoint to be called in Jenkins pipeline whenever any new configuration properties is added or edited in config-repo. For the time being it solved my problem.

But the issue is that, if my NodeJS client app has multiple instances running on PCF, then how to refreshed all the instances with new/updated config. Incase of Spring Boot application, this is achieved by using "spring-cloud-bus-amqp" plus some other configurations. My current workaround is fine, if you have only one instance of NodeJS client application. If you have multiple instances (say 5 instances) of your client app, then this workaround solution will not work because the above mentioned "/refresh" endpoint will just refresh one instance out of 5 instances.

Any suggestion? As per above workaround, how I can refreshed all the instances of client app?