[F0][BE] PK-70: Spring Boot 3.3 + Postgres + Flyway + /api/health #2

Merged
forge-admin merged 1 commit from feature/f0-be-spring-init into main 2026-05-17 13:37:15 +00:00
Owner

Summary

Spring Boot 3.3 backend skeleton: Postgres datasource + Flyway V001__init.sql + Actuator + GET /api/health controller (custom DatabaseHealthIndicator), 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/health

Base / Stacking

PR proti feature/f0-monorepo-skeleton (PK-69 — viď PR #1) — diff zostáva čistý (1 commit, len Spring Boot zmeny + úprava docker-compose.yml na funkčný healthcheck).
Po merge PK-69 PR do main zmeniť base na main (alebo rebase + force-push), prípadne mergnúť priamo do feature/f0-monorepo-skeleton v stack-u.

API kontrakt (pre FE / QA)

Metóda Path Response (200) Response (503)
GET /api/health {"status":"UP","db":"UP"} {"status":"DOWN","db":"DOWN"}
GET /api/openapi.json OpenAPI 3 JSON
GET /actuator/health Spring default shape

Žiadne biznis endpointy v tomto PR-e — Fáza 3.

Test plan

  • docker compose down -v && docker compose up -d postgres backend — backend healthcheck healthy do 30 s.
  • curl -fsS http://localhost:8080/api/health200 {"status":"UP","db":"UP"}.
  • psql "$PG_DSN" -c '\dt' ukáže flyway_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 verify na Linux Docker hostu (CI / Forgejo runner) — HealthEndpointIntegrationTest prejde cez Testcontainers PostgreSQL.

Notes

  • application.yaml číta DB cez ${DB_HOST}/${DB_PORT}/${DB_NAME}/${DB_USER}/${DB_PASSWORD}. .env.example aktualizovaný — DATABASE_URL odstránený, BE si JDBC URL skladá z DB_*.
  • spring.jpa.hibernate.ddl-auto: validate (nie create). Schema-only cez Flyway.
  • Žiadny security config (permitAll) — Fáza 9.
  • Constructor injection only v produkčných triedach; @Autowired na TestRestTemplate len v teste.
  • Testcontainers test lokálne na colima padol (Docker client v1.32 too old); Surefire compile passes. Test by mal prejsť na štandardnom Linux Docker runneri — pri CI integrácii zapojiť mvn verify do existujúceho backend matrix jobu.
## Summary Spring Boot 3.3 backend skeleton: Postgres datasource + Flyway `V001__init.sql` + Actuator + `GET /api/health` controller (custom `DatabaseHealthIndicator`), 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/health` ## Base / Stacking PR proti **`feature/f0-monorepo-skeleton`** (PK-69 — viď PR #1) — diff zostáva čistý (1 commit, len Spring Boot zmeny + úprava `docker-compose.yml` na funkčný healthcheck). **Po merge PK-69 PR do `main` zmeniť base na `main`** (alebo rebase + force-push), prípadne mergnúť priamo do `feature/f0-monorepo-skeleton` v stack-u. ## API kontrakt (pre FE / QA) | Metóda | Path | Response (200) | Response (503) | |--------|-------------------------|-----------------------------------------|-----------------------------------------| | GET | `/api/health` | `{"status":"UP","db":"UP"}` | `{"status":"DOWN","db":"DOWN"}` | | GET | `/api/openapi.json` | OpenAPI 3 JSON | — | | GET | `/actuator/health` | Spring default shape | — | Žiadne biznis endpointy v tomto PR-e — Fáza 3. ## Test plan - [ ] `docker compose down -v && docker compose up -d postgres backend` — backend healthcheck `healthy` do 30 s. - [ ] `curl -fsS http://localhost:8080/api/health` → `200 {"status":"UP","db":"UP"}`. - [ ] `psql "$PG_DSN" -c '\dt'` ukáže `flyway_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 verify` na Linux Docker hostu (CI / Forgejo runner) — `HealthEndpointIntegrationTest` prejde cez Testcontainers PostgreSQL. ## Notes - `application.yaml` číta DB cez `${DB_HOST}/${DB_PORT}/${DB_NAME}/${DB_USER}/${DB_PASSWORD}`. `.env.example` aktualizovaný — `DATABASE_URL` odstránený, BE si JDBC URL skladá z `DB_*`. - `spring.jpa.hibernate.ddl-auto: validate` (nie `create`). Schema-only cez Flyway. - Žiadny security config (`permitAll`) — Fáza 9. - Constructor injection only v produkčných triedach; `@Autowired` na `TestRestTemplate` len v teste. - Testcontainers test lokálne na colima padol (`Docker client v1.32 too old`); Surefire compile passes. Test by mal prejsť na štandardnom Linux Docker runneri — pri CI integrácii zapojiť `mvn verify` do existujúceho backend matrix jobu.
feat(backend): Spring Boot 3.3 + Postgres + Flyway + /api/health
Some checks failed
CI / Lint (frontend) (pull_request) Successful in 6s
CI / Lint (drl-generator) (pull_request) Failing after 7s
CI / Lint (backend) (pull_request) Successful in 8s
CI / Lint (shared-types) (pull_request) Successful in 6s
CI / Typecheck (backend) (pull_request) Failing after 6s
CI / Typecheck (drl-generator) (pull_request) Successful in 7s
CI / Typecheck (frontend) (pull_request) Successful in 7s
CI / Typecheck (shared-types) (pull_request) Successful in 6s
0ad8506a22
- 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>
forge-admin changed target branch from feature/f0-monorepo-skeleton to main 2026-05-17 13:36:09 +00:00
forge-admin force-pushed feature/f0-be-spring-init from 0ad8506a22
Some checks failed
CI / Lint (frontend) (pull_request) Successful in 6s
CI / Lint (drl-generator) (pull_request) Failing after 7s
CI / Lint (backend) (pull_request) Successful in 8s
CI / Lint (shared-types) (pull_request) Successful in 6s
CI / Typecheck (backend) (pull_request) Failing after 6s
CI / Typecheck (drl-generator) (pull_request) Successful in 7s
CI / Typecheck (frontend) (pull_request) Successful in 7s
CI / Typecheck (shared-types) (pull_request) Successful in 6s
to 38dca4beda
All checks were successful
CI / Lint (backend) (pull_request) Successful in 6s
CI / Lint (drl-generator) (pull_request) Successful in 7s
CI / Lint (frontend) (pull_request) Successful in 7s
CI / Lint (shared-types) (pull_request) Successful in 7s
CI / Typecheck (frontend) (pull_request) Successful in 7s
CI / Typecheck (drl-generator) (pull_request) Successful in 7s
CI / Typecheck (shared-types) (pull_request) Successful in 7s
CI / Typecheck (backend) (pull_request) Successful in 7s
2026-05-17 13:36:43 +00:00
Compare
Sign in to join this conversation.
No reviewers
No labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
forge-admin/DMN-Kokpit!2
No description provided.