|
| 1 | +--- |
| 2 | +description: This page explains configuration file structure |
| 3 | +--- |
| 4 | + |
| 5 | +# Configuration file |
| 6 | + |
| 7 | +Let's start with that there are two possible ways to configure the app, they can interchange each other or even supplement each other. |
| 8 | + |
| 9 | +There are two ways: YAML config & env. variables config. We **strongly** recommend using YAML in favor of env variables for the most part of the config. You can use env vars to override the default config on some different environments. |
| 10 | + |
| 11 | +[This tool](https://env.simplestep.ca/) can help you to translate your config back and forth from YAML to env vars. |
| 12 | + |
| 13 | +We will mostly provide examples of configs in YAML format, but sometimes single properties might be written in form of env variables. |
| 14 | + |
| 15 | +Rather than writing your config from a scratch, it would be more convenient to use one of the ready-to-go [compose examples](compose-examples.md) and adjust it to your needs. |
| 16 | + |
| 17 | +#### Providing a config path for the app instance: |
| 18 | + |
| 19 | +**Docker**: `docker run -it -p 8080:8080 -e spring.config.additional-location=/tmp/config.yml -v /tmp/kui/config.yml:/tmp/config.yml provectuslabs/kafka-ui` |
| 20 | + |
| 21 | +**Docker compose**:  |
| 22 | + |
| 23 | +``` |
| 24 | +services: |
| 25 | + kafka-ui: |
| 26 | + container_name: kafka-ui |
| 27 | + image: provectuslabs/kafka-ui:latest |
| 28 | + environment: |
| 29 | + KAFKA_CLUSTERS_0_NAME: local |
| 30 | + # other properties, omitted |
| 31 | + spring.config.additional-location: /roles.yml |
| 32 | + volumes: |
| 33 | + - /tmp/roles.yml:/roles.yml |
| 34 | +``` |
| 35 | + |
| 36 | +**Jar**: `java -Dspring.config.additional-location=<path-to-application-local.yml> -jar <path-to-jar>.jar` |
| 37 | + |
| 38 | +#### Basic config structure |
| 39 | + |
| 40 | +```yaml |
| 41 | +sh |
| 42 | +kafka: |
| 43 | + clusters: |
| 44 | + - |
| 45 | + name: local |
| 46 | + bootstrapServers: localhost:29091 |
| 47 | + schemaRegistry: http://localhost:8085 |
| 48 | + schemaRegistryAuth: |
| 49 | + username: username |
| 50 | + password: password |
| 51 | +# schemaNameTemplate: "%s-value" |
| 52 | + metrics: |
| 53 | + port: 9997 |
| 54 | + type: JMX |
| 55 | +``` |
| 56 | +
|
| 57 | +* `name`: cluster name |
| 58 | +* `bootstrapServers`: where to connect |
| 59 | +* `schemaRegistry`: schemaRegistry's address |
| 60 | +* `schemaRegistryAuth.username`: schemaRegistry's basic authentication username |
| 61 | +* `schemaRegistryAuth.password`: schemaRegistry's basic authentication password |
| 62 | +* `schemaNameTemplate`: how keys are saved to Schema Registry |
| 63 | +* `metrics.port`: open the JMX port of a broker |
| 64 | +* `metrics.type`: Type of metrics, either JMX or PROMETHEUS. Defaulted to JMX. |
| 65 | +* `readOnly`: enable read-only mode |
| 66 | + |
| 67 | +Configure as many clusters as you need by adding their configs below separated with `-`. |
0 commit comments