Skip to content

Commit 04d4d48

Browse files
committed
feat(container): support runtime configuration extensions
1 parent 05be42a commit 04d4d48

2 files changed

Lines changed: 52 additions & 2 deletions

File tree

README.md

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -99,6 +99,53 @@ The `app` module is published as `ghcr.io/openprojectx/yarn-log-api`. It runs as
9999
UID/GID `10001`, listens on port `8080`, uses container-aware JVM memory limits,
100100
and exposes Spring Boot liveness and readiness endpoints.
101101

102+
### Runtime configuration
103+
104+
Spring properties can be overridden using normal environment variables or
105+
command-line arguments:
106+
107+
```bash
108+
docker run --rm -p 9090:9090 \
109+
-e SERVER_PORT=9090 \
110+
-e YARN_LOG_API_POLL_INTERVAL=2s \
111+
ghcr.io/openprojectx/yarn-log-api:latest
112+
113+
docker run --rm -p 9090:9090 \
114+
ghcr.io/openprojectx/yarn-log-api:latest \
115+
--server.port=9090 \
116+
--yarn-log-api.poll-interval=2s
117+
```
118+
119+
The image adds `optional:file:/config/` to Spring's configuration search path.
120+
Mount `application.yaml`, profile-specific files, or an entire configuration
121+
directory there:
122+
123+
```bash
124+
docker run --rm -p 8080:8080 \
125+
-e SPRING_PROFILES_ACTIVE=production \
126+
-v /path/to/config:/config:ro \
127+
ghcr.io/openprojectx/yarn-log-api:latest
128+
```
129+
130+
You can replace `SPRING_CONFIG_ADDITIONAL_LOCATION` at runtime if a different
131+
location is required. `JAVA_TOOL_OPTIONS` is also honored by the JVM for options
132+
such as trust stores, Kerberos diagnostics, or Java agents.
133+
134+
The image classpath contains `/etc/hadoop/conf` and `/app/extensions/*`. Mount
135+
extra JARs into the extension directory when adding a filesystem provider,
136+
Spring auto-configuration, metrics exporter, or another runtime integration:
137+
138+
```bash
139+
docker run --rm -p 8080:8080 \
140+
-v /path/to/extensions:/app/extensions:ro \
141+
-v /path/to/config:/config:ro \
142+
ghcr.io/openprojectx/yarn-log-api:latest
143+
```
144+
145+
Classpath extensions execute with the application and can replace transitive
146+
classes. Only mount trusted, version-compatible JARs, and ensure all mounted
147+
files are readable by UID/GID `10001`.
148+
102149
Run against a non-Kerberos cluster by mounting the Hadoop client configuration:
103150

104151
```bash

app/build.gradle.kts

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,8 +49,11 @@ jib {
4949
ports = listOf("8080")
5050
user = "10001:10001"
5151
workingDirectory = "/app"
52-
extraClasspath = listOf("/etc/hadoop/conf")
53-
volumes = listOf("/etc/hadoop/conf", "/etc/security/keytabs")
52+
extraClasspath = listOf("/etc/hadoop/conf", "/app/extensions/*")
53+
volumes = listOf("/config", "/app/extensions", "/etc/hadoop/conf", "/etc/security/keytabs")
54+
environment = mapOf(
55+
"SPRING_CONFIG_ADDITIONAL_LOCATION" to "optional:file:/config/",
56+
)
5457
jvmFlags = listOf(
5558
"-XX:InitialRAMPercentage=25.0",
5659
"-XX:MaxRAMPercentage=75.0",

0 commit comments

Comments
 (0)