Configuration
The main configuration file is located at conf/dogma.json, with most properties set to their sensible
defaults:
{
"dataDir": "./data",
"ports": [
{
"localAddress": {
"host": "*",
"port": 36462
},
"protocols": [
"http"
]
}
],
"tls": null,
"encryption": null,
"trustedProxyAddresses": null,
"clientAddressSources": null,
"numWorkers": null,
"maxNumConnections": null,
"requestTimeoutMillis": null,
"idleTimeoutMillis": null,
"maxFrameLength": null,
"numRepositoryWorkers": 16,
"maxRemovedRepositoryAgeMillis": null,
"repositoryCacheSpec": "maximumWeight=134217728,expireAfterAccess=5m",
"rateLimiting": {},
"webAppEnabled": true,
"webAppTitle": null,
"gracefulShutdownTimeout": {
"quietPeriodMillis": 1000,
"timeoutMillis": 10000
},
"replication": {
"method": "NONE"
},
"accessLogFormat": "common",
"authentication": null,
"cors": null,
"pluginConfigs": [
{
"type": "com.linecorp.centraldogma.server.mirror.MirroringServicePluginConfig",
"enabled": true,
"numMirroringThreads": null,
"maxNumFilesPerMirror": null,
"maxNumBytesPerMirror": null,
"trustedHostKeys": null
}
],
"management": {
"address": "127.0.0.1",
"port": 36463,
"protocol": null,
"path": null
},
"zone": null
}
Core properties
-
dataDir(string)- the path to the data directory which contains the repositories served by Central Dogma and other stateful data. Can be a relative path from the root directory of the distribution.
-
ports-
the server ports that serve the incoming requests.
-
localAddress- the bind address of server socket.-
host(string)- the IP address or
*to bind to all network interfaces.
- the IP address or
-
port(integer)- the port number. 36462 is preferred.
-
-
protocols(string array)- protocols which are served on the port.
http,httpsandproxyare supported.
- protocols which are served on the port.
-
-
tls- the configuration for Transport Layer Security(TLS) support. Specify
nullto disable TLS. See Configuring TLS for more information.
- the configuration for Transport Layer Security(TLS) support. Specify
-
encryption-
the configuration for repository encryption at rest. Defaults to
null(disabled). Requires aKeyWrapperimplementation. Once enabled for a data directory, encryption must remain enabled. See Encryption at rest for setup, migration and key management. -
enabled(boolean)- whether to enable encrypted repository storage. Defaults to
false.
- whether to enable encrypted repository storage. Defaults to
-
kekId(string)- the key encryption key (KEK) identifier. Required when
enabledistrue.
- the key encryption key (KEK) identifier. Required when
-
encryptSessionCookie(boolean)- whether to encrypt session cookies. Defaults to
falseand takes effect only whenenabledistrue.
- whether to encrypt session cookies. Defaults to
-
-
trustedProxyAddresses(string array)- the addresses or ranges of Classless Inter-domain Routing (CIDR)
blocks of trusted proxy servers. e.g.
10.0.0.1for a single address or10.0.0.0/8for a CIDR block. WithtrustedProxyAddressesandclientAddressSourcesproperties, you can get a client address who initiated a request from the access log. Ifnullor an empty array, the remote address of the connection is used as a client address.
- the addresses or ranges of Classless Inter-domain Routing (CIDR)
blocks of trusted proxy servers. e.g.
-
clientAddressSources(string array)- the HTTP header names to be used for retrieving a client address.
PROXY_PROTOCOLis a reserved keyword for getting the source address specified in a PROXY protocol message. By default,forwarded,x-forwarded-forandPROXY_PROTOCOLare used whentrustedProxyAddressesis configured. Otherwise, the remote address of the connection is used as a client address.
- the HTTP header names to be used for retrieving a client address.
-
numWorkers(integer)- the number of I/O worker threads. If
null, the default value of<numCpuCores> * 2is used.
- the number of I/O worker threads. If
-
maxNumConnections(integer)- the maximum number of TCP/IP connections that can be handled concurrently.
Any connection attempts that make the number of connections exceed this value will be rejected immediately.
If
null, no limit is enforced.
- the maximum number of TCP/IP connections that can be handled concurrently.
Any connection attempts that make the number of connections exceed this value will be rejected immediately.
If
-
requestTimeoutMillis(integer)- the maximum number of milliseconds allowed for handling a request.
If a request takes more than this, the server may respond with a
503 Service Unavailableresponse. Ifnull, the default value of '10000 milliseconds' (10 seconds) is used.
- the maximum number of milliseconds allowed for handling a request.
If a request takes more than this, the server may respond with a
-
idleTimeoutMillis(integer)- the number of milliseconds before closing an idle connection.
The server will close the connection if it stays idle for more than this without any pending requests.
If
null, the default value of '15000 milliseconds' (15 seconds) is used.
- the number of milliseconds before closing an idle connection.
The server will close the connection if it stays idle for more than this without any pending requests.
If
-
maxFrameLength(integer)- the maximum length of request content. If a client sends a request whose content
is longer than this, the server may respond with a
413 Request Entity Too Largeresponse. Ifnull, the default value of '1048576 bytes' (1 MiB) is used.
- the maximum length of request content. If a client sends a request whose content
is longer than this, the server may respond with a
-
numRepositoryWorkers(integer)- the number of worker threads dedicated to handling repository reads and writes.
If
null, the default value of '16 threads' is used.
- the number of worker threads dedicated to handling repository reads and writes.
If
-
maxRemovedRepositoryAgeMillis(integer)- the maximum allowed age of removed projects and repositories before they are purged.
Set 0 to disable automatic purge.
If
null, the default value of '604800000 milliseconds' (7 days) is used.
- the maximum allowed age of removed projects and repositories before they are purged.
Set 0 to disable automatic purge.
If
-
repositoryCacheSpec(string)- the cache specification string which determines the capacity and behavior of the repository access cache. Refer to the Caffeine API documentation for more information. Note that the weight of the cache has been tuned to be roughly proportional to its memory usage.
-
rateLimiting(object)- the global and ordered repository limits for content pushes and reverts on each server.
Defaults to
{}(disabled). See Rate limiting.
- the global and ordered repository limits for content pushes and reverts on each server.
Defaults to
-
webAppEnabled(boolean)- whether to enable the web-based administrative console. Enabled by default.
-
webAppTitle(string)- the title text which is displayed on the navigation bar of the web-based administrative console.
If
null, the default value ofCentral Dogma at {{hostname}}is used. Note that{{hostname}}will be replaced with the actual hostname that the server is running on.
- the title text which is displayed on the navigation bar of the web-based administrative console.
If
-
gracefulShutdownTimeout-
the amount of time to wait after the initiation of shutdown procedure for requests to go away before the actual shutdown of the server.
-
quietPeriodMillis(integer)- the number of milliseconds to wait for active requests to go end before shutting down. 0 means the server will stop right away without waiting.
-
timeoutMillis(integer)- the number of milliseconds to wait before shutting down the server regardless of active requests.
This should be set to a time greater than
quietPeriodMillisto ensure the server shuts down even if there is a stuck request.
- the number of milliseconds to wait before shutting down the server regardless of active requests.
This should be set to a time greater than
-
-
replication-
the replication configuration.
-
method(string)- the replication method.
NONEindicates 'standalone mode' without replication. See Configuring replication to learn how to configure ZooKeeper-based multi-master replication.
- the replication method.
-
-
accessLogFormat(string)- the format to be used for writing an access log.
commonandcombinedare pre-defined for NCSA common log format and NCSA combined log format, respectively. Also, a custom log format can be specified here. Read Writing an access log for more information. Specifynullto disable access logging feature.
- the format to be used for writing an access log.
-
authentication- the authentication configuration. If
null, the authentication is disabled. See Authentication and access control to learn how to configure the authentication layer.
- the authentication configuration. If
-
cors-
specify
nullto disable CORS entirely. -
allowedOrigins(string or string array)- the list of origins which are allowed a lenient CORS policy. If the literal value
*is specified then all origins are allowed.
- the list of origins which are allowed a lenient CORS policy. If the literal value
-
maxAgeSeconds(integer)- how long in seconds the results of a preflight request can be cached. If not specified then the default
value
7200is applied.
- how long in seconds the results of a preflight request can be cached. If not specified then the default
value
-
-
pluginConfigs- the list of plugin configuration. See Configuring plugins for more information.
-
management-
the management server configuration. Read ManagementService API documentation to know more about the management service.
-
port(integer)- the port number of the management service.
If
0, the management service uses the same port as the main service.
- the port number of the management service.
If
-
address(string)-
the IP address of the management service. If
null, the management will listen to all network interfaces. -
this option is ignored if
portis set to0.
-
-
protocol-
the protocol of the management service.
httpandhttpsare supported. If not specified,httpis used. -
this option is ignored if
portis set to0.
-
-
path- the path of the management service. If not specified, the management service is mounted at
/internal/management.
- the path of the management service. If not specified, the management service is mounted at
-
-
zone-
the zone information of the server. If not specified,
PluginTarget.ZONE_LEADER_ONLYcan't be used. -
currentZone(string)-
the current zone name. If the value starts with
env:, the environment variable is used as the zone name. For example, if the value isenv:ZONE_NAME, the environment variable namedZONE_NAMEis used as the zone name. -
You can also dynamically load a zone name by implementing
ConfigValueConverter.
-
-
allZones(string array)-
the list of zone names.
-
the current zone name must be included in the list of zone names.
-
-
Rate limiting
Use rateLimiting to limit HTTP API v1 content pushes and reverts on each server:
"rateLimiting": {
"global": { "requests": 10000, "timeUnit": "DAYS" },
"repositories": [
{ "pattern": "payments/config", "requests": 20, "timeUnit": "MINUTES" },
{ "pattern": "payments/blocked", "requests": 0, "timeUnit": "MINUTES" },
{ "pattern": "payments/unlimited", "requests": -1, "timeUnit": "MINUTES" },
{ "pattern": "payments/.*", "requests": 200, "timeUnit": "HOURS" },
{ "pattern": ".*", "requests": 100, "timeUnit": "HOURS" }
]
}
global is an optional budget shared by all repositories on one server. repositories is an optional,
ordered list of rules. The global limit omits pattern; every repository rule requires it.
Patterns are Java regular expressions matching the entire projectName/repoName;
the first matching rule wins. Each repository has its own budget, even when repositories match the same
rule. Pushes and reverts share both budgets.
Use requests: -1 for unlimited requests or requests: 0 to reject all requests. Values below -1 are
invalid. timeUnit is required but has no effect for these two values.
After authentication and repository authorization, the repository limit is checked before the global
limit. A repository rejection does not consume a global token. A global rejection retains the repository
token already consumed. Tokens are not refunded if an admitted request fails. A matching repository rule
with -1 or 0 still wins over later rules. An unmatched or unlimited repository still uses the global
budget. Omitting rateLimiting or setting it to {} disables all limits.
The content.push.rate.limiting.requests counter tracks passed and rejected checks, tagged by scope
(repository or global) and pattern (empty for the global limit). A request passing the repository
check but rejected globally increments repository passed and global rejected.
Configuring replication
Central Dogma features multi-master replication which allows a client to push commits to any of the available replicas, and thus it’s possible to update the settings of your application even when all replicas but one are down. The clients will automatically connect to an available replica.
Central Dogma implements multi-master replication by embedding Apache ZooKeeper. You may find it useful to have some prior administrative knowledge of ZooKeeper although it is not required. For more information about ZooKeeper administration, see ZooKeeper administrator's guide
To enable replication, you need to update the replication section of conf/dogma.json. The following
example shows the configuration of the first replica in a 3-replica cluster:
{
...
"replication" : {
"method": "ZOOKEEPER",
"serverId": 1,
"servers": {
"1": {
"host": "replica1.example.com",
"quorumPort": 36463,
"electionPort": 36464,
"groupId": null,
"weight": null
},
"2": {
"host": "replica2.example.com",
"quorumPort": 36463,
"electionPort": 36464,
"groupId": null,
"weight": null
},
"3": {
"host": "replica3.example.com",
"quorumPort": 36463,
"electionPort": 36464,
"groupId": null,
"weight": null
}
},
"secret": "CHANGE_ME",
"additionalProperties": {},
"timeoutMillis": null,
"numWorkers": null,
"minimumLogCount": null,
"maximumLogCount": null,
"minLogAgeMillis": null
}
}
CHANGE_ME is intentionally invalid. Replace it with a unique secret before starting any replica.
-
method(string)- the replication method.
ZOOKEEPERindicates Central Dogma will provide multi-master replication by embedding Apache ZooKeeper.
- the replication method.
-
serverId(integer)-
the unique positive integer ID of the replica. Be careful not to use a duplicate ID or not to change this value after joining the cluster. If
nullor unspecified, theserverIdis auto-detected from the server list in theserverssection.noteInternally, this value is used as the
myidof the embedded ZooKeeper peer.
-
-
servers-
a map whose key is the
serverIdof a replica in the cluster and whose value is a map which contains the properties required to connect to each other:-
host(string)- the host name or IP address of the replica
-
quorumPort(integer)- the TCP/IP port number which is used by ZooKeeper for reaching consensus
-
electionPort(integer)- the TCP/IP port number which is used by ZooKeeper for leader election
-
groupId(integer)- the group ID which is used by ZooKeeper for
hierarchical quorums
If
nullor unspecified, hierarchical quorums are disabled.
- the group ID which is used by ZooKeeper for
hierarchical quorums
If
-
weight(integer)- the weight of the replica which is used by ZooKeeper for hierarchical quorums
If
nullor unspecified,1is used by default. IfgroupIdisnull, this value will be ignored.
- the weight of the replica which is used by ZooKeeper for hierarchical quorums
If
-
-
It is highly recommended to have more than 3, preferably odd number of, replicas because the consensus algorithm requires more than half of all replicas to agree with each other to function correctly. If you had 2 replicas, losing just one replica would make your cluster stop to function.
-
-
secret(string)- the secret string which is used for replicas to authenticate each other. The replicas in the same
cluster must have the same secret. This property is required when ZooKeeper replication is enabled.
The secret must be at least 16 characters long. Generate a different random secret for each cluster with
openssl rand -hex 32. You can secure this property by hiding sensitive property values.
- the secret string which is used for replicas to authenticate each other. The replicas in the same
cluster must have the same secret. This property is required when ZooKeeper replication is enabled.
The secret must be at least 16 characters long. Generate a different random secret for each cluster with
-
allowInsecureSecret(boolean)- if
true, allows the use of an insecure or missingsecretfor backward compatibility. When enabled with nosecretset, the legacy default value is used with a warning. This property is deprecated and will be removed in a future release. It is strongly recommended to set a propersecretinstead of relying on this flag.
- if
-
additionalProperties(map of string key-value pairs)- ZooKeeper configuration properties.
Currently,
initLimit,syncLimit,tickTime,syncEnabled,autopurge.snapRetainCount,autopurge.purgeInterval, andquorumListenOnAllIPscan be set. It is recommended to leave this properties empty because Central Dogma sets the sensible defaults.
- ZooKeeper configuration properties.
Currently,
-
timeoutMillis(integer)- the ZooKeeper timeout, in milliseconds. If
nullor unspecified, the default value of '1000 milliseconds' (1 second) is used.
- the ZooKeeper timeout, in milliseconds. If
-
numWorkers(integer)- the number of worker threads dedicated for replication. If
nullor unspecified, the default value of '16 threads' is used.
- the number of worker threads dedicated for replication. If
-
minimumLogCount(integer)-
the target number of log items to keep in ZooKeeper. Note that the log entries will still not be removed if they are younger than
minLogAgeMillis. Ifnullor unspecified, the default value of '1024 log entries' is used. -
The old name
maxLogCountis accepted for compatibility, but is deprecated. Do not specify both names.
-
-
maximumLogCount(integer)- the observed log count at which new writes fail with an HTTP 500 replication error.
If
nullor unspecified, the default isInteger.MAX_VALUE, effectively disabling the threshold. Concurrent writes on different paths can exceed it. It must be greater thanminimumLogCount.
- the observed log count at which new writes fail with an HTTP 500 replication error.
If
-
minLogAgeMillis(integer)- the minimum allowed age of log items before they are removed from ZooKeeper. If
nullor unspecified, the default value of '86400000 milliseconds' (1 day) is used.
- the minimum allowed age of log items before they are removed from ZooKeeper. If
Configuring TLS
Central Dogma supports TLS for its API and web pages. To enable TLS, a user may configure tls property
in dogma.json as follows.
{
"dataDir": "./data",
"ports": [
{
"localAddress": {
"host": "*",
"port": 36462
},
"protocols": [
"https"
]
}
],
"tls": {
"keyCertChain": "file:./cert/centraldogma.crt",
"key": "file:./cert/centraldogma.key",
"keyPassword": null
},
"trustedProxyAddresses": null,
"clientAddressSources": null,
"numWorkers": null,
"maxNumConnections": null,
"requestTimeoutMillis": null,
"idleTimeoutMillis": null,
"maxFrameLength": null,
"numRepositoryWorkers": 16,
"repositoryCacheSpec": "maximumWeight=134217728,expireAfterAccess=5m",
"webAppEnabled": true,
"webAppTitle": null,
"gracefulShutdownTimeout": {
"quietPeriodMillis": 1000,
"timeoutMillis": 10000
},
"replication": {
"method": "NONE"
},
"accessLogFormat": "common",
"authentication": null
}
-
tls-
the configuration for TLS support. It will be applied to the port which is configured with
httpsprotocol. Ifnull, a self-signed certificate will be generated forhttpsprotocol. -
keyCertChain(string)- the content of the certificate chain. If you want to use a file, specify
file:<path>. You can secure this property by hiding sensitive property values.
- the content of the certificate chain. If you want to use a file, specify
-
key(string)- the content of the private key. If you want to use a file, specify
file:<path>. You can secure this property by hiding sensitive property values.
- the content of the private key. If you want to use a file, specify
-
keyPassword(string)- the password of the private key file. Specify
nullif no password is set. Note thatnull(no password) and"null"(password is 'null') are different. You can secure this property by hiding sensitive property values.
- the password of the private key file. Specify
-
If you run your Central Dogma with TLS, you need to enable TLS on the client side as well. In case of
Java client, call the useTls() method when building a CentralDogma instance:
CentralDogma dogma = new ArmeriaCentralDogmaBuilder()
.host("centraldogma.example.com", 8443)
.accessToken("appToken-********")
.useTls()
.build();
Configuring plugins
Central Dogma supports installing a plugin that runs on Central Dogma servers. You can configure the plugin
with pluginConfigs property in dogma.json as follows.
{
"dataDir": "./data",
"ports": [
{
"localAddress": {
"host": "*",
"port": 36462
},
"protocols": [
"https"
]
}
],
...
"pluginConfigs": [
{
"type": "com.linecorp.centraldogma.server.mirror.MirroringServicePluginConfig",
"enabled": true,
"numMirroringThreads": null,
"maxNumFilesPerMirror": null,
"maxNumBytesPerMirror": null,
"zonePinned": false,
"trustedHostKeys": {
"github.com": [
"SHA256:+DiY3wvvV6TuJJhbpZisF/zLDA0zPMSvHdkr4UvCOqU"
]
}
}
]
}
Each configuration in pluginConfigs must have type that specifies the fully qualified class name of
the plugin configuration class. The plugin configuration class must implement the PluginConfig interface
that requires enabled property. The plugin configuration class can have additional properties that are
specific to the plugin. The example above shows the configuration of the mirroring plugin and here are the
properties that can be configured:
-
numMirroringThreads(integer)- the number of worker threads dedicated to periodic mirroring tasks. If
null, the default value of '16 threads' is used.
- the number of worker threads dedicated to periodic mirroring tasks. If
-
maxNumFilesPerMirror(integer)- the maximum allowed number of files in a mirror. If a Git repository contains more files than this,
Central Dogma will reject to mirror the Git repository. If
null, the default value of '8192 files' is used.
- the maximum allowed number of files in a mirror. If a Git repository contains more files than this,
Central Dogma will reject to mirror the Git repository. If
-
maxNumBytesPerMirror(integer)- the maximum allowed number of bytes in a mirror. If the total size of the files in a Git repository exceeds
this, Central Dogma will reject to mirror the Git repository. If
null, the default value of '33554432 bytes' (32 MiB) is used.
- the maximum allowed number of bytes in a mirror. If the total size of the files in a Git repository exceeds
this, Central Dogma will reject to mirror the Git repository. If
-
zonePinned(boolean)- whether the mirroring plugin is pinned to a specific zone. If
true, a mirroring task will be executed only in the specified zone. Iffalse, the plugin will be executed in the leader replica.
- whether the mirroring plugin is pinned to a specific zone. If
-
trustedHostKeys(object)-
a map of hostname to a list of trusted SSH host key fingerprints (SHA-256) for
git+ssh://mirrors. When an SSH mirror connects to a remote server, the server's host key fingerprint is verified against this list. If the fingerprint does not match any trusted key, the connection is rejected.If
nullor empty, SSH mirrors will accept any host key without verification and log a warning. It is strongly recommended to configure this property for all SSH mirror hosts.You can obtain a host's fingerprint by running:
ssh-keyscan <hostname> 2>/dev/null | ssh-keygen -lf - -E sha256ssh-keyscandoes not authenticate the key it retrieves. Before trusting the fingerprint, verify it out of band against the fingerprint published by the Git host owner.Example:
"trustedHostKeys": {"github.com": ["SHA256:+DiY3wvvV6TuJJhbpZisF/zLDA0zPMSvHdkr4UvCOqU","SHA256:uNiVztksCsDhcc0u9e8BujQXVUpKZIDTMczCvj3tD2s"],"git.example.com": ["SHA256:nThbg6kXUpJWGl7E1IGOCspRomTxdCARLviKw6E5SY8"]}
-
For more information about mirroring, refer to Mirroring.
Hiding sensitive property values
Central Dogma supports property value substitution through the use of
ConfigValueConverter.
If you want to hide sensitive information such as tls.keyPasswords, you can implement the converting logic
with your own ConfigValueConverter and register it via
SPI:
- Your configuration file:
{
"tls": {
"keyCertChain": "file:./cert/centraldogma.crt",
"key": "file:./cert/centraldogma.key",
"keyPassword": "encryption:encrypted-password"
}
}
- Your converter:
import com.linecorp.centraldogma.server.ConfigValueConverter;
public class MyConfigValueConverter implements ConfigValueConverter {
@Override
public List<String> supportedPrefixes() {
return List.of("encryption");
}
@Override
public String convert(String prefix, String value) {
assert "encryption".equals(prefix);
if ("encrypted-password".equals(value)) {
// return the decrypted password that is stored in a safe place such as Vault.
}
...
}
}
This feature enables you to enhance the security of your Central Dogma configuration by avoiding the exposure of sensitive information. Below is a list of properties that can be substituted:
replication.secrettls.keyCertChaintls.keytls.keyPasswordauthentication.properties.keyStore.password(when SAML is used.)authentication.properties.keyStore.keyPasswords(when SAML is used.)