docs: complete README rewrite + cleanup stale mic-after-work refs in .env.example, DEPLOYMENT.md, QUICK_DEPLOY.md, DATABASE_CONFIG.md, AUDIT — delete backend_log.txt
Some checks failed
CI/CD Lions Pipeline / Build + Push + Deploy (push) Failing after 9s

This commit is contained in:
2026-04-24 19:38:29 +00:00
parent 770176092d
commit da2e763428
6 changed files with 182 additions and 8991 deletions

View File

@@ -26,7 +26,7 @@ DB_PASSWORD=skyfile
# === Production Lions (via Kubernetes Secrets) === # === Production Lions (via Kubernetes Secrets) ===
# DB_HOST=postgresql-service.postgresql.svc.cluster.local # DB_HOST=postgresql-service.postgresql.svc.cluster.local
# DB_PORT=5432 # DB_PORT=5432
# DB_NAME=mic-after-work-server-impl-quarkus-main # DB_NAME=afterwork-server-impl-quarkus
# DB_USERNAME=lionsuser # DB_USERNAME=lionsuser
# DB_PASSWORD=<voir-kubernetes-secrets> # DB_PASSWORD=<voir-kubernetes-secrets>
@@ -115,7 +115,7 @@ QUARKUS_SMALLRYE_HEALTH_UI_ENABLE=true
# ============================================ # ============================================
# Pour déployer avec lionsctl: # Pour déployer avec lionsctl:
# lionsctl pipeline \ # lionsctl pipeline \
# -u https://git.lions.dev/lionsdev/mic-after-work-server-impl-quarkus-main \ # -u https://git.lions.dev/lionsdev/afterwork-server-impl-quarkus \
# -b develop \ # -b develop \
# -j 17 \ # -j 17 \
# -e production \ # -e production \

View File

@@ -1,7 +1,7 @@
# Audit intégral Frontend (Flutter) & Backend (Quarkus) # Audit intégral Frontend (Flutter) & Backend (Quarkus)
**Date** : 4 février 2026 **Date** : 4 février 2026
**Périmètre** : `afterwork` (Flutter), `mic-after-work-server-impl-quarkus-main` (Quarkus) **Périmètre** : `afterwork` (Flutter), `afterwork-server-impl-quarkus` (Quarkus)
**Références** : bonnes pratiques Quarkus REST, Flutter clean architecture, REST/JWT, WebSocket, Kafka (recherches web et documentation officielle). **Références** : bonnes pratiques Quarkus REST, Flutter clean architecture, REST/JWT, WebSocket, Kafka (recherches web et documentation officielle).
--- ---

View File

@@ -97,7 +97,7 @@ Remplacez `<org>` par votre organisation Git (ex. `lionsdev`, `developer`) et `<
```bash ```bash
# Déploiement en dev (clone + build + image + déploiement K8s) # Déploiement en dev (clone + build + image + déploiement K8s)
lionsctl pipeline \ lionsctl pipeline \
-u https://git.lions.dev/<org>/mic-after-work-server-impl-quarkus-main \ -u https://git.lions.dev/<org>/afterwork-server-impl-quarkus \
-b develop \ -b develop \
-j 17 \ -j 17 \
-e dev \ -e dev \
@@ -106,7 +106,7 @@ lionsctl pipeline \
# Déploiement en production sur le cluster k2 # Déploiement en production sur le cluster k2
lionsctl pipeline \ lionsctl pipeline \
-u https://git.lions.dev/<org>/mic-after-work-server-impl-quarkus-main \ -u https://git.lions.dev/<org>/afterwork-server-impl-quarkus \
-b main \ -b main \
-j 17 \ -j 17 \
-e production \ -e production \
@@ -116,7 +116,7 @@ lionsctl pipeline \
# Avec déploiement Helm (charts générés automatiquement) # Avec déploiement Helm (charts générés automatiquement)
lionsctl pipeline \ lionsctl pipeline \
-u https://git.lions.dev/<org>/mic-after-work-server-impl-quarkus-main \ -u https://git.lions.dev/<org>/afterwork-server-impl-quarkus \
-b develop \ -b develop \
-j 17 \ -j 17 \
-e dev \ -e dev \
@@ -129,7 +129,7 @@ lionsctl pipeline \
| Option | Description | Exemple | | Option | Description | Exemple |
|--------|-------------|---------| |--------|-------------|---------|
| `-u`, `--url` | URL du repo Git (obligatoire) | `https://git.lions.dev/.../mic-after-work-server-impl-quarkus-main` | | `-u`, `--url` | URL du repo Git (obligatoire) | `https://git.lions.dev/.../afterwork-server-impl-quarkus` |
| `-b`, `--branch` | Branche à déployer | `develop`, `main` | | `-b`, `--branch` | Branche à déployer | `develop`, `main` |
| `-j`, `--java-version` | Version Java (821) | `17` | | `-j`, `--java-version` | Version Java (821) | `17` |
| `-e`, `--environment` | Environnement (dev / staging / production) | `dev`, `production` | | `-e`, `--environment` | Environnement (dev / staging / production) | `dev`, `production` |
@@ -141,11 +141,11 @@ lionsctl pipeline \
### Vérification du déploiement ### Vérification du déploiement
```bash ```bash
# Pods et statut (nom d'app dérivé du repo, ex. mic-after-work-server-impl-quarkus-main) # Pods et statut (nom d'app dérivé du repo, ex. afterwork-server-impl-quarkus)
kubectl get pods -n applications -l app=mic-after-work-server-impl-quarkus-main kubectl get pods -n applications -l app=afterwork-server-impl-quarkus
# Logs en temps réel # Logs en temps réel
kubectl logs -n applications -l app=mic-after-work-server-impl-quarkus-main -f kubectl logs -n applications -l app=afterwork-server-impl-quarkus -f
# Health check # Health check
curl https://api.lions.dev/afterwork/q/health/ready curl https://api.lions.dev/afterwork/q/health/ready
@@ -307,7 +307,7 @@ spec:
### Étape 1 : Préparation ### Étape 1 : Préparation
```bash ```bash
cd C:\Users\dadyo\PersonalProjects\mic-after-work-server-impl-quarkus-main cd C:\Users\dadyo\PersonalProjects/lions-workspace/afterwork/afterwork-server-impl-quarkus
# Build Maven # Build Maven
mvn clean package -DskipTests mvn clean package -DskipTests
@@ -361,7 +361,7 @@ kubectl apply -f kubernetes/afterwork-service.yaml
kubectl apply -f kubernetes/afterwork-ingress.yaml kubectl apply -f kubernetes/afterwork-ingress.yaml
# Ou via lionsctl pipeline (clone + build + déploiement) # Ou via lionsctl pipeline (clone + build + déploiement)
lionsctl pipeline -u https://git.lions.dev/<org>/mic-after-work-server-impl-quarkus-main -b develop -j 17 -e dev -c k1 -m <email> lionsctl pipeline -u https://git.lions.dev/<org>/afterwork-server-impl-quarkus -b develop -j 17 -e dev -c k1 -m <email>
``` ```
### Étape 5 : Vérification ### Étape 5 : Vérification

View File

@@ -5,7 +5,7 @@
### Option 1 : Déploiement Automatique via Script PowerShell ### Option 1 : Déploiement Automatique via Script PowerShell
```powershell ```powershell
cd C:\Users\dadyo\PersonalProjects\mic-after-work-server-impl-quarkus-main cd C:\Users\dadyo\PersonalProjects/lions-workspace/afterwork/afterwork-server-impl-quarkus
# Déploiement complet (build + push + deploy) # Déploiement complet (build + push + deploy)
.\scripts\deploy.ps1 -Action all -Version 1.0.0 .\scripts\deploy.ps1 -Action all -Version 1.0.0
@@ -22,7 +22,7 @@ cd C:\Users\dadyo\PersonalProjects\mic-after-work-server-impl-quarkus-main
### Option 2 : Déploiement Manuel ### Option 2 : Déploiement Manuel
```powershell ```powershell
cd C:\Users\dadyo\PersonalProjects\mic-after-work-server-impl-quarkus-main cd C:\Users\dadyo\PersonalProjects/lions-workspace/afterwork/afterwork-server-impl-quarkus
# 1. Build Maven (tests non-bloquants) # 1. Build Maven (tests non-bloquants)
mvn clean package -DskipTests mvn clean package -DskipTests
@@ -51,12 +51,12 @@ kubectl logs -n applications -l app=afterwork-api -f
### Option 3 : Déploiement via lionsctl pipeline ### Option 3 : Déploiement via lionsctl pipeline
```bash ```bash
cd C:\Users\dadyo\PersonalProjects\mic-after-work-server-impl-quarkus-main cd C:\Users\dadyo\PersonalProjects/lions-workspace/afterwork/afterwork-server-impl-quarkus
# Le pipeline clone le repo, build Maven, construit limage Docker et déploie sur K8s. Remplacer <org> et <email>. # Le pipeline clone le repo, build Maven, construit limage Docker et déploie sur K8s. Remplacer <org> et <email>.
# Déploiement # Déploiement
lionsctl pipeline -u https://git.lions.dev/<org>/mic-after-work-server-impl-quarkus-main -b develop -j 17 -e dev -c k1 -m <email> lionsctl pipeline -u https://git.lions.dev/<org>/afterwork-server-impl-quarkus -b develop -j 17 -e dev -c k1 -m <email>
``` ```
--- ---

261
README.md
View File

@@ -1,113 +1,184 @@
# mic-after-work-server-impl-quarkus-main # afterwork-server-impl-quarkus
This project uses Quarkus, the Supersonic Subatomic Java Framework. > Backend REST — application sociale AfterWork (événements, chat temps réel, social feed, stories)
If you want to learn more about Quarkus, please visit its website: <https://quarkus.io/>. ## Dépôt Git
## Running the application in dev mode `https://git.lions.dev/lionsdev/afterwork-server-impl-quarkus`
You can run your application in dev mode that enables live coding using:
```shell script
./mvnw compile quarkus:dev
```
> **_NOTE:_** Quarkus now ships with a Dev UI, which is available in dev mode only at <http://localhost:8080/q/dev/>.
## Packaging and running the application
The application can be packaged using:
```shell script
./mvnw package
```
It produces the `quarkus-run.jar` file in the `target/quarkus-app/` directory.
Be aware that its not an _über-jar_ as the dependencies are copied into the `target/quarkus-app/lib/` directory.
The application is now runnable using `java -jar target/quarkus-app/quarkus-run.jar`.
If you want to build an _über-jar_, execute the following command:
```shell script
./mvnw package -Dquarkus.package.jar.type=uber-jar
```
The application, packaged as an _über-jar_, is now runnable using `java -jar target/*-runner.jar`.
## Creating a native executable
You can create a native executable using:
```shell script
./mvnw package -Dnative
```
Or, if you don't have GraalVM installed, you can run the native executable build in a container using:
```shell script
./mvnw package -Dnative -Dquarkus.native.container-build=true
```
You can then execute your native executable with: `./target/mic-after-work-server-impl-quarkus-main-1.0.0-SNAPSHOT-runner`
If you want to learn more about building native executables, please consult <https://quarkus.io/guides/maven-tooling>.
## Fonctionnalités métier (AfterWork)
### Notifications
- **Service** : `NotificationService` — création, lecture, pagination, marquage lu/suppression des notifications en base.
- **Déclencheurs** : Notifications créées automatiquement pour les demandes damitié (destinataire), les likes/commentaires sur les posts (auteur du post), les nouvelles notes détablissement (manager).
- **API** : `GET/POST /notifications/user/{userId}`, pagination, marquer lu, supprimer. Voir [SECURITY.md](SECURITY.md) pour lusage en production (userId issu de lauth).
### Jobs planifiés (Quarkus Scheduler)
- **Stories** : Désactivation des stories expirées (cron : toutes les heures).
- **Tokens** : Suppression des tokens de réinitialisation de mot de passe expirés (tous les jours à 3h).
- **Abonnements** : Expiration des abonnements établissements et désactivation des établissements non payés (toutes les heures).
- **Rappels événements** : Notifications en base pour les participants (J-1 et H-1), exécution toutes les 15 minutes.
- **Avertissement abonnement** : Envoi demails J-3 avant expiration aux managers (tous les jours à 9h).
Configuration : `quarkus.scheduler.enabled=true` (désactivé en test via `%test.quarkus.scheduler.enabled=false`).
### Emails transactionnels
- **EmailService** : Réinitialisation mot de passe, bienvenue, confirmation de paiement Wave, rappel événement, avertissement expiration abonnement, confirmation de réservation, échec de paiement Wave.
- Configuration SMTP via variables denvironnement (`MAILER_HOST`, `MAILER_USERNAME`, `MAILER_PASSWORD`, etc.) ; en test le mailer peut être en mode mock.
### Paiement Wave (établissements)
- Initiation de paiement (abonnement mensuel/annuel), webhook `POST /webhooks/wave` pour `payment.completed`, `payment.refunded`, `payment.failed`, etc.
- Vérification optionnelle de la signature du webhook (header `X-Wave-Signature`, HMAC-SHA256) si `wave.webhook.secret` est configuré. Voir [SECURITY.md](SECURITY.md).
--- ---
## Related Guides ## Responsabilités
- Hibernate ORM ([guide](https://quarkus.io/guides/hibernate-orm)): Define your persistent model with Hibernate ORM and Jakarta Persistence - API REST sécurisée (JWT HS256 + OIDC Keycloak)
- SmallRye OpenAPI ([guide](https://quarkus.io/guides/openapi-swaggerui)): Document your REST APIs with OpenAPI - comes with Swagger UI - Gestion des utilisateurs, amis, événements, cotisations
- RESTEasy Classic ([guide](https://quarkus.io/guides/resteasy)): REST endpoint framework implementing Jakarta REST and more - Chat temps réel (WebSocket)
- Logging JSON ([guide](https://quarkus.io/guides/logging#json-logging)): Add JSON formatter for console logging - Notifications push temps réel
- JDBC Driver - PostgreSQL ([guide](https://quarkus.io/guides/datasource)): Connect to the PostgreSQL database via JDBC - Social feed (posts, likes, commentaires, stories)
- Upload médias (images/vidéos)
- Emailing transactionnel (via Brevo SMTP)
## Sécurité et déploiement ---
- **Sécurité** : Voir [SECURITY.md](SECURITY.md) (auth, webhook Wave, secrets, validation). ## API principales
- **Docker** : Voir [docker/README.md](docker/README.md) pour lancer lapp et les dépendances (PostgreSQL, etc.).
## Provided Code | 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` |
### Hibernate ORM ---
Create your first JPA entity ## Stack
[Related guide section...](https://quarkus.io/guides/hibernate-orm) | Composant | Technologie |
|-----------|-------------|
| Framework | Quarkus 3.16.3 |
| 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
### RESTEasy JAX-RS ### Prérequis
Easily start your RESTful Web Services - Java 17+ (21 recommandé)
- Maven 3.9+
- PostgreSQL sur `localhost:5432` (DB : `afterwork`)
- Keycloak sur `localhost:8180` (realm à configurer)
[Related guide section...](https://quarkus.io/guides/getting-started#the-jax-rs-resources) ### 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/mic-after-work-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.
---
## Licence
Propriétaire — Lions Dev © 2026

File diff suppressed because it is too large Load Diff