Fix Docker image builds and local platform setup

Getting the backend running locally in Docker surfaced several issues:

- geedeecee: REGISTRY_HOST came from the unset Gradle property
  'dockerContainerRegistryHost'. A missing value in a MapProperty makes
  the whole map absent, so every generated .env was empty and all
  docker-compose builds failed. Default it to 'localhost'.
- kafka image: dlcdn.apache.org only hosts current releases, so Kafka
  3.3.1 404s. Use archive.apache.org. Replace the deprecated openjdk:11
  base with eclipse-temurin:11-jre, bump the download stage from EOL
  Debian 11 to 12, and drop 'COPY --chmod' so the image builds without
  BuildKit/buildx.
- web-map: the map calls the API and websocket on its own origin
  (/kafkatorio/...), which previously relied on an external reverse
  proxy. Proxy /kafkatorio/ to events-server-web in the map's nginx so
  one port serves everything, and publish that port in the example
  platform compose file.
- docs: the example secret config mapped server IDs to descriptions,
  but the schema is token (JWT 'sub') -> server ID, and both must match
  [a-zA-Z0-9-_]. Descriptions with spaces crashed every service.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Lazzexus 2026-10-12 17:27:11 +02:00
parent ab342caf4d
commit e52ea9d9cf
7 changed files with 29 additions and 11 deletions

View file

@ -31,6 +31,8 @@ services:
container_name: web-map
profiles: [ "infra", "kafkatorio" ]
restart: unless-stopped
ports:
- "12081:80" # web map (also proxies /kafkatorio/ to events-server-web)
networks:
- kafkatorio-infra-nw

View file

@ -3,8 +3,9 @@
jwt-secret: "correct horse battery staple"
# Define the servers that have the Kafkatorio Mod installed.
# The key is the server token: the 'sub' claim of the server's JWT (KAFKATORIO_TOKEN).
# The value is the server ID, used in URLs.
# Both may only contain letters, digits, '-' and '_'.
kafkatorio-servers:
# The key is the short ID, used to uniquely identify a server (used in URLs).
# The value is a description.
short-id-123: "Name of server"
another-id-456: "Name of another server"
short-id-123: "short-id-123"
another-id-456: "another-id-456"

View file

@ -105,7 +105,7 @@ abstract class GDCPlugin @Inject constructor(
extensions.create<GDCSettings>(GDC_EXTENSION_NAME).apply {
composeProjectName.convention(providers.provider { rootProject.name })
composeProjectVersion.convention(providers.provider { project.version.toString() })
containerRegistryHost.convention(providers.gradleProperty("dockerContainerRegistryHost"))
containerRegistryHost.convention(providers.gradleProperty("dockerContainerRegistryHost").orElse("localhost"))
srcDir.convention(layout.projectDirectory.dir("docker"))
dockerBuildContextDir.convention(srcDir.dir("build"))
stateDir.convention(layout.buildDirectory.dir("geedeecee/state/"))

View file

@ -15,7 +15,7 @@ tasks.dockerComposeEnvUpdate {
put("PROMETHEUS_VERSION", libs.versions.prometheus)
put("KAFKA_VERSION", libs.versions.kafka)
put("KAFKA_DL_URL", libs.versions.kafka.map { ver ->
"https://dlcdn.apache.org/kafka/$ver/kafka_2.13-$ver.tgz"
"https://archive.apache.org/dist/kafka/$ver/kafka_2.13-$ver.tgz"
})
put("APP_NAME", "kafka-kraft")
}

View file

@ -11,7 +11,7 @@ services:
context: "."
target: "kafka-kraft"
args:
KAFKA_DL_URL: "https://dlcdn.apache.org/kafka/${KAFKA_VERSION}/kafka_2.13-${KAFKA_VERSION}.tgz"
KAFKA_DL_URL: "https://archive.apache.org/dist/kafka/${KAFKA_VERSION}/kafka_2.13-${KAFKA_VERSION}.tgz"
volumes:
- "./kafka-server.properties:/kafka/server.properties"
# - "./kafka-data:/tmp/kraft-combined-logs" # see Dockerfile

View file

@ -1,9 +1,9 @@
# syntax=docker/dockerfile:1
ARG KAFKA_DL_URL=https://dlcdn.apache.org/kafka/3.1.0/kafka_2.13-3.1.0.tgz
ARG KAFKA_DL_URL=https://archive.apache.org/dist/kafka/3.1.0/kafka_2.13-3.1.0.tgz
## builder ##
FROM debian:11-slim as Kafka-Download
FROM debian:12-slim as Kafka-Download
ARG KAFKA_DL_URL
WORKDIR /kafka
@ -21,7 +21,7 @@ RUN echo "Downloading Kafka from $KAFKA_DL_URL" \
## Kafka ##
# KRaft (aka KIP-500) mode Preview Release
# https://github.com/apache/kafka/blob/041b76dc57f096be2a2d7532d917122992bff6e2/config/kraft/README.md
FROM openjdk:11 as kafka-kraft
FROM eclipse-temurin:11-jre-jammy as kafka-kraft
WORKDIR /kafka
@ -38,7 +38,8 @@ RUN ./bin/kafka-storage.sh random-uuid > cluster_id \
&& echo "Generated a Kafka Cluster ID: $(cat cluster_id)"
COPY ./kafka-server.properties ./server.properties
COPY --chmod=755 ./entrypoint.sh ./entrypoint.sh
COPY ./entrypoint.sh ./entrypoint.sh
RUN chmod 755 ./entrypoint.sh
# launch the broker in KRaft mode, which means that it runs without ZooKeeper
ENTRYPOINT ["/kafka/entrypoint.sh"]

View file

@ -16,6 +16,20 @@ http {
index index.html;
# Docker's internal DNS - resolve the backend lazily, so nginx can start before it
resolver 127.0.0.11 valid=10s;
# proxy REST + WebSocket requests to events-server-web, so the map and the API share an origin
location /kafkatorio/ {
set $events_server_web http://events-server-web:80;
proxy_pass $events_server_web;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
proxy_set_header Host $host;
proxy_read_timeout 1h;
}
location / {
# First attempt to serve request as file, then
# as directory, then fall back to redirecting to index.html