chore(ci): Align GH Workflows with Docker SSoT, new paths; minimal SSoT guard; staticAnalysis (#23)

* chore(MP-21): snapshot pre-refactor state (Epic 1)

* chore(MP-22): scaffold new repo structure, relocate Docker Compose, move frontend/backend modules, update Makefile; add docs mapping and env template

* MP-22 Epic 2: Erfolgreich umgesetzt und verifiziert

* MP-23 Epic 3: Gradle/Build Governance zentralisieren

* MP-23 Epic 3: Gradle/Build Governance zentralisieren

* chore(devops)!: Docker-SSoT (.env) konsolidiert, Compose-Mounts ergänzt, Makefile entfernt

- ENV Single Source of Truth
  - docker/.env.example neu (inkl. REDIS_PASSWORD, Ports, Build-Overrides)
  - config/.env(.example) als DEPRECATED markiert (Verweis auf docker/.env[.example])

- Docker Compose vereinheitlicht (docker/docker-compose.yaml)
  - Postgres: zentralen postgresql.conf mounten (../config/postgres/postgresql.conf)
    und Start mit -c config_file=/etc/postgresql/postgresql.conf
  - Redis: zentralen redis.conf mounten (../config/redis/redis.conf)
    und Start via "redis-server … ${REDIS_PASSWORD:+--requirepass $REDIS_PASSWORD}"
  - Web-Nginx: ../config/nginx/nginx.prod.conf → /etc/nginx/nginx.conf (ro)
  - Monitoring: Prometheus/Grafana nutzen ../config/monitoring/* als SSoT

- Frontend/DI/Network (MP-23 Grundlage)
  - :frontend:core:network Modul mit Koin `apiClient` (Ktor + JSON/Retry/Timeout/Logging)
  - Plattform-Basis-URL-Auflösung (JVM: ENV API_BASE_URL; JS: globalThis.API_BASE_URL / Same-Origin)
  - Web index.html setzt API_BASE_URL (Query `?apiBaseUrl=…` > Same-Origin > Fallback)

- Build/Gradle & Module-Refs
  - settings.gradle.kts: neue Frontend-/Backend-Pfade bereits inkludiert
  - Features/Shell: Abhängigkeiten auf :frontend:shared / :frontend:core:* angepasst
  - Ping-API-Refs auf :backend:services:ping:ping-api vereinheitlicht

- Dockerfiles angepasst
  - backend/infrastructure/gateway/Dockerfile → Tasks/Pfade auf :backend:gateway
  - backend/services/ping/Dockerfile → Tasks/Pfade auf :backend:services:ping:ping-service

- Static Analysis / Guards
  - config/detekt/detekt.yml hinzugefügt
  - Leichter Arch-Guard (Frontend) gegen manuelle Authorization-Header vorbereitet

- Doku
  - docs/ARCHITECTURE.md (Struktur, Mapping, Next Steps) ergänzt
  - docs/adr/README.md angelegt

BREAKING CHANGES:
- Makefile komplett entfernt (bitte direkt `docker compose` verwenden)
- ENV-Quelle ist jetzt docker/.env (statt config/.env oder Root)
- Compose-Datei unter docker/docker-compose.yaml (nicht mehr compose.yaml im Repo-Root)

Verifikation (lokal):
- ENV anlegen: `cp docker/.env.example docker/.env` (Werte anpassen)
- Compose prüfen: `docker compose --env-file docker/.env -f docker/docker-compose.yaml config`
- Infrastruktur: `docker compose --env-file docker/.env -f docker/docker-compose.yaml -p meldestelle up -d postgres redis keycloak web-app`
- Services bauen: `docker compose --env-file docker/.env -f docker/docker-compose.yaml -p meldestelle build api-gateway ping-service --no-cache --progress=plain`

Refs: MP-22 (Epic 2), MP-23 (Epic 3)

* chore(devops)!: Docker-SSoT (.env) konsolidiert, Compose-Mounts ergänzt, Makefile entfernt

- ENV Single Source of Truth
  - docker/.env.example neu (inkl. REDIS_PASSWORD, Ports, Build-Overrides)
  - config/.env(.example) als DEPRECATED markiert (Verweis auf docker/.env[.example])

- Docker Compose vereinheitlicht (docker/docker-compose.yaml)
  - Postgres: zentralen postgresql.conf mounten (../config/postgres/postgresql.conf)
    und Start mit -c config_file=/etc/postgresql/postgresql.conf
  - Redis: zentralen redis.conf mounten (../config/redis/redis.conf)
    und Start via "redis-server … ${REDIS_PASSWORD:+--requirepass $REDIS_PASSWORD}"
  - Web-Nginx: ../config/nginx/nginx.prod.conf → /etc/nginx/nginx.conf (ro)
  - Monitoring: Prometheus/Grafana nutzen ../config/monitoring/* als SSoT

- Frontend/DI/Network (MP-23 Grundlage)
  - :frontend:core:network Modul mit Koin `apiClient` (Ktor + JSON/Retry/Timeout/Logging)
  - Plattform-Basis-URL-Auflösung (JVM: ENV API_BASE_URL; JS: globalThis.API_BASE_URL / Same-Origin)
  - Web index.html setzt API_BASE_URL (Query `?apiBaseUrl=…` > Same-Origin > Fallback)

- Build/Gradle & Module-Refs
  - settings.gradle.kts: neue Frontend-/Backend-Pfade bereits inkludiert
  - Features/Shell: Abhängigkeiten auf :frontend:shared / :frontend:core:* angepasst
  - Ping-API-Refs auf :backend:services:ping:ping-api vereinheitlicht

- Dockerfiles angepasst
  - backend/infrastructure/gateway/Dockerfile → Tasks/Pfade auf :backend:gateway
  - backend/services/ping/Dockerfile → Tasks/Pfade auf :backend:services:ping:ping-service

- Static Analysis / Guards
  - config/detekt/detekt.yml hinzugefügt
  - Leichter Arch-Guard (Frontend) gegen manuelle Authorization-Header vorbereitet

- Doku
  - docs/ARCHITECTURE.md (Struktur, Mapping, Next Steps) ergänzt
  - docs/adr/README.md angelegt

BREAKING CHANGES:
- Makefile komplett entfernt (bitte direkt `docker compose` verwenden)
- ENV-Quelle ist jetzt docker/.env (statt config/.env oder Root)
- Compose-Datei unter docker/docker-compose.yaml (nicht mehr compose.yaml im Repo-Root)

Verifikation (lokal):
- ENV anlegen: `cp docker/.env.example docker/.env` (Werte anpassen)
- Compose prüfen: `docker compose --env-file docker/.env -f docker/docker-compose.yaml config`
- Infrastruktur: `docker compose --env-file docker/.env -f docker/docker-compose.yaml -p meldestelle up -d postgres redis keycloak web-app`
- Services bauen: `docker compose --env-file docker/.env -f docker/docker-compose.yaml -p meldestelle build api-gateway ping-service --no-cache --progress=plain`

Refs: MP-22 (Epic 2), MP-23 (Epic 3)

* chore(devops)!: Docker-SSoT (.env) konsolidiert, Compose-Mounts ergänzt, Makefile entfernt

- ENV Single Source of Truth
  - docker/.env.example neu (inkl. REDIS_PASSWORD, Ports, Build-Overrides)
  - config/.env(.example) als DEPRECATED markiert (Verweis auf docker/.env[.example])

- Docker Compose vereinheitlicht (docker/docker-compose.yaml)
  - Postgres: zentralen postgresql.conf mounten (../config/postgres/postgresql.conf)
    und Start mit -c config_file=/etc/postgresql/postgresql.conf
  - Redis: zentralen redis.conf mounten (../config/redis/redis.conf)
    und Start via "redis-server … ${REDIS_PASSWORD:+--requirepass $REDIS_PASSWORD}"
  - Web-Nginx: ../config/nginx/nginx.prod.conf → /etc/nginx/nginx.conf (ro)
  - Monitoring: Prometheus/Grafana nutzen ../config/monitoring/* als SSoT

- Frontend/DI/Network (MP-23 Grundlage)
  - :frontend:core:network Modul mit Koin `apiClient` (Ktor + JSON/Retry/Timeout/Logging)
  - Plattform-Basis-URL-Auflösung (JVM: ENV API_BASE_URL; JS: globalThis.API_BASE_URL / Same-Origin)
  - Web index.html setzt API_BASE_URL (Query `?apiBaseUrl=…` > Same-Origin > Fallback)

- Build/Gradle & Module-Refs
  - settings.gradle.kts: neue Frontend-/Backend-Pfade bereits inkludiert
  - Features/Shell: Abhängigkeiten auf :frontend:shared / :frontend:core:* angepasst
  - Ping-API-Refs auf :backend:services:ping:ping-api vereinheitlicht

- Dockerfiles angepasst
  - backend/infrastructure/gateway/Dockerfile → Tasks/Pfade auf :backend:gateway
  - backend/services/ping/Dockerfile → Tasks/Pfade auf :backend:services:ping:ping-service

- Static Analysis / Guards
  - config/detekt/detekt.yml hinzugefügt
  - Leichter Arch-Guard (Frontend) gegen manuelle Authorization-Header vorbereitet

- Doku
  - docs/ARCHITECTURE.md (Struktur, Mapping, Next Steps) ergänzt
  - docs/adr/README.md angelegt

BREAKING CHANGES:
- Makefile komplett entfernt (bitte direkt `docker compose` verwenden)
- ENV-Quelle ist jetzt docker/.env (statt config/.env oder Root)
- Compose-Datei unter docker/docker-compose.yaml (nicht mehr compose.yaml im Repo-Root)

Verifikation (lokal):
- ENV anlegen: `cp docker/.env.example docker/.env` (Werte anpassen)
- Compose prüfen: `docker compose --env-file docker/.env -f docker/docker-compose.yaml config`
- Infrastruktur: `docker compose --env-file docker/.env -f docker/docker-compose.yaml -p meldestelle up -d postgres redis keycloak web-app`
- Services bauen: `docker compose --env-file docker/.env -f docker/docker-compose.yaml -p meldestelle build api-gateway ping-service --no-cache --progress=plain`

Refs: MP-22 (Epic 2), MP-23 (Epic 3)

* chore(ci): Workflows an Docker-SSoT & neue Struktur angepasst, minimaler SSoT-Guard

- ssot-guard.yml: Option B (minimal) → `docker compose -f docker/docker-compose.yaml config` als Lint
- integration-tests.yml: `./gradlew staticAnalysis` vor Integrationstests
- docs-kdoc-sync.yml: Dokka-Task Fallback (dokkaGfmAll || dokkaGfm), YouTrack-Sync nur wenn Script vorhanden
- deploy-proxmox.yml: Compose-Pfade auf docker/docker-compose.yaml + `--env-file docker/.env`; Build/Test Schritte vereinheitlicht
- ci-main.yml: SSoT-Skripte per `if: hashFiles(...)` guarded, Compose-Lint Fallback; OpenAPI‑Pfad → backend/gateway; ADR‑Pfade → docs/adr/**; `staticAnalysis` in Build integriert
- youtrack-sync.yml: unverändert (funktional)

Refs: MP-22, MP-23

* chore(ci): Workflows an Docker-SSoT & neue Struktur angepasst, minimaler SSoT-Guard

- ssot-guard.yml: Option B (minimal) → `docker compose -f docker/docker-compose.yaml config` als Lint
- integration-tests.yml: `./gradlew staticAnalysis` vor Integrationstests
- docs-kdoc-sync.yml: Dokka-Task Fallback (dokkaGfmAll || dokkaGfm), YouTrack-Sync nur wenn Script vorhanden
- deploy-proxmox.yml: Compose-Pfade auf docker/docker-compose.yaml + `--env-file docker/.env`; Build/Test Schritte vereinheitlicht
- ci-main.yml: SSoT-Skripte per `if: hashFiles(...)` guarded, Compose-Lint Fallback; OpenAPI‑Pfad → backend/gateway; ADR‑Pfade → docs/adr/**; `staticAnalysis` in Build integriert
- youtrack-sync.yml: unverändert (funktional)

Refs: MP-22, MP-23

* fix(ci): create .env from example before validating compose config

* fix(ci): update ssot-guard filename (.yaml) and sync workflow state

* fixing

* fix(webpack): correct sql.js fallback configuration for webpack 5
This commit is contained in:
StefanMo
2025-12-03 12:03:40 +01:00
committed by GitHub
parent 034892e890
commit 95fe3e0573
365 changed files with 2283 additions and 15142 deletions
+32
View File
@@ -0,0 +1,32 @@
// Dieses Modul definiert die provider-agnostische Caching-API.
// Es enthält nur Interfaces (z.B. `CacheService`) und Datenmodelle,
// aber keine konkrete Implementierung.
plugins {
alias(libs.plugins.kotlinJvm)
}
java {
toolchain {
languageVersion.set(JavaLanguageVersion.of(21))
}
}
// Erlaubt die Verwendung der kotlin.time API im gesamten Modul
kotlin {
compilerOptions {
freeCompilerArgs.add("-opt-in=kotlin.time.ExperimentalTime")
}
}
tasks.test {
useJUnitPlatform()
}
dependencies {
// Stellt sicher, dass alle Versionen aus der zentralen BOM kommen.
api(platform(projects.platform.platformBom))
// Stellt gemeinsame Abhängigkeiten wie Logging bereit und exportiert sie für Konsumenten der API.
api(projects.platform.platformDependencies)
// Stellt Test-Abhängigkeiten bereit.
testImplementation(projects.platform.platformTesting)
}
@@ -0,0 +1,28 @@
package at.mocode.infrastructure.cache.api
import kotlin.time.Duration
import kotlin.time.Duration.Companion.days
import kotlin.time.Duration.Companion.hours
import kotlin.time.Duration.Companion.minutes
interface CacheConfiguration {
val defaultTtl: Duration?
val localCacheMaxSize: Int?
val offlineModeEnabled: Boolean
val synchronizationInterval: Duration
val offlineEntryMaxAge: Duration?
val keyPrefix: String
val compressionEnabled: Boolean
val compressionThreshold: Int
}
data class DefaultCacheConfiguration(
override val defaultTtl: Duration? = 1.hours,
override val localCacheMaxSize: Int? = 10000,
override val offlineModeEnabled: Boolean = true,
override val synchronizationInterval: Duration = 5.minutes,
override val offlineEntryMaxAge: Duration? = 7.days,
override val keyPrefix: String = "",
override val compressionEnabled: Boolean = true,
override val compressionThreshold: Int = 1024
) : CacheConfiguration
@@ -0,0 +1,38 @@
package at.mocode.infrastructure.cache.api
import kotlin.time.Clock
import kotlin.time.Instant
data class CacheEntry<T : Any>(
val key: String,
val value: T,
val createdAt: Instant = Clock.System.now(),
val expiresAt: Instant? = null,
val lastModifiedAt: Instant = Clock.System.now(),
val isDirty: Boolean = false,
val isLocal: Boolean = false
) {
fun isExpired(): Boolean {
return expiresAt?.let { it < Clock.System.now() } ?: false
}
fun markDirty(): CacheEntry<T> {
return copy(isDirty = true, lastModifiedAt = Clock.System.now())
}
fun markClean(): CacheEntry<T> {
return copy(isDirty = false, isLocal = false, lastModifiedAt = Clock.System.now())
}
fun markLocal(): CacheEntry<T> {
return copy(isLocal = true, lastModifiedAt = Clock.System.now())
}
fun updateValue(newValue: T): CacheEntry<T> {
return copy(value = newValue, lastModifiedAt = Clock.System.now())
}
fun updateExpiration(newExpiresAt: Instant?): CacheEntry<T> {
return copy(expiresAt = newExpiresAt, lastModifiedAt = Clock.System.now())
}
}
@@ -0,0 +1,56 @@
package at.mocode.infrastructure.cache.api
/**
* Schnittstelle zum Serialisieren und Deserialisieren von Cache-Einträgen.
*/
interface CacheSerializer {
/**
* Serialisiert einen Wert zu einem Byte-Array.
*
* @param value Der zu serialisierende Wert
* @return Der serialisierte Wert als Byte-Array
*/
fun <T : Any> serialize(value: T): ByteArray
/**
* Deserialisiert ein Byte-Array zu einem Wert.
*
* @param bytes Das zu deserialisierende Byte-Array
* @param clazz Die Zielklasse des zu deserialisierenden Werts
* @return Der deserialisierte Wert
*/
fun <T : Any> deserialize(bytes: ByteArray, clazz: Class<T>): T
/**
* Serialisiert einen Cache-Eintrag zu einem Byte-Array.
*
* @param entry Der zu serialisierende Cache-Eintrag
* @return Der serialisierte Cache-Eintrag als Byte-Array
*/
fun <T : Any> serializeEntry(entry: CacheEntry<T>): ByteArray
/**
* Deserialisiert ein Byte-Array zu einem Cache-Eintrag.
*
* @param bytes Das zu deserialisierende Byte-Array
* @param valueClass Die Klasse des Werts im Cache-Eintrag
* @return Der deserialisierte Cache-Eintrag
*/
fun <T : Any> deserializeEntry(bytes: ByteArray, valueClass: Class<T>): CacheEntry<T>
/**
* Komprimiert ein Byte-Array.
*
* @param bytes Das zu komprimierende Byte-Array
* @return Das komprimierte Byte-Array
*/
fun compress(bytes: ByteArray): ByteArray
/**
* Dekomprimiert ein Byte-Array.
*
* @param bytes Das zu dekomprimierende Byte-Array
* @return Das dekomprimierte Byte-Array
*/
fun decompress(bytes: ByteArray): ByteArray
}
@@ -0,0 +1,19 @@
package at.mocode.infrastructure.cache.api
import kotlin.time.Instant
enum class ConnectionState {
CONNECTED, DISCONNECTED, RECONNECTING
}
interface ConnectionStatusTracker {
fun getConnectionState(): ConnectionState
fun getLastStateChangeTime(): Instant
fun registerConnectionListener(listener: ConnectionStateListener)
fun unregisterConnectionListener(listener: ConnectionStateListener)
fun isConnected(): Boolean = getConnectionState() == ConnectionState.CONNECTED
}
interface ConnectionStateListener {
fun onConnectionStateChanged(newState: ConnectionState, timestamp: Instant)
}
@@ -0,0 +1,17 @@
package at.mocode.infrastructure.cache.api
import kotlin.time.Duration
interface DistributedCache {
fun <T : Any> get(key: String, clazz: Class<T>): T?
fun <T : Any> set(key: String, value: T, ttl: Duration? = null) // Geändert
fun delete(key: String)
fun exists(key: String): Boolean
fun <T : Any> multiGet(keys: Collection<String>, clazz: Class<T>): Map<String, T>
fun <T : Any> multiSet(entries: Map<String, T>, ttl: Duration? = null) // Geändert
fun multiDelete(keys: Collection<String>)
fun synchronize(keys: Collection<String>? = null)
fun markDirty(key: String)
fun getDirtyKeys(): Collection<String>
fun clear()
}
@@ -0,0 +1,21 @@
package at.mocode.infrastructure.cache.api
/**
* Kotlin-idiomatische Extension-Funktion, um einen Wert aus dem Cache zu lesen
* mit reified Typen.
*
* Beispiel: `val user = cache.get<User>("user:123")`
*/
inline fun <reified T : Any> DistributedCache.get(key: String): T? {
return this.get(key, T::class.java)
}
/**
* Kotlin-idiomatische Extension-Funktion, um mehrere Werte aus dem Cache zu lesen
* mit reified Typen.
*
* Beispiel: `val users = cache.multiGet<User>(listOf("user:123", "user:124"))`
*/
inline fun <reified T : Any> DistributedCache.multiGet(keys: Collection<String>): Map<String, T> {
return this.multiGet(keys, T::class.java)
}