fix docker-compose.* + .env*

- desktop-app
This commit is contained in:
2025-12-05 14:07:39 +01:00
parent 97baa85a70
commit 7a9795146c
4 changed files with 106 additions and 83 deletions
+9 -20
View File
@@ -7,6 +7,14 @@
PROJECT_NAME=meldestelle PROJECT_NAME=meldestelle
RESTART_POLICY=no RESTART_POLICY=no
# Docker build versions (optional overrides)
DOCKER_VERSION=1.0.0-SNAPSHOT
DOCKER_BUILD_DATE=2025-12-04T15:00:00Z
DOCKER_GRADLE_VERSION=9.1.0
DOCKER_JAVA_VERSION=21
DOCKER_NODE_VERSION=22.21.0
DOCKER_NGINX_VERSION=1.28.0-alpine
# Postgres # Postgres
POSTGRES_IMAGE=postgres:16-alpine POSTGRES_IMAGE=postgres:16-alpine
POSTGRES_USER=pg-user POSTGRES_USER=pg-user
@@ -16,7 +24,6 @@ POSTGRES_PORT=5432:5432
POSTGRES_DB_URL=jdbc:postgresql://postgres:5432/pg-meldestelle-db POSTGRES_DB_URL=jdbc:postgresql://postgres:5432/pg-meldestelle-db
# --- REDIS --- # --- REDIS ---
# Optional password for Redis; leave empty to disable authentication in dev
REDIS_IMAGE=redis:7.4-alpine REDIS_IMAGE=redis:7.4-alpine
REDIS_PASSWORD=redis-password REDIS_PASSWORD=redis-password
REDIS_PORT=6379:6379 REDIS_PORT=6379:6379
@@ -28,12 +35,8 @@ REDIS_SERVER_CONNECT_TIMEOUT=5s
KEYCLOAK_IMAGE_TAG=26.4 KEYCLOAK_IMAGE_TAG=26.4
KC_ADMIN_USERNAME=kc-admin KC_ADMIN_USERNAME=kc-admin
KC_ADMIN_PASSWORD=kc-password KC_ADMIN_PASSWORD=kc-password
# Type der Datenbank (postgres, h2, mariadb, mysql, oracle, mssql)
KC_DB=postgres KC_DB=postgres
# DB Schema 01-init-keycloak-schema.sql
KC_DB_SCHEMA=keycloak KC_DB_SCHEMA=keycloak
# DB Verbindungsparameter
# KC_DB_URL=jdbc:postgresql://postgres:5432/pg-meldestelle-db
KC_HOSTNAME=localhost KC_HOSTNAME=localhost
KC_PORT=8180:8080 KC_PORT=8180:8080
KC_DEBUG_PORT=9000:9000 KC_DEBUG_PORT=9000:9000
@@ -58,10 +61,8 @@ GF_PORT=3000:3000
CONSUL_IMAGE=hashicorp/consul:1.22.1 CONSUL_IMAGE=hashicorp/consul:1.22.1
CONSUL_PORT=8500:8500 CONSUL_PORT=8500:8500
CONSUL_UDP_PORT=8600:8600/udp CONSUL_UDP_PORT=8600:8600/udp
# Zentrale App-Config für Consul (interner Host/Port im Compose-Netz)
CONSUL_HOST=consul CONSUL_HOST=consul
CONSUL_HTTP_PORT=8500 CONSUL_HTTP_PORT=8500
# SPRING-CLOUD-CONSUL
SCLOUD_CONSUL_HOSTNAME=consul SCLOUD_CONSUL_HOSTNAME=consul
SCLOUD_CONSUL_PORT=8500 SCLOUD_CONSUL_PORT=8500
@@ -71,13 +72,9 @@ GATEWAY_DEBUG_PORT=5005:5005
GATEWAY_SERVER_PORT=8081 GATEWAY_SERVER_PORT=8081
GATEWAY_SPRING_PROFILES_ACTIVE=docker GATEWAY_SPRING_PROFILES_ACTIVE=docker
GATEWAY_DEBUG=true GATEWAY_DEBUG=true
# Service-Registrierungsname in Consul (Anzeige in der UI)
GATEWAY_SERVICE_NAME=api-gateway GATEWAY_SERVICE_NAME=api-gateway
# TODO Check Keycloak-URI
# SPRING_SECURITY_OAUTH2_RESOURCESERVER_JWT
SSEC_ISSUER_URI=http://keycloak:8080/realms/meldestelle SSEC_ISSUER_URI=http://keycloak:8080/realms/meldestelle
SSEC_JWK_SET_URI=http://keycloak:8080/realms/meldestelle/protocol/openid-connect/certs SSEC_JWK_SET_URI=http://keycloak:8080/realms/meldestelle/protocol/openid-connect/certs
# SPRING-CLOUD-CONSUL
GATEWAY_CONSUL_HOSTNAME=api-gateway GATEWAY_CONSUL_HOSTNAME=api-gateway
GATEWAY_CONSUL_PREFER_IP=true GATEWAY_CONSUL_PREFER_IP=true
@@ -93,16 +90,8 @@ PING_CONSUL_PREFER_IP=true
# --- WEB-APP --- # --- WEB-APP ---
WEB_APP_PORT=4000:4000 WEB_APP_PORT=4000:4000
DOCKER_NODE_VERSION=22.21.0
DOCKER_NGINX_VERSION=1.28.0-alpine
WEB_BUILD_PROFILE=dev WEB_BUILD_PROFILE=dev
# --- DESKTOP-APP --- # --- DESKTOP-APP ---
DESKTOP_APP_VNC_PORT=5900:5900 DESKTOP_APP_VNC_PORT=5901:5901
DESKTOP_APP_NOVNC_PORT=6080:6080 DESKTOP_APP_NOVNC_PORT=6080:6080
# Docker build versions (optional overrides)
DOCKER_VERSION=1.0.0-SNAPSHOT
DOCKER_BUILD_DATE=2025-12-04T15:00:00Z
DOCKER_GRADLE_VERSION=9.1.0
DOCKER_JAVA_VERSION=21
+40 -40
View File
@@ -2,44 +2,44 @@
# Multi-Stage Dockerfile für Meldestelle Desktop-App (VNC) # Multi-Stage Dockerfile für Meldestelle Desktop-App (VNC)
# =================================================================== # ===================================================================
# =================================================================== # 1. Build Stage (Debian-basiert für Stabilität bei Desktop-Builds)
# Stage 1: Build Stage - Kotlin Desktop-App kompilieren FROM gradle:8-jdk21 AS builder
# ===================================================================
FROM gradle:8-jdk21-alpine AS builder
WORKDIR /app WORKDIR /app
# Kopiere Gradle-Konfiguration und Wrapper # Copy Configs
COPY build.gradle.kts settings.gradle.kts gradle.properties ./ COPY build.gradle.kts settings.gradle.kts gradle.properties ./
COPY gradle ./gradle COPY gradle/ gradle/
COPY gradlew ./ COPY gradlew ./
# Kopiere alle notwendigen Module für Multi-Modul-Projekt # Fix Permissions
COPY frontend ./frontend RUN chmod +x gradlew
COPY backend ./backend
COPY core ./core
COPY domains ./domains
COPY platform ./platform
COPY docs ./docs
# Setze Gradle-Wrapper Berechtigung # Copy Sources (Struktur wie im Web-App Fix)
RUN chmod +x ./gradlew COPY platform/ platform/
COPY core/ core/
COPY backend/ backend/
COPY frontend/ frontend/
COPY docs/ docs/
# Falls du 'domains' oder andere Ordner hast, die in settings.gradle.kts stehen:
# COPY domains/ domains/
# Dependencies downloaden (für besseres Caching) # Dependencies laden
RUN ./gradlew :frontend:shells:meldestelle-portal:dependencies --no-configure-on-demand RUN ./gradlew :frontend:shells:meldestelle-portal:dependencies --no-daemon
# Desktop-App kompilieren (createDistributable für native Distribution) # Desktop-App Distribution erstellen
RUN ./gradlew :frontend:shells:meldestelle-portal:createDistributable --no-configure-on-demand # Wir nutzen 'packageDistributionForCurrentOS' oder 'createDistributable'
RUN ./gradlew :frontend:shells:meldestelle-portal:createDistributable --no-daemon
# =================================================================== # ===================================================================
# Stage 2: Runtime Stage - Ubuntu mit VNC + noVNC # 2. Runtime Stage - Ubuntu (Notwendig für GUI/X11 Libraries)
# =================================================================== # ===================================================================
FROM ubuntu:22.04 FROM ubuntu:22.04
# Verhindere interaktive Installationen
ENV DEBIAN_FRONTEND=noninteractive ENV DEBIAN_FRONTEND=noninteractive
# Installiere System-Dependencies # Installiere X11, VNC, Window Manager und Libraries für Compose Multiplatform
# Compose braucht oft libgl1-mesa-glx, libgtk-3-0, libasound2 etc.
RUN apt-get update && apt-get install -y \ RUN apt-get update && apt-get install -y \
openjdk-21-jdk \ openjdk-21-jdk \
xvfb \ xvfb \
@@ -52,43 +52,43 @@ RUN apt-get update && apt-get install -y \
wget \ wget \
unzip \ unzip \
supervisor \ supervisor \
net-tools \
libgl1-mesa-glx \
libgtk-3-0 \
libasound2 \
&& rm -rf /var/lib/apt/lists/* && rm -rf /var/lib/apt/lists/*
# Arbeitsverzeichnis
WORKDIR /app WORKDIR /app
# Kopiere kompilierte Desktop-App von Build-Stage # Kopiere Build-Ergebnis
COPY --from=builder /app/frontend/shells/meldestelle-portal/build/compose/binaries/main/desktop/ ./desktop-app/ # HINWEIS: Der Pfad muss exakt stimmen. Compose Gradle Plugin Output ist oft verschachtelt.
# Wir kopieren den Inhalt nach /app/desktop-app
COPY --from=builder /app/frontend/shells/meldestelle-portal/build/compose/binaries/main/app/ /app/desktop-app/
# Kopiere Scripts # Scripts (Achte darauf, dass die Pfade im Host stimmen!)
COPY dockerfiles/clients/desktop-app/entrypoint.sh /entrypoint.sh COPY config/frontends/desktop-app/entrypoint.sh /entrypoint.sh
COPY dockerfiles/clients/desktop-app/health-check.sh /opt/health-check.sh COPY config/frontends/desktop-app/health-check.sh /opt/health-check.sh
COPY dockerfiles/clients/desktop-app/supervisord.conf /etc/supervisor/conf.d/supervisord.conf # Wir nutzen vorerst dein Entrypoint-Script, Supervisor Config ist optional wenn Script alles macht
# COPY config/frontends/desktop-app/supervisord.conf /etc/supervisor/conf.d/supervisord.conf
# Setze Permissions
RUN chmod +x /entrypoint.sh /opt/health-check.sh RUN chmod +x /entrypoint.sh /opt/health-check.sh
# Erstelle VNC-User # User Setup
RUN useradd -m -s /bin/bash vncuser && \ RUN useradd -m -s /bin/bash vncuser && \
mkdir -p /home/vncuser/.vnc && \ mkdir -p /home/vncuser/.vnc && \
chown -R vncuser:vncuser /home/vncuser && \ chown -R vncuser:vncuser /home/vncuser && \
chown -R vncuser:vncuser /app chown -R vncuser:vncuser /app
# VNC und noVNC Ports
EXPOSE 5901 6080 EXPOSE 5901 6080
# Environment Variables ENV DISPLAY=:99 \
ENV DISPLAY=:99 VNC_PORT=5901 \
ENV VNC_PORT=5901 NOVNC_PORT=6080 \
ENV NOVNC_PORT=6080 API_BASE_URL="http://api-gateway:8081"
ENV API_BASE_URL=http://api-gateway:8081
# Health-Check
HEALTHCHECK --interval=30s --timeout=10s --start-period=60s --retries=3 \ HEALTHCHECK --interval=30s --timeout=10s --start-period=60s --retries=3 \
CMD /opt/health-check.sh CMD /opt/health-check.sh
# User wechseln
USER vncuser USER vncuser
# Entrypoint
ENTRYPOINT ["/entrypoint.sh"] ENTRYPOINT ["/entrypoint.sh"]
+47 -14
View File
@@ -17,6 +17,8 @@ export DISPLAY=${DISPLAY:-:99}
export VNC_PORT=${VNC_PORT:-5901} export VNC_PORT=${VNC_PORT:-5901}
export NOVNC_PORT=${NOVNC_PORT:-6080} export NOVNC_PORT=${NOVNC_PORT:-6080}
export API_BASE_URL=${API_BASE_URL:-http://api-gateway:8081} export API_BASE_URL=${API_BASE_URL:-http://api-gateway:8081}
# Standard-Passwort setzen, falls keines über ENV kommt
export VNC_PW=${VNC_PW:-meldestelle}
log "Environment:" log "Environment:"
log " DISPLAY: $DISPLAY" log " DISPLAY: $DISPLAY"
@@ -24,11 +26,17 @@ log " VNC_PORT: $VNC_PORT"
log " NOVNC_PORT: $NOVNC_PORT" log " NOVNC_PORT: $NOVNC_PORT"
log " API_BASE_URL: $API_BASE_URL" log " API_BASE_URL: $API_BASE_URL"
# 0. VNC Passwort generieren
log "Generating VNC password..."
mkdir -p /home/vncuser/.vnc
x11vnc -storepasswd "$VNC_PW" /home/vncuser/.vnc/passwd
# Erstelle .Xauthority wenn nicht vorhanden # Erstelle .Xauthority wenn nicht vorhanden
touch /home/vncuser/.Xauthority touch /home/vncuser/.Xauthority
# 1. Starte X11 Virtual Display (Xvfb) # 1. Starte X11 Virtual Display (Xvfb)
log "Starting Xvfb on display $DISPLAY..." log "Starting Xvfb on display $DISPLAY..."
# rm -f /tmp/.X99-lock # Aufräumen falls Container neu gestartet wurde (optional)
Xvfb $DISPLAY -screen 0 1280x1024x24 -ac +extension GLX +render -noreset & Xvfb $DISPLAY -screen 0 1280x1024x24 -ac +extension GLX +render -noreset &
XVFB_PID=$! XVFB_PID=$!
@@ -45,16 +53,37 @@ sleep 5
# 3. Starte VNC Server # 3. Starte VNC Server
log "Starting VNC server on port $VNC_PORT..." log "Starting VNC server on port $VNC_PORT..."
x11vnc -display $DISPLAY -forever -usepw -create -rfbport $VNC_PORT -nopw -shared -bg # WICHTIG: -rfbauth statt -usepw nutzen, um interaktive Abfrage zu vermeiden
x11vnc -display $DISPLAY -forever -rfbauth /home/vncuser/.vnc/passwd -create -rfbport $VNC_PORT -shared -bg
VNC_PID=$! VNC_PID=$!
# 4. Starte noVNC Web Interface # 4. Start noVNC (Websockify)
log "Starting noVNC web interface on port $NOVNC_PORT..." log "Starting noVNC on port $NOVNC_PORT..."
websockify --web=/usr/share/novnc/ $NOVNC_PORT localhost:$VNC_PORT &
NOVNC_PID=$! # Pfad-Korrektur für Ubuntu novnc
WEB_DIR="/usr/share/novnc"
if [ ! -d "$WEB_DIR" ]; then
log "WARNING: $WEB_DIR not found! Searching..."
WEB_DIR=$(find /usr/share -type d -name "novnc" | head -n 1)
fi
# Fix: Index File erstellen, falls es fehlt (Ubuntu hat oft nur vnc.html)
if [ -d "$WEB_DIR" ] && [ ! -f "$WEB_DIR/index.html" ]; then
log "Fixing missing index.html in noVNC..."
if [ -f "$WEB_DIR/vnc.html" ]; then
ln -s "$WEB_DIR/vnc.html" "$WEB_DIR/index.html"
elif [ -f "$WEB_DIR/vnc_lite.html" ]; then
ln -s "$WEB_DIR/vnc_lite.html" "$WEB_DIR/index.html"
fi
fi
log "Serving noVNC from: $WEB_DIR"
# Starte Websockify im Vordergrund, wenn es crasht, sehen wir es
websockify --web="$WEB_DIR" $NOVNC_PORT localhost:$VNC_PORT &
# 5. Warte bis Services bereit sind # 5. Warte bis Services bereit sind
sleep 10 sleep 5
# 6. Starte Desktop-App # 6. Starte Desktop-App
log "Starting Meldestelle Desktop-App..." log "Starting Meldestelle Desktop-App..."
@@ -71,27 +100,30 @@ elif [ -f "client" ]; then
else else
log "ERROR: Desktop-App executable not found!" log "ERROR: Desktop-App executable not found!"
log "Contents of /app/desktop-app:" log "Contents of /app/desktop-app:"
ls -la /app/desktop-app/ ls -R /app/desktop-app/
exit 1 # Wir beenden hier NICHT, damit man debuggen kann (VNC bleibt offen)
log "Keeping VNC open for debugging..."
fi fi
if [ -n "$DESKTOP_APP" ]; then
log "Found desktop app: $DESKTOP_APP" log "Found desktop app: $DESKTOP_APP"
chmod +x "$DESKTOP_APP" chmod +x "$DESKTOP_APP"
# Starte Desktop-App # Starte Desktop-App
./"$DESKTOP_APP" & ./"$DESKTOP_APP" &
APP_PID=$! APP_PID=$!
fi
log "All services started successfully!" log "All services started successfully!"
log "VNC: vnc://localhost:$VNC_PORT" log "VNC: vnc://localhost:$VNC_PORT (Password: $VNC_PW)"
log "noVNC: http://localhost:$NOVNC_PORT/vnc.html" log "noVNC: http://localhost:$NOVNC_PORT/vnc.html"
# Cleanup-Funktion # Cleanup-Funktion
cleanup() { cleanup() {
log "Shutting down services..." log "Shutting down services..."
kill $APP_PID 2>/dev/null || true if [ -n "$APP_PID" ]; then kill $APP_PID 2>/dev/null || true; fi
kill $NOVNC_PID 2>/dev/null || true kill $NOVNC_PID 2>/dev/null || true
kill $VNC_PID 2>/dev/null || true # x11vnc läuft im Background (-bg), PID ist schwerer zu greifen, killall hilft:
pkill x11vnc || true
kill $XFCE_PID 2>/dev/null || true kill $XFCE_PID 2>/dev/null || true
kill $XVFB_PID 2>/dev/null || true kill $XVFB_PID 2>/dev/null || true
exit 0 exit 0
@@ -100,5 +132,6 @@ cleanup() {
# Signal-Handler # Signal-Handler
trap cleanup SIGTERM SIGINT trap cleanup SIGTERM SIGINT
# Warten auf Prozesse # Warten auf Prozesse (unendlich, damit Container nicht stirbt wenn App crasht)
wait $APP_PID # wait $APP_PID
tail -f /dev/null
+2 -1
View File
@@ -358,6 +358,7 @@ services:
aliases: aliases:
- "web-app" - "web-app"
# --- DESKTOP-APP ---
desktop-app: desktop-app:
build: build:
context: . context: .
@@ -371,7 +372,7 @@ services:
environment: environment:
API_BASE_URL: "http://api-gateway:8081" API_BASE_URL: "http://api-gateway:8081"
ports: ports:
- "${DESKTOP_APP_VNC_PORT:-5900:5900}" - "${DESKTOP_APP_VNC_PORT:-5901:5901}"
- "${DESKTOP_APP_NOVNC_PORT:-6080:6080}" - "${DESKTOP_APP_NOVNC_PORT:-6080:6080}"
depends_on: depends_on:
api-gateway: api-gateway: