Files
afterwork-server-impl-quarkus/README.md
lionsdev 6cdf4a345e
Some checks failed
CI/CD Lions Pipeline / Build + Push + Deploy (push) Failing after 6s
docs: Vault path final — applications/afterwork-server/{db,oidc} (rename cosmétique fait 2026-04-24)
2026-04-24 23:54:05 +00:00

186 lines
5.3 KiB
Markdown
Raw Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

# afterwork-server-impl-quarkus
> Backend REST — application sociale AfterWork (événements, chat temps réel, social feed, stories)
## Dépôt Git
`https://git.lions.dev/lionsdev/afterwork-server-impl-quarkus`
---
## Responsabilités
- API REST sécurisée (JWT HS256 + OIDC Keycloak)
- Gestion des utilisateurs, amis, événements, cotisations
- Chat temps réel (WebSocket)
- Notifications push temps réel
- Social feed (posts, likes, commentaires, stories)
- Upload médias (images/vidéos)
- Emailing transactionnel (via Brevo SMTP)
---
## API principales
| Domaine | Path |
|---------|------|
| Auth | `/api/auth/*` |
| Utilisateurs | `/api/users/*` |
| Amis | `/api/friends/*` |
| Événements | `/api/events/*` |
| Posts / Stories | `/api/posts/*`, `/api/stories/*` |
| Chat | `/api/chat/*` + WebSocket `/ws/chat/{userId}` |
| Notifications | WebSocket `/ws/notifications/{userId}` |
| Health | `/q/health` |
| Swagger | `/q/swagger-ui` |
---
## Stack
| Composant | Technologie |
|-----------|-------------|
| Framework | Quarkus 3.27.3 LTS |
| API | Quarkus REST (RESTEasy Reactive) + Jackson |
| Auth | JWT HS256 + `quarkus-oidc` (Keycloak) |
| ORM | Hibernate ORM Panache |
| Base de données | PostgreSQL 15 |
| Migrations | Flyway |
| Messaging | Kafka (event streaming) |
| Emailing | Brevo SMTP (via `quarkus-mailer`) |
| Temps réel | WebSockets-Next |
| Templates | Qute |
| Docs | SmallRye OpenAPI (Swagger UI) |
---
## Développement local
### Prérequis
- Java 21 LTS
- Maven 3.9+
- PostgreSQL sur `localhost:5432` (DB : `afterwork`)
- Keycloak sur `localhost:8180` (realm à configurer)
### Démarrage
```bash
mvn quarkus:dev
```
Swagger UI : `http://localhost:8080/q/swagger-ui`
### Configuration dev
Variables d'environnement recommandées (voir `.env.example`) :
```bash
DB_NAME=afterwork
DB_USERNAME=lionsuser
DB_PASSWORD=...
JWT_SECRET=dev-jwt-secret-min-32-chars
```
---
## Configuration production
Fichier : `src/main/resources/application-prod.properties`
Toutes les valeurs sensibles via variables d'env ou secrets K8s. Principales :
| Variable | Description |
|----------|-------------|
| `DB_HOST` / `DB_PORT` / `DB_NAME` | PostgreSQL (défaut DB `afterwork`) |
| `QUARKUS_DATASOURCE_USERNAME` / `QUARKUS_DATASOURCE_PASSWORD` | Injectés via secret `afterwork-db-eso` (ESO Vault) |
| `QUARKUS_OIDC_*` | Config Keycloak (via `afterwork-oidc-eso`) |
| `JWT_SECRET` | Clé HS256 ≥32 caractères |
| `STORAGE_PATH` | Chemin stockage uploads (défaut `/app/storage` en prod) |
| Brevo SMTP | `QUARKUS_MAILER_*` via `brevo-smtp-eso` |
---
## Build
```bash
# Build standard (dev)
mvn clean package -DskipTests
# Build production (fast-jar)
mvn clean package -Pprod -DskipTests
```
Produit `target/quarkus-app/` (fast-jar, runnable via `java -jar target/quarkus-app/quarkus-run.jar`).
---
## Déploiement (lionsctl)
```bash
lionsctl pipeline \
-u https://git.lions.dev/lionsdev/afterwork-server-impl-quarkus \
-b develop -j 21 -e production -c k1 -p prod
```
> La branche prod est `develop` (pas `main`).
**Pipeline** : clone → `mvn package -P prod``docker build -f Dockerfile` (racine, fast-jar, `ubi8/openjdk-21:1.21`, UID 1001) → push `registry.lions.dev``kubectl apply` → health check
**URL prod** : `https://api.lions.dev/afterwork`
**Health prod** : `https://api.lions.dev/afterwork/q/health`
**Pré-requis infrastructure** (migration Helm → lionsctl pipeline, fait 2026-04-24) :
- Secret K8s `afterwork-server-impl-quarkus-db-secret` (clés `QUARKUS_DATASOURCE_USERNAME/PASSWORD`)
- ExternalSecrets `afterwork-db-eso` + `afterwork-oidc-eso` (ESO Vault, path `applications/afterwork-server/*`)
- DB PostgreSQL `afterwork` (renommée depuis `mic-after-work-server-impl-quarkus-main`)
- Override `QUARKUS_DATASOURCE_JDBC_URL=jdbc:postgresql://postgresql-service.postgresql.svc.cluster.local:5432/afterwork` sur le deployment
- Deployment Helm existant supprimé au préalable (selector immutable)
- `envFrom: [afterwork-db-eso, afterwork-oidc-eso]` patché post-deploy
### Helm (alternative GitOps)
Repo values dédié : [`afterwork-server-impl-quarkus-k1`](https://git.lions.dev/lionsdev/afterwork-server-impl-quarkus-k1) (Chart `lions-app 1.0.3`).
---
## Tests
```bash
mvn test # unitaires
mvn verify # avec intégration
```
---
## Structure
```
src/main/
├── java/com/lions/dev/
│ ├── entity/ # Entités JPA (User, Event, Post, Story, Message, ...)
│ ├── repository/ # Repositories Panache
│ ├── service/ # Services métier
│ ├── resource/ # Resources JAX-RS
│ ├── websocket/ # Endpoints WebSocket (chat, notifications)
│ ├── security/ # JWT + OIDC filters
│ └── mapper/ # MapStruct mappers
└── resources/
├── db/migration/ # Scripts Flyway
├── application.properties
└── application-prod.properties
```
---
## Historique récent
- **2026-04-24** — Refactor `mic-after-work-server-impl-quarkus-main``afterwork-server-impl-quarkus` (Gitea repo, artifactId, DB `afterwork`, ingress path `/afterwork`, ExternalSecrets ESO). Déployé en prod via lionsctl pipeline.
- **2026-04-24** — Upgrade Quarkus **3.16.3 → 3.27.3 LTS** + Java **17 → 21** (cohérence avec les autres backends de l'écosystème).
---
## Licence
Propriétaire — Lions Dev © 2026