Config Server automatic refresh of git repository is not working
search cancel

Config Server automatic refresh of git repository is not working

book

Article ID: 418455

calendar_today

Updated On:

Products

VMware Tanzu Platform Core VMware Tanzu Platform Spring

Issue/Introduction

The documentation on Configuring Spring Cloud Services with Git states that the 'refreshRate' default setting is 0 seconds (until v3.3.7) or 60 seconds (from v3.3.8 onwards).  However, the repository clone does not seem to be getting updated at all.

Environment

VMware Tanzu Platform Spring

Cause

The setting that controls the automatic or periodic update of the repository clone is named 'periodic'.  By default, 'periodic' is set to 'false'.  If it is set to 'true', then the Config Server updates the mirror every 5 minutes.

To confirm if the 'periodic' setting is enabled, check the Configuration section in the Config Server's dashboard (its URL can be retrieved from the output of 'cf service $config-server-name').  If the 'periodic' setting is seen among other Configuration settings, then check its value to know if it's enabled or not.  Note that if 'periodic' is not existing, then that means it is using the default setting which is 'false'.

Resolution

Review the parameter settings 'periodic' and 'refreshRate' from the document Configuring Spring Cloud Services with Git.  Also, check out the KB How does SCS Config Server interact with Config Client and Mirror Service to get more information on how these settings work.  Then, decide whether to proceed with enabling the 'periodic' setting.

To update a config-server (to enable the 'periodic' setting), run the 'cf update-service' command similar to the following.  Note that the configuration JSON passed with the '-c' flag needs to be the existing/original configuration plus the periodic setting.  

cf update-service my-config-server -c '{ "git": { "uri": "https://github.com/spring-cloud-samples/config-repo", "periodic": true }, "count": 3}'

Once enabled, then check the Config Server's dashboard again and confirm that the 'periodic=true' setting is now existing.  You should see the refresh being logged every 5 minutes in the log file '/var/vcap/sys/log/mirror-service/mirror-service.stdout.log' in the spring-cloud-services VM.  See the example logs below, where it is logged every 5 minutes.

example logs:

2025-11-04T19:38:21.601Z  INFO 5 --- [   scheduling-1] i.p.s.c.m.refresh.ScheduledRefresh       : Refreshing all mirrors (periodic)
2025-11-04T19:38:21.774Z  INFO 5 --- [   scheduling-1] i.p.s.c.m.refresh.RefreshExecutor        : Updating mirror repo with source uri https://github.com/spring-cloud-samples/config-repo
2025-11-04T19:38:21.777Z  INFO 5 --- [   scheduling-1] i.p.s.c.mirrorservice.mirrors.ShellUtil  : Running shell command: git remote set-url origin https://github.com/spring-cloud-samples/config-repo
2025-11-04T19:38:21.789Z  INFO 5 --- [   scheduling-1] i.p.s.c.mirrorservice.mirrors.ShellUtil  : Running shell command: git fetch origin
2025-11-04T19:38:22.264Z  INFO 5 --- [   scheduling-1] i.p.s.c.mirrorservice.mirrors.ShellUtil  : Running shell command: git rev-parse HEAD
2025-11-04T19:38:22.273Z  INFO 5 --- [   scheduling-1] i.p.s.c.mirrorservice.mirrors.ShellUtil  : 9223983ee48b453a0f8b49b77e94cab598806bb7
2025-11-04T19:43:22.295Z  INFO 5 --- [   scheduling-1] i.p.s.c.m.refresh.ScheduledRefresh       : Refreshing all mirrors (periodic)
2025-11-04T19:43:22.472Z  INFO 5 --- [   scheduling-1] i.p.s.c.m.refresh.RefreshExecutor        : Updating mirror repo with source uri https://github.com/spring-cloud-samples/config-repo
2025-11-04T19:43:22.474Z  INFO 5 --- [   scheduling-1] i.p.s.c.mirrorservice.mirrors.ShellUtil  : Running shell command: git remote set-url origin https://github.com/spring-cloud-samples/config-repo
2025-11-04T19:43:22.496Z  INFO 5 --- [   scheduling-1] i.p.s.c.mirrorservice.mirrors.ShellUtil  : Running shell command: git fetch origin
2025-11-04T19:43:23.007Z  INFO 5 --- [   scheduling-1] i.p.s.c.mirrorservice.mirrors.ShellUtil  : Running shell command: git rev-parse HEAD
2025-11-04T19:43:23.015Z  INFO 5 --- [   scheduling-1] i.p.s.c.mirrorservice.mirrors.ShellUtil  : 9223983ee48b453a0f8b49b77e94cab598806bb7