Spring cloud config returns old configutaion - spring-cloud

I'm using spring cloud config together with spring cloud bus.
I set up a webhook from my git repository (hosted in bitbucket) to notify the config server when a push occurs. In order to reduce throughput and use a minimal caching I set the refresh rate for 2 minutes:
spring.cloud.config.server.git.refresh-rate=120
Now when I push to the repository, the config server is being notified via the webhook and send a message to the clients. The client is asking for the configuration again from the server, but because the refresh rate is set to two minutes, and the notifications chain is faster the configuration server returns the previous configuration.
Is there a way to cancel the refresh rate on a webhook (a request to /monitor)? Maybe other way to overcome this issue?

Related

Refreshed spring cloud server overrides not refreshed for clients

Goal:
Call actuators refresh endpoint to reload an override specified in spring cloud config server
Background:
Spring cloud config server provides a way to push out default configuration to all clients through the overrides property (https://cloud.spring.io/spring-cloud-config/single/spring-cloud-config.html#_property_overrides)
spring.cloud.config.server.overrides.foo=bar
Spring actuator provides a /refresh endpoint to reload configuration properties while the application is running.
Problem:
When a new override is pushed into spring cloud config server and the refresh point refreshes that property, the override value is not updated.
Therefore, an update like spring.cloud.config.server.overrides.foo=baz shows baz under actuators /env endpoint, but the clients still see foo=bar.
Question:
Is this just a missing feature of spring cloud config server?

Spring Cloud Gateway — Route Refreshing via Schedule

I have a Spring-Cloud-Gateway app (V. Finchley.SR1) and need the routing config to be externalized and refreshable. I'm currently able to configure the Gateway to pull config from a Cloud-Config app and refresh the routes by hitting the /actuator/refresh endpoint on the cloud app. However, I'd like to configure the route refresh to be automatic via a schedule rather than requiring a client to POST to /actuator/refresh. How can this be achieved?

using pact-broker webhooks locally?

I have setup the pact broker locally and able to publish the pacts which are also verified by the provider successfully. I am at the point to use webhook which kicks off a build of the provider project if the pact content has changed since the previous version. Can I use the webhook concept in my local because my consumer and provider are not configured in CI?
You'll need to create a local "CI server" on your machine. It doesn't really have to be a proper CI server, but it does have to be able to accept an HTTP request that will kick off a build somehow.
You should be able to create a very simple ruby/javascript/python HTTP server that will run the provider build in a backgrounded process when it receives a request. Or, you could install a copy of something like Jenkins locally.

Refresh of Zuul configuration when using Spring Config Service

We have a Zuul proxy (wraped with Spring Cloud/Boot) deployed that fetches configuration from the Spring Config Server. Every time I do changes in the routes I restart Zuul application and I wonder if there is a better approach that can be taken (like refresh of Zuul config information)? :)
Thank you,
You can issue a refresh command via rest:
curl -X POST http://<host>:<port>/refresh
I wrote a simple bash script that commits all my changes to the config file in the Git repository and then issue curl request to all my services.
If you wanted to be fancy you could write a script that first queries your Eureka server to get the list of all services and then refresh them all :)
Zuul Routes could be dynamically refreshed when configuring them in a Git backend for instance, fronted by Spring Cloud Config server and Spring Cloud Bus.
I have covered this scenario in a recent blog post Routing requests and dynamically refreshing routes using Spring Cloud Zuul Server
For #1, Spring cloud config introduced the #RefreshScope annotation which will expose the /refresh endpoint (over HTTP or JMX)
For #2, after '/refresh', spring cloud config will take the latest git commit, For the config changes, essentially there are two ways, 1) pull the changes 2) push the changes, spring cloud bus approach is based on the rabbitmq to push the config changes.
Check out this article
And this also
Many respositories such as github are able to configure Webhook POST endpoints.
Besides the previously mentioned way of manually executing a request to the /refresh endpoint, you could configure your github config repository to use the /request endpoint as the webhook endpoint. That way, you could automatically refresh the properties on push.

Setup Github Webhook for AWS EC2 server

I have a webapp deployed in aws ec2 instance. I recently got to know about Github Webhook. Now i am trying to setup webhook service for my ec2 server. Can someone pls give a walk-through about:
1. How to receive the webhook payload for server endpoint.
2. What will be the Payload URL that one have to write in github webhook service.
First you need to go to your repo, and click through this sequence:
Settings -> Webhooks & Services -> Add webhook
Then paste the url where github will submit data for each new commit. You can find examples of payload in example.
Then implement the logic needed in the backend to work with info about new commits.