[F0][BE] PK-70: Spring Boot 3.3 + Postgres + Flyway + /api/health #2
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "feature/f0-be-spring-init"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Summary
Spring Boot 3.3 backend skeleton: Postgres datasource + Flyway
V001__init.sql+ Actuator +GET /api/healthcontroller (customDatabaseHealthIndicator), multi-stage Dockerfile (eclipse-temurin:21-jre-alpine, 119 MB), Testcontainers integration test.Tracking issue: PK-70 —
[F0][BE] Spring Boot init + Postgres + Flyway + /api/health(Multica:
mention://issue/bf927376-aa9f-41a8-9611-0d12406b9e1d)Commit:
0ad8506 feat(backend): Spring Boot 3.3 + Postgres + Flyway + /api/healthBase / Stacking
PR proti
feature/f0-monorepo-skeleton(PK-69 — viď PR #1) — diff zostáva čistý (1 commit, len Spring Boot zmeny + úpravadocker-compose.ymlna funkčný healthcheck).Po merge PK-69 PR do
mainzmeniť base namain(alebo rebase + force-push), prípadne mergnúť priamo dofeature/f0-monorepo-skeletonv stack-u.API kontrakt (pre FE / QA)
/api/health{"status":"UP","db":"UP"}{"status":"DOWN","db":"DOWN"}/api/openapi.json/actuator/healthŽiadne biznis endpointy v tomto PR-e — Fáza 3.
Test plan
docker compose down -v && docker compose up -d postgres backend— backend healthcheckhealthydo 30 s.curl -fsS http://localhost:8080/api/health→200 {"status":"UP","db":"UP"}.psql "$PG_DSN" -c '\dt'ukážeflyway_schema_history+rules(prázdna,id UUID PK, name TEXT NOT NULL, created_at TIMESTAMPTZ DEFAULT NOW()).docker image inspect dmn-kokpit-backend --format='{{.Size}}'→ < 300 MB (lokálne 119 MB).mvn -f apps/backend/pom.xml verifyna Linux Docker hostu (CI / Forgejo runner) —HealthEndpointIntegrationTestprejde cez Testcontainers PostgreSQL.Notes
application.yamlčíta DB cez${DB_HOST}/${DB_PORT}/${DB_NAME}/${DB_USER}/${DB_PASSWORD}..env.exampleaktualizovaný —DATABASE_URLodstránený, BE si JDBC URL skladá zDB_*.spring.jpa.hibernate.ddl-auto: validate(niecreate). Schema-only cez Flyway.permitAll) — Fáza 9.@AutowirednaTestRestTemplatelen v teste.Docker client v1.32 too old); Surefire compile passes. Test by mal prejsť na štandardnom Linux Docker runneri — pri CI integrácii zapojiťmvn verifydo existujúceho backend matrix jobu.- pom.xml: Spring Boot 3.3.5 parent, Java 21, web/data-jpa/actuator/ validation/postgresql/flyway/springdoc/MapStruct + test deps (assertj, testcontainers postgresql + junit-jupiter). - Package layout com.company.rulestudio.{api,application,domain, infrastructure} podľa STYLE_GUIDE §8 + RuleStudioApplication. - GET /api/health vracia {"status":"UP","db":"UP"} cez custom DatabaseHealthIndicator (overí DB cez Connection.isValid). - Flyway V001__init.sql vytvára placeholder tabuľku rules (id UUID PK, name TEXT, created_at TIMESTAMPTZ DEFAULT NOW()). - application.yaml: datasource cez DB_HOST/DB_PORT/DB_NAME/DB_USER/ DB_PASSWORD env vars, ddl-auto: validate, /api/openapi.json. - Multi-stage Dockerfile (Maven build → eclipse-temurin 21 JRE alpine); final image ~119 MB. - docker-compose backend service má /api/health curl healthcheck, env vars DB_* mapnuté z POSTGRES_* (jeden zdroj pravdy v .env). - Integration test cez Testcontainers (PostgreSQLContainer + Spring kontext + GET /api/health → 200, status UP, db UP). Co-authored-by: multica-agent <github@multica.ai>0ad8506a2238dca4beda