refactoring Single Source of Truth

This commit is contained in:
2025-09-13 22:04:20 +02:00
parent caaa4114ee
commit 8eb7e6f773
26 changed files with 5544 additions and 169 deletions
+1 -1
View File
@@ -1,7 +1,7 @@
# ===================================================================
# Clients Docker Build Arguments - dockerfiles/clients/*
# Source: docker/versions.toml [categories.clients]
# Last updated: 2025-09-13 12:51:22 UTC
# Last updated: 2025-09-13 18:33:34 UTC
# ===================================================================
# --- Include Global Arguments ---
+6 -1
View File
@@ -1,7 +1,7 @@
# ===================================================================
# Global Docker Build Arguments - Used by all categories
# Source: docker/versions.toml
# Last updated: 2025-09-13 12:51:22 UTC
# Last updated: 2025-09-13 18:33:34 UTC
# ===================================================================
# --- Build Tools ---
@@ -17,3 +17,8 @@ DOCKER_APP_VERSION
ALPINE_VERSION=3.19
ECLIPSE_TEMURIN_JDK_VERSION=21-jdk-alpine
ECLIPSE_TEMURIN_JRE_VERSION=21-jre-alpine
# --- Monitoring & Infrastructure Services ---
DOCKER_PROMETHEUS_VERSION=v2.54.1
DOCKER_GRAFANA_VERSION=11.3.0
DOCKER_KEYCLOAK_VERSION=26.0.7
+1 -1
View File
@@ -1,7 +1,7 @@
# ===================================================================
# Infrastructure Docker Build Arguments - dockerfiles/infrastructure/*
# Source: docker/versions.toml [categories.infrastructure]
# Last updated: 2025-09-13 12:51:22 UTC
# Last updated: 2025-09-13 18:33:34 UTC
# ===================================================================
# --- Include Global Arguments ---
+1 -1
View File
@@ -1,7 +1,7 @@
# ===================================================================
# Services Docker Build Arguments - dockerfiles/services/*
# Source: docker/versions.toml [categories.services]
# Last updated: 2025-09-13 12:51:22 UTC
# Last updated: 2025-09-13 18:33:34 UTC
# ===================================================================
# --- Include Global Arguments ---
+619
View File
@@ -0,0 +1,619 @@
{
"$schema": "http://json-schema.org/draft-07/schema#",
"$id": "https://meldestelle.at/schemas/docker-versions.json",
"title": "Docker Versions TOML Schema",
"description": "Schema for docker/versions.toml - centralized Docker version management",
"type": "object",
"properties": {
"versions": {
"type": "object",
"description": "Central version definitions for all Docker components",
"properties": {
"gradle": {
"type": "string",
"pattern": "^[0-9]+\\.[0-9]+\\.[0-9]+$",
"description": "Gradle version for build tools",
"examples": ["9.0.0", "8.14.0"]
},
"java": {
"type": "string",
"pattern": "^[0-9]+$",
"description": "Java version (LTS recommended)",
"examples": ["21", "17", "11"]
},
"node": {
"type": "string",
"pattern": "^[0-9]+\\.[0-9]+\\.[0-9]+$",
"description": "Node.js version for client builds",
"examples": ["20.12.0", "18.19.0"]
},
"nginx": {
"type": "string",
"pattern": "^[0-9]+\\.[0-9]+-alpine$",
"description": "Nginx version with Alpine base",
"examples": ["1.25-alpine", "1.24-alpine"]
},
"alpine": {
"type": "string",
"pattern": "^[0-9]+\\.[0-9]+$",
"description": "Alpine Linux base image version",
"examples": ["3.19", "3.18"]
},
"eclipse-temurin-jdk": {
"type": "string",
"pattern": "^[0-9]+-jdk-alpine$",
"description": "Eclipse Temurin JDK image tag",
"examples": ["21-jdk-alpine", "17-jdk-alpine"]
},
"eclipse-temurin-jre": {
"type": "string",
"pattern": "^[0-9]+-jre-alpine$",
"description": "Eclipse Temurin JRE image tag",
"examples": ["21-jre-alpine", "17-jre-alpine"]
},
"prometheus": {
"type": "string",
"pattern": "^v[0-9]+\\.[0-9]+\\.[0-9]+$",
"description": "Prometheus monitoring version",
"examples": ["v2.54.1", "v2.47.0"]
},
"grafana": {
"type": "string",
"pattern": "^[0-9]+\\.[0-9]+\\.[0-9]+$",
"description": "Grafana visualization version",
"examples": ["11.3.0", "10.1.0"]
},
"keycloak": {
"type": "string",
"pattern": "^[0-9]+\\.[0-9]+\\.[0-9]+$",
"description": "Keycloak authentication version",
"examples": ["26.0.7", "25.0.6"]
},
"spring-profiles-default": {
"type": "string",
"enum": ["default", "dev", "test", "prod"],
"description": "Default Spring profile for infrastructure services"
},
"spring-profiles-docker": {
"type": "string",
"enum": ["docker", "dev", "test", "prod"],
"description": "Spring profile for Docker containers"
},
"spring-profiles-prod": {
"type": "string",
"enum": ["prod", "production"],
"description": "Spring profile for production environment"
},
"app-version": {
"type": "string",
"pattern": "^[0-9]+\\.[0-9]+\\.[0-9]+$",
"description": "Application version for all services",
"examples": ["1.0.0", "2.1.3"]
}
},
"required": [
"gradle",
"java",
"node",
"nginx",
"alpine",
"prometheus",
"grafana",
"keycloak",
"app-version"
],
"additionalProperties": false
},
"service-ports": {
"type": "object",
"description": "Centralized port definitions for all services",
"properties": {
"api-gateway": {
"type": "integer",
"minimum": 8081,
"maximum": 8081,
"description": "API Gateway port"
},
"auth-server": {
"type": "integer",
"minimum": 8087,
"maximum": 8087,
"description": "Authentication server port"
},
"monitoring-server": {
"type": "integer",
"minimum": 8088,
"maximum": 8088,
"description": "Monitoring server port"
},
"ping-service": {
"type": "integer",
"minimum": 8082,
"maximum": 8082,
"description": "Ping service port"
},
"members-service": {
"type": "integer",
"minimum": 8083,
"maximum": 8083,
"description": "Members service port"
},
"horses-service": {
"type": "integer",
"minimum": 8084,
"maximum": 8084,
"description": "Horses service port"
},
"events-service": {
"type": "integer",
"minimum": 8085,
"maximum": 8085,
"description": "Events service port"
},
"masterdata-service": {
"type": "integer",
"minimum": 8086,
"maximum": 8086,
"description": "Masterdata service port"
},
"postgres": {
"type": "integer",
"minimum": 5432,
"maximum": 5432,
"description": "PostgreSQL database port"
},
"redis": {
"type": "integer",
"minimum": 6379,
"maximum": 6379,
"description": "Redis cache port"
},
"keycloak": {
"type": "integer",
"minimum": 8180,
"maximum": 8180,
"description": "Keycloak authentication port"
},
"consul": {
"type": "integer",
"minimum": 8500,
"maximum": 8500,
"description": "Consul service discovery port"
},
"zookeeper": {
"type": "integer",
"minimum": 2181,
"maximum": 2181,
"description": "Zookeeper coordination port"
},
"kafka": {
"type": "integer",
"minimum": 9092,
"maximum": 9092,
"description": "Kafka messaging port"
},
"prometheus": {
"type": "integer",
"minimum": 9090,
"maximum": 9090,
"description": "Prometheus monitoring port"
},
"grafana": {
"type": "integer",
"minimum": 3000,
"maximum": 3000,
"description": "Grafana visualization port"
},
"web-app": {
"type": "integer",
"minimum": 4000,
"maximum": 4000,
"description": "Web application port"
},
"desktop-app-vnc": {
"type": "integer",
"minimum": 5901,
"maximum": 5901,
"description": "Desktop app VNC port"
},
"desktop-app-novnc": {
"type": "integer",
"minimum": 6080,
"maximum": 6080,
"description": "Desktop app noVNC web port"
}
},
"required": [
"api-gateway",
"auth-server",
"monitoring-server",
"ping-service",
"postgres",
"redis",
"keycloak",
"prometheus",
"grafana",
"web-app"
],
"additionalProperties": false
},
"port-ranges": {
"type": "object",
"description": "Port range definitions for service categories",
"properties": {
"infrastructure": {
"type": "string",
"pattern": "^[0-9]+-[0-9]+$",
"description": "Port range for infrastructure services",
"examples": ["8081-8088"]
},
"services": {
"type": "string",
"pattern": "^[0-9]+-[0-9]+$",
"description": "Port range for application services",
"examples": ["8082-8099"]
},
"monitoring": {
"type": "string",
"pattern": "^[0-9]+-[0-9]+$",
"description": "Port range for monitoring services",
"examples": ["9090-9099"]
},
"clients": {
"type": "string",
"pattern": "^[0-9]+-[0-9]+$",
"description": "Port range for client applications",
"examples": ["4000-4099"]
},
"vnc": {
"type": "string",
"pattern": "^[0-9]+-[0-9]+$",
"description": "Port range for VNC connections",
"examples": ["5901-5999"]
},
"debug": {
"type": "string",
"pattern": "^[0-9]+-[0-9]+$",
"description": "Port range for debug connections",
"examples": ["5005-5009"]
},
"system-reserved": {
"type": "string",
"pattern": "^[0-9]+-[0-9]+$",
"description": "System reserved port range",
"examples": ["0-1023"]
},
"ephemeral": {
"type": "string",
"pattern": "^[0-9]+-[0-9]+$",
"description": "Ephemeral port range",
"examples": ["32768-65535"]
}
},
"required": [
"infrastructure",
"services",
"monitoring",
"clients",
"debug"
],
"additionalProperties": false
},
"build-args": {
"type": "object",
"description": "Build argument categories for different service types",
"properties": {
"global": {
"type": "array",
"description": "Global build arguments used by all services",
"items": {
"type": "string",
"enum": [
"GRADLE_VERSION",
"JAVA_VERSION",
"BUILD_DATE",
"VERSION"
]
},
"uniqueItems": true
},
"spring-services": {
"type": "array",
"description": "Spring Boot service-specific build arguments",
"items": {
"type": "string",
"enum": [
"SPRING_PROFILES_ACTIVE",
"SERVICE_PATH",
"SERVICE_NAME",
"SERVICE_PORT"
]
},
"uniqueItems": true
},
"web-clients": {
"type": "array",
"description": "Web client-specific build arguments",
"items": {
"type": "string",
"enum": [
"NODE_VERSION",
"NGINX_VERSION",
"CLIENT_PATH",
"CLIENT_MODULE",
"CLIENT_NAME"
]
},
"uniqueItems": true
}
},
"required": ["global"],
"additionalProperties": false
},
"categories": {
"type": "object",
"description": "Service category configurations",
"properties": {
"services": {
"type": "object",
"properties": {
"default-spring-profile": {
"type": "string",
"enum": ["docker", "dev", "test", "prod"]
},
"default-port-start": {
"type": "integer",
"minimum": 8082,
"maximum": 8099
},
"services": {
"type": "array",
"items": {
"type": "string",
"enum": [
"ping-service",
"members-service",
"horses-service",
"events-service",
"masterdata-service"
]
},
"uniqueItems": true
}
},
"required": ["services"],
"additionalProperties": false
},
"infrastructure": {
"type": "object",
"properties": {
"default-spring-profile": {
"type": "string",
"enum": ["default", "dev", "test", "prod"]
},
"services": {
"type": "array",
"items": {
"type": "string",
"enum": [
"gateway",
"auth-server",
"monitoring-server"
]
},
"uniqueItems": true
}
},
"required": ["services"],
"additionalProperties": false
},
"clients": {
"type": "object",
"properties": {
"default-node-version": {
"type": "string",
"pattern": "^[0-9]+\\.[0-9]+\\.[0-9]+$"
},
"default-nginx-version": {
"type": "string",
"pattern": "^[0-9]+\\.[0-9]+-alpine$"
},
"clients": {
"type": "array",
"items": {
"type": "string",
"enum": [
"web-app",
"desktop-app"
]
},
"uniqueItems": true
}
},
"required": ["clients"],
"additionalProperties": false
}
},
"required": ["services", "infrastructure", "clients"],
"additionalProperties": false
},
"environment-mapping": {
"type": "object",
"description": "Maps internal version names to environment variable names",
"properties": {
"gradle-version": {
"type": "string",
"enum": ["DOCKER_GRADLE_VERSION"]
},
"java-version": {
"type": "string",
"enum": ["DOCKER_JAVA_VERSION"]
},
"node-version": {
"type": "string",
"enum": ["DOCKER_NODE_VERSION"]
},
"nginx-version": {
"type": "string",
"enum": ["DOCKER_NGINX_VERSION"]
},
"prometheus-version": {
"type": "string",
"enum": ["DOCKER_PROMETHEUS_VERSION"]
},
"grafana-version": {
"type": "string",
"enum": ["DOCKER_GRAFANA_VERSION"]
},
"keycloak-version": {
"type": "string",
"enum": ["DOCKER_KEYCLOAK_VERSION"]
},
"spring-profiles-default": {
"type": "string",
"enum": ["DOCKER_SPRING_PROFILES_DEFAULT"]
},
"spring-profiles-docker": {
"type": "string",
"enum": ["DOCKER_SPRING_PROFILES_DOCKER"]
},
"app-version": {
"type": "string",
"enum": ["DOCKER_APP_VERSION"]
}
},
"required": [
"gradle-version",
"java-version",
"node-version",
"nginx-version",
"prometheus-version",
"grafana-version",
"keycloak-version",
"app-version"
],
"additionalProperties": false
},
"environments": {
"type": "object",
"description": "Environment-specific configurations",
"properties": {
"development": {
"$ref": "#/definitions/environment-config"
},
"production": {
"$ref": "#/definitions/environment-config"
},
"testing": {
"$ref": "#/definitions/environment-config"
}
},
"required": ["development", "production", "testing"],
"additionalProperties": false
}
},
"required": [
"versions",
"service-ports",
"port-ranges",
"build-args",
"categories",
"environment-mapping",
"environments"
],
"additionalProperties": false,
"definitions": {
"environment-config": {
"type": "object",
"description": "Environment-specific configuration settings",
"properties": {
"spring-profiles": {
"type": "string",
"enum": ["dev", "test", "prod", "docker"],
"description": "Default Spring profiles for this environment"
},
"debug-enabled": {
"type": "boolean",
"description": "Whether debug mode is enabled"
},
"log-level": {
"type": "string",
"enum": ["TRACE", "DEBUG", "INFO", "WARN", "ERROR"],
"description": "Default log level for services"
},
"health-check-interval": {
"type": "string",
"pattern": "^[0-9]+s$",
"description": "Health check interval (e.g., '30s')"
},
"health-check-timeout": {
"type": "string",
"pattern": "^[0-9]+s$",
"description": "Health check timeout (e.g., '5s')"
},
"health-check-retries": {
"type": "integer",
"minimum": 1,
"maximum": 10,
"description": "Number of health check retries"
},
"health-check-start-period": {
"type": "string",
"pattern": "^[0-9]+s$",
"description": "Health check start period (e.g., '40s')"
},
"resource-limits": {
"type": "boolean",
"description": "Whether to enforce resource limits"
},
"jvm-debug-port": {
"oneOf": [
{
"type": "integer",
"minimum": 5005,
"maximum": 5009
},
{
"type": "boolean",
"enum": [false]
}
],
"description": "JVM debug port (5005-5009) or false to disable"
},
"hot-reload": {
"type": "boolean",
"description": "Whether hot reload is enabled for development"
},
"security-headers": {
"type": "boolean",
"description": "Whether to add security headers (production)"
},
"tls-enabled": {
"type": "boolean",
"description": "Whether TLS/SSL is enabled (production)"
},
"ephemeral-storage": {
"type": "boolean",
"description": "Whether to use ephemeral storage (testing)"
},
"test-containers": {
"type": "boolean",
"description": "Whether test containers are used (testing)"
}
},
"required": [
"spring-profiles",
"debug-enabled",
"log-level",
"health-check-interval",
"health-check-timeout",
"health-check-retries",
"health-check-start-period",
"resource-limits",
"jvm-debug-port",
"hot-reload"
],
"additionalProperties": false
}
}
}
+98
View File
@@ -17,6 +17,11 @@ alpine = "3.19"
eclipse-temurin-jdk = "21-jdk-alpine"
eclipse-temurin-jre = "21-jre-alpine"
# --- Monitoring & Infrastructure Services ---
prometheus = "v2.54.1"
grafana = "11.3.0"
keycloak = "26.0.7"
# --- Spring Configuration ---
spring-profiles-default = "default"
spring-profiles-docker = "docker"
@@ -25,6 +30,52 @@ spring-profiles-prod = "prod"
# --- Application Versions ---
app-version = "1.0.0"
# --- Zentrale Port-Verwaltung ---
# Single Source of Truth für alle Service-Ports
[service-ports]
# --- Infrastructure Services ---
api-gateway = 8081
auth-server = 8087
monitoring-server = 8088
# --- Application Services ---
ping-service = 8082
members-service = 8083
horses-service = 8084
events-service = 8085
masterdata-service = 8086
# --- External Services ---
postgres = 5432
redis = 6379
keycloak = 8180
consul = 8500
zookeeper = 2181
kafka = 9092
# --- Monitoring Stack ---
prometheus = 9090
grafana = 3000
# --- Client Applications ---
web-app = 4000
desktop-app-vnc = 5901
desktop-app-novnc = 6080
[port-ranges]
# --- Port-Range-Definitionen für automatische Port-Zuweisung ---
infrastructure = "8081-8088"
services = "8082-8099"
monitoring = "9090-9099"
clients = "4000-4099"
vnc = "5901-5999"
debug = "5005-5009"
# --- Reserved Port Ranges ---
system-reserved = "0-1023"
ephemeral = "32768-65535"
[build-args]
# --- Global Build Arguments (used across all categories) ---
global = [
@@ -89,6 +140,53 @@ gradle-version = "DOCKER_GRADLE_VERSION"
java-version = "DOCKER_JAVA_VERSION"
node-version = "DOCKER_NODE_VERSION"
nginx-version = "DOCKER_NGINX_VERSION"
prometheus-version = "DOCKER_PROMETHEUS_VERSION"
grafana-version = "DOCKER_GRAFANA_VERSION"
keycloak-version = "DOCKER_KEYCLOAK_VERSION"
spring-profiles-default = "DOCKER_SPRING_PROFILES_DEFAULT"
spring-profiles-docker = "DOCKER_SPRING_PROFILES_DOCKER"
app-version = "DOCKER_APP_VERSION"
[environments]
# --- Environment-spezifische Konfigurationen ---
# Zentrale Verwaltung für dev/test/prod Umgebungen
[environments.development]
spring-profiles = "dev"
debug-enabled = true
log-level = "DEBUG"
health-check-interval = "30s"
health-check-timeout = "5s"
health-check-retries = 3
health-check-start-period = "40s"
resource-limits = false
jvm-debug-port = 5005
hot-reload = true
[environments.production]
spring-profiles = "prod"
debug-enabled = false
log-level = "INFO"
health-check-interval = "15s"
health-check-timeout = "3s"
health-check-retries = 3
health-check-start-period = "30s"
resource-limits = true
jvm-debug-port = false
hot-reload = false
security-headers = true
tls-enabled = true
[environments.testing]
spring-profiles = "test"
debug-enabled = true
log-level = "DEBUG"
health-check-interval = "10s"
health-check-timeout = "5s"
health-check-retries = 2
health-check-start-period = "20s"
resource-limits = false
jvm-debug-port = 5005
hot-reload = false
ephemeral-storage = true
test-containers = true