GoCD Configuration repository
GoCD’s configuration is version controlled in a local git repository - config.git hosted on the same machine as the
GoCD server. The repo is available at
<GoCD server installation directory>/db/config.git. Any changes to the config,
either through file-system, API or GoCD configuration UI is saved as a new commit in this repo. This allows auditing of
all changes made to the configuration.
NOTE: This repo must not be altered externally as this will lead to errors in GoCD.
With time, this repository grows in size and can considerably slow down config save operations. One way to
tackle this is to run
git gc manually on the repo (read more). However, doing this
at the wrong time (say, when the server is running and trying to finish a config save operation) can cause problems.
So, GoCD has in-built garbage collection for this git repository and it can be configured to run on a periodic basis. However, since this activity can potentially take a long time to run when GC happens for the first time around, the feature is turned off by default. GoCD server periodically checks if the loose-object count exceeds a preset threshold and displays a warning message. This is a cue for users to enable periodic GC on their servers. Here are the steps you need to follow (and in this order) to enable periodic GC for the config repository:
- Stop the GoCD server.
- Take a backup of the whole
config.gitdirectory (rememeber, there is a hidden .git directory in it)
git gcmanually, once, in that directory as the user that the GoCD server runs under. On Unix/Linux, this is usually the
gouser. Do not run this as the root user. If you do, make sure that you run
chown -R go:go /path/to/config.gitto make sure that the ownership of that directory is proper.
- Once you’ve done that, you can now set these system properties mentioned below, to change the behavior of the
periodic garbage collection. At the very least, you should set the
go.config.repo.gc.periodicsystem property to
Yso that it is enabled.
- Start the server and verify that the properties you’ve set are reflected in the system. The section at the end of this page has details about it.
System properties that affect periodic garbage collection
|System property||Default Value||Description|
||Flag that enables the periodic garbage collection of
||This will cause the GC to run more aggressively. For large repositories, this can take a significant amount of time. It is recommended to set this to
||The cron expression that describes when GC should happen.|
||If loose object count grows beyond this threshold, a warning is displayed in the server health messages popup.|
||Objects older than this period (in hours) will be pruned.|
||Frequency of checking for loose object count, specified in milliseconds with default set to 8 hours.|
To configure the system properties, edit the file
wrapper-properties.conf to add the system properties described above. See the installation documentation for the location of