Compare commits
4 Commits
92612abbd7
...
main
| Author | SHA1 | Date | |
|---|---|---|---|
| d398c6d000 | |||
|
|
cb6af97c42 | ||
|
|
23579533b2 | ||
|
|
173cfcd9ab |
@@ -1,24 +0,0 @@
|
||||
{
|
||||
"permissions": {
|
||||
"allow": [
|
||||
"Bash(flutter analyze:*)",
|
||||
"Bash(flutter pub add:*)",
|
||||
"Bash(mvn clean compile:*)",
|
||||
"Bash(mvn compile:*)",
|
||||
"Bash(dir \"C:\\\\Users\\\\dadyo\\\\PersonalProjects\\\\lions-workspace\\\\afterwork\\\\lib\" /s /b)",
|
||||
"Bash(findstr:*)",
|
||||
"Bash(cat:*)",
|
||||
"Bash(flutter pub get:*)",
|
||||
"Bash(flutter build:*)",
|
||||
"WebSearch",
|
||||
"Bash(dir \"C:\\\\Users\\\\dadyo\\\\PersonalProjects\\\\mic-after-work-server-impl-quarkus-main\\\\src\\\\main\\\\java\\\\com\\\\lions\\\\dev\\\\entity\\\\chat\" /s /b)",
|
||||
"Bash(dir:*)",
|
||||
"Bash(mvn clean package:*)",
|
||||
"Bash(git remote add:*)",
|
||||
"Bash(git add:*)",
|
||||
"Bash(git push:*)",
|
||||
"Bash(git remote set-url:*)",
|
||||
"Bash(git commit:*)"
|
||||
]
|
||||
}
|
||||
}
|
||||
43
.env.example
Normal file
43
.env.example
Normal file
@@ -0,0 +1,43 @@
|
||||
# Configuration de l'environnement AfterWork
|
||||
# Copiez ce fichier en .env et personnalisez les valeurs
|
||||
|
||||
# ====================================================================
|
||||
# API CONFIGURATION
|
||||
# ====================================================================
|
||||
|
||||
# URL de base de l'API backend
|
||||
# Development: http://192.168.1.145:8080
|
||||
# Production: https://api.lions.dev/afterwork
|
||||
API_BASE_URL=https://api.lions.dev/afterwork
|
||||
|
||||
# Timeout pour les requêtes réseau (en secondes)
|
||||
NETWORK_TIMEOUT=30
|
||||
|
||||
# ====================================================================
|
||||
# ENVIRONMENT
|
||||
# ====================================================================
|
||||
|
||||
# Environnement d'exécution: development, staging, production
|
||||
ENVIRONMENT=production
|
||||
|
||||
# Mode debug (true/false)
|
||||
DEBUG_MODE=false
|
||||
|
||||
# ====================================================================
|
||||
# SERVICES EXTERNES (Optionnel)
|
||||
# ====================================================================
|
||||
|
||||
# Clé API Google Maps (si nécessaire)
|
||||
# GOOGLE_MAPS_API_KEY=votre_cle_api_google_maps
|
||||
|
||||
# ====================================================================
|
||||
# NOTES
|
||||
# ====================================================================
|
||||
|
||||
# Pour utiliser ces variables lors du build:
|
||||
# flutter build apk --dart-define-from-file=.env
|
||||
|
||||
# Ou spécifier individuellement:
|
||||
# flutter build apk \
|
||||
# --dart-define=API_BASE_URL=https://api.lions.dev/afterwork \
|
||||
# --dart-define=ENVIRONMENT=production
|
||||
@@ -2,11 +2,11 @@
|
||||
|
||||
## ✅ Confirmation
|
||||
|
||||
**OUI**, le backend `mic-after-work-server-impl-quarkus-main` est bien le backend associé à l'application Flutter `afterwork` !
|
||||
**OUI**, le backend `afterwork-server-impl-quarkus` est bien le backend associé à l'application Flutter `afterwork` !
|
||||
|
||||
## 📁 Chemins
|
||||
|
||||
- **Backend** : `C:\Users\dadyo\PersonalProjects\mic-after-work-server-impl-quarkus-main`
|
||||
- **Backend** : `C:\Users\dadyo\PersonalProjects/lions-workspace/afterwork/afterwork-server-impl-quarkus`
|
||||
- **Frontend** : `C:\Users\dadyo\PersonalProjects\lions-workspace\afterwork`
|
||||
|
||||
## 🔍 Correspondances Vérifiées
|
||||
@@ -30,7 +30,7 @@
|
||||
|
||||
```powershell
|
||||
# Se déplacer dans le répertoire backend
|
||||
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émarrer en mode développement
|
||||
mvn clean compile quarkus:dev
|
||||
@@ -160,7 +160,7 @@ curl -X POST http://192.168.1.8:8080/users/authenticate `
|
||||
|
||||
## 📊 Résumé
|
||||
|
||||
✅ **Backend identifié** : mic-after-work-server-impl-quarkus-main
|
||||
✅ **Backend identifié** : afterwork-server-impl-quarkus
|
||||
✅ **Compatibilité confirmée** : Entités et endpoints correspondent
|
||||
✅ **Base de données** : PostgreSQL (afterwork_db)
|
||||
✅ **Port** : 8080
|
||||
|
||||
293
BUILD_CONFIG.md
Normal file
293
BUILD_CONFIG.md
Normal file
@@ -0,0 +1,293 @@
|
||||
# Configuration de Build AfterWork
|
||||
|
||||
Ce document explique comment configurer et builder l'application AfterWork pour différents environnements.
|
||||
|
||||
## 📋 Table des matières
|
||||
|
||||
- [Environnements](#environnements)
|
||||
- [Configuration Rapide](#configuration-rapide)
|
||||
- [Scripts de Build](#scripts-de-build)
|
||||
- [Build Manuel](#build-manuel)
|
||||
- [Variables d'Environnement](#variables-denvironnement)
|
||||
|
||||
---
|
||||
|
||||
## 🌍 Environnements
|
||||
|
||||
### Development (par défaut)
|
||||
- **API URL** : `http://192.168.1.145:8080`
|
||||
- **Usage** : Développement local avec le backend sur le réseau local
|
||||
- **Debug** : Activé
|
||||
|
||||
### Production
|
||||
- **API URL** : `https://api.lions.dev/afterwork`
|
||||
- **Usage** : Déploiement en production
|
||||
- **Debug** : Désactivé
|
||||
|
||||
---
|
||||
|
||||
## ⚡ Configuration Rapide
|
||||
|
||||
### Windows (PowerShell)
|
||||
|
||||
```powershell
|
||||
# Build APK de production
|
||||
.\scripts\build_production.ps1
|
||||
|
||||
# Build avec nettoyage préalable
|
||||
.\scripts\build_production.ps1 -Clean
|
||||
|
||||
# Build pour d'autres plateformes
|
||||
.\scripts\build_production.ps1 -Platform appbundle
|
||||
.\scripts\build_production.ps1 -Platform web
|
||||
```
|
||||
|
||||
### Linux/Mac (Bash)
|
||||
|
||||
```bash
|
||||
# Rendre le script exécutable
|
||||
chmod +x scripts/build_production.sh
|
||||
|
||||
# Build APK de production
|
||||
./scripts/build_production.sh
|
||||
|
||||
# Build avec nettoyage préalable
|
||||
./scripts/build_production.sh apk --clean
|
||||
|
||||
# Build pour d'autres plateformes
|
||||
./scripts/build_production.sh appbundle
|
||||
./scripts/build_production.sh web
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## 🔨 Scripts de Build
|
||||
|
||||
### `build_production.ps1` / `build_production.sh`
|
||||
|
||||
Scripts automatisés pour builder l'application en production.
|
||||
|
||||
**Paramètres** :
|
||||
- `Platform` : `apk` (défaut), `appbundle`, `ios`, `web`
|
||||
- `--clean` / `-Clean` : Nettoie le projet avant le build
|
||||
|
||||
**Configuration automatique** :
|
||||
- ✅ API_BASE_URL = `https://api.lions.dev/afterwork`
|
||||
- ✅ ENVIRONMENT = `production`
|
||||
- ✅ Mode release activé
|
||||
|
||||
**Sortie** :
|
||||
- APK : `build/app/outputs/flutter-apk/app-release.apk`
|
||||
- App Bundle : `build/app/outputs/bundle/release/app-release.aab`
|
||||
- iOS : `build/ios/ipa/`
|
||||
- Web : `build/web/`
|
||||
|
||||
---
|
||||
|
||||
## 🛠️ Build Manuel
|
||||
|
||||
Si vous préférez builder manuellement sans les scripts :
|
||||
|
||||
### Android APK
|
||||
|
||||
```bash
|
||||
flutter build apk \
|
||||
--dart-define=API_BASE_URL=https://api.lions.dev/afterwork \
|
||||
--dart-define=ENVIRONMENT=production \
|
||||
--release
|
||||
```
|
||||
|
||||
### Android App Bundle (pour Google Play)
|
||||
|
||||
```bash
|
||||
flutter build appbundle \
|
||||
--dart-define=API_BASE_URL=https://api.lions.dev/afterwork \
|
||||
--dart-define=ENVIRONMENT=production \
|
||||
--release
|
||||
```
|
||||
|
||||
### iOS
|
||||
|
||||
```bash
|
||||
flutter build ios \
|
||||
--dart-define=API_BASE_URL=https://api.lions.dev/afterwork \
|
||||
--dart-define=ENVIRONMENT=production \
|
||||
--release
|
||||
```
|
||||
|
||||
### Web
|
||||
|
||||
```bash
|
||||
flutter build web \
|
||||
--dart-define=API_BASE_URL=https://api.lions.dev/afterwork \
|
||||
--dart-define=ENVIRONMENT=production \
|
||||
--release
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## 🔑 Variables d'Environnement
|
||||
|
||||
### API_BASE_URL
|
||||
|
||||
URL de base de l'API backend.
|
||||
|
||||
- **Type** : String
|
||||
- **Requis** : Non (utilise la valeur par défaut si non défini)
|
||||
- **Défaut** : `http://192.168.1.145:8080` (développement)
|
||||
- **Production** : `https://api.lions.dev/afterwork`
|
||||
|
||||
**Exemple d'utilisation** :
|
||||
```dart
|
||||
import 'package:afterwork/core/constants/env_config.dart';
|
||||
|
||||
final apiUrl = EnvConfig.apiBaseUrl;
|
||||
// En prod: https://api.lions.dev/afterwork
|
||||
```
|
||||
|
||||
### ENVIRONMENT
|
||||
|
||||
Environnement d'exécution de l'application.
|
||||
|
||||
- **Type** : String
|
||||
- **Valeurs** : `development`, `staging`, `production`
|
||||
- **Défaut** : `development`
|
||||
|
||||
**Exemple d'utilisation** :
|
||||
```dart
|
||||
import 'package:afterwork/core/constants/env_config.dart';
|
||||
|
||||
if (EnvConfig.isProduction) {
|
||||
// Code spécifique à la production
|
||||
}
|
||||
```
|
||||
|
||||
### NETWORK_TIMEOUT
|
||||
|
||||
Timeout pour les requêtes réseau en secondes.
|
||||
|
||||
- **Type** : int
|
||||
- **Défaut** : 30
|
||||
- **Production** : 30 (recommandé)
|
||||
|
||||
### DEBUG_MODE
|
||||
|
||||
Active les logs détaillés et fonctionnalités de debug.
|
||||
|
||||
- **Type** : bool
|
||||
- **Défaut** : `true`
|
||||
- **Production** : Automatiquement `false` si `ENVIRONMENT=production`
|
||||
|
||||
### GOOGLE_MAPS_API_KEY
|
||||
|
||||
Clé API Google Maps (optionnelle).
|
||||
|
||||
- **Type** : String
|
||||
- **Requis** : Non
|
||||
- **Défaut** : vide
|
||||
|
||||
**Exemple** :
|
||||
```bash
|
||||
flutter build apk \
|
||||
--dart-define=API_BASE_URL=https://api.lions.dev/afterwork \
|
||||
--dart-define=GOOGLE_MAPS_API_KEY=votre_cle_api
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## 🚀 Endpoints de l'API Production
|
||||
|
||||
L'API production est accessible à l'adresse : **`https://api.lions.dev/afterwork`**
|
||||
|
||||
### Endpoints Principaux
|
||||
|
||||
| Endpoint | Description |
|
||||
|----------|-------------|
|
||||
| `/users` | Gestion des utilisateurs |
|
||||
| `/users/authenticate` | Authentification |
|
||||
| `/events` | Gestion des événements |
|
||||
| `/friends` | Gestion des amis |
|
||||
| `/messages` | Messagerie |
|
||||
| `/posts` | Posts sociaux |
|
||||
| `/stories` | Stories |
|
||||
| `/notifications` | Notifications |
|
||||
|
||||
### WebSockets
|
||||
|
||||
| Endpoint | Description |
|
||||
|----------|-------------|
|
||||
| `/chat/ws/{userId}` | Chat en temps réel |
|
||||
| `/notifications/ws/{userId}` | Notifications en temps réel |
|
||||
|
||||
**URL complète** :
|
||||
```
|
||||
wss://api.lions.dev/afterwork/chat/ws/{userId}
|
||||
wss://api.lions.dev/afterwork/notifications/ws/{userId}
|
||||
```
|
||||
|
||||
### Documentation API
|
||||
|
||||
Swagger UI disponible à :
|
||||
- **URL** : `https://api.lions.dev/afterwork/q/swagger-ui/`
|
||||
|
||||
---
|
||||
|
||||
## 📝 Vérification de la Configuration
|
||||
|
||||
Avant le déploiement, vérifiez que :
|
||||
|
||||
✅ L'API backend est accessible : `https://api.lions.dev/afterwork/users`
|
||||
✅ Les WebSockets fonctionnent
|
||||
✅ Les certificats TLS sont valides
|
||||
✅ Le CORS est correctement configuré
|
||||
✅ L'application se connecte avec succès à l'API
|
||||
|
||||
**Test rapide** :
|
||||
```bash
|
||||
# Tester l'API
|
||||
curl https://api.lions.dev/afterwork/users
|
||||
|
||||
# Devrait retourner: [] (liste vide si aucun utilisateur)
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## 🐛 Dépannage
|
||||
|
||||
### Erreur : "API_BASE_URL is not set"
|
||||
|
||||
**Solution** : Vérifiez que vous utilisez `--dart-define=API_BASE_URL=...` lors du build.
|
||||
|
||||
### Erreur : "Connection refused"
|
||||
|
||||
**Solutions** :
|
||||
1. Vérifiez que l'API est accessible : `curl https://api.lions.dev/afterwork/users`
|
||||
2. Vérifiez votre connexion internet
|
||||
3. Vérifiez que le CORS est configuré sur le backend
|
||||
|
||||
### L'app se connecte au mauvais environnement
|
||||
|
||||
**Solution** : Reconstruisez complètement l'application avec le bon `--dart-define`.
|
||||
|
||||
```bash
|
||||
# Nettoyage complet
|
||||
flutter clean
|
||||
flutter pub get
|
||||
|
||||
# Rebuild avec la bonne configuration
|
||||
flutter build apk --dart-define=API_BASE_URL=https://api.lions.dev/afterwork
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## 📚 Ressources
|
||||
|
||||
- [Documentation Flutter](https://flutter.dev/docs)
|
||||
- [Flutter Build Modes](https://flutter.dev/docs/testing/build-modes)
|
||||
- [Environment Variables in Flutter](https://flutter.dev/docs/deployment/flavors)
|
||||
- [API Backend Repository](https://git.lions.dev/lionsdev/afterwork-server-impl-quarkus)
|
||||
|
||||
---
|
||||
|
||||
**Dernière mise à jour** : 2026-01-10
|
||||
**Version** : 1.0.0
|
||||
330
DEPLOYMENT_FRONTEND.md
Normal file
330
DEPLOYMENT_FRONTEND.md
Normal file
@@ -0,0 +1,330 @@
|
||||
# 🚀 Déploiement Frontend AfterWork
|
||||
|
||||
**Date** : 2026-01-10
|
||||
**Statut** : ✅ Prêt pour le build production
|
||||
|
||||
---
|
||||
|
||||
## 📋 Configuration de Production
|
||||
|
||||
### URL de l'API Backend
|
||||
```
|
||||
https://api.lions.dev/afterwork
|
||||
```
|
||||
|
||||
### WebSocket
|
||||
```
|
||||
wss://api.lions.dev/afterwork/ws/notifications/{userId}
|
||||
wss://api.lions.dev/afterwork/ws/chat/{userId}
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## 🔧 Build de l'Application
|
||||
|
||||
### Build APK (Android)
|
||||
|
||||
```powershell
|
||||
cd C:\Users\dadyo\PersonalProjects\lions-workspace\afterwork
|
||||
|
||||
# Build APK production
|
||||
.\build-prod.ps1 -Target apk
|
||||
|
||||
# Ou directement avec Flutter
|
||||
flutter build apk --release \
|
||||
--dart-define=API_BASE_URL=https://api.lions.dev/afterwork \
|
||||
--dart-define=ENVIRONMENT=production \
|
||||
--dart-define=DEBUG_MODE=false \
|
||||
--split-per-abi
|
||||
```
|
||||
|
||||
**Artefacts générés:**
|
||||
```
|
||||
build/app/outputs/flutter-apk/
|
||||
├── app-armeabi-v7a-release.apk
|
||||
├── app-arm64-v8a-release.apk (Recommandé pour la plupart des appareils)
|
||||
└── app-x86_64-release.apk
|
||||
```
|
||||
|
||||
### Build AAB (Google Play Store)
|
||||
|
||||
```powershell
|
||||
# Build AAB pour Play Store
|
||||
.\build-prod.ps1 -Target appbundle
|
||||
|
||||
# Ou directement
|
||||
flutter build appbundle --release \
|
||||
--dart-define=API_BASE_URL=https://api.lions.dev/afterwork \
|
||||
--dart-define=ENVIRONMENT=production \
|
||||
--dart-define=DEBUG_MODE=false
|
||||
```
|
||||
|
||||
**Artefact généré:**
|
||||
```
|
||||
build/app/outputs/bundle/release/app-release.aab
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## 📱 Installation et Test
|
||||
|
||||
### Installer l'APK sur un Appareil
|
||||
|
||||
```bash
|
||||
# Via ADB
|
||||
adb install build/app/outputs/flutter-apk/app-arm64-v8a-release.apk
|
||||
|
||||
# Ou copier l'APK sur l'appareil et l'installer manuellement
|
||||
```
|
||||
|
||||
### Tester l'Application
|
||||
|
||||
1. **Connexion au Backend**
|
||||
- L'app doit pointer vers `https://api.lions.dev/afterwork`
|
||||
- Vérifier que le login fonctionne
|
||||
|
||||
2. **WebSocket (Temps Réel)**
|
||||
- Tester les notifications en temps réel
|
||||
- Tester le chat instantané
|
||||
- Vérifier les typing indicators
|
||||
|
||||
3. **Fonctionnalités Principales**
|
||||
- ✅ Login/Signup
|
||||
- ✅ Gestion de profil
|
||||
- ✅ Événements
|
||||
- ✅ Amis (ajout, suggestions, demandes)
|
||||
- ✅ Chat (messages, statuts ✓✓✓)
|
||||
- ✅ Social (posts, likes, commentaires)
|
||||
- ✅ Stories
|
||||
- ✅ Notifications
|
||||
|
||||
---
|
||||
|
||||
## 🔄 Changements pour Production
|
||||
|
||||
### Configuration API
|
||||
|
||||
Le fichier `lib/core/constants/env_config.dart` est configuré pour supporter les variables d'environnement:
|
||||
|
||||
```dart
|
||||
static const String apiBaseUrl = String.fromEnvironment(
|
||||
'API_BASE_URL',
|
||||
defaultValue: 'http://192.168.1.145:8080', // Développement
|
||||
);
|
||||
```
|
||||
|
||||
**En production:**
|
||||
- Via `--dart-define=API_BASE_URL=https://api.lions.dev/afterwork`
|
||||
- Le script `build-prod.ps1` configure automatiquement cette variable
|
||||
|
||||
### Validation
|
||||
|
||||
Au démarrage, l'app valide la configuration:
|
||||
- En production, HTTPS est obligatoire
|
||||
- Les URLs malformées sont rejetées
|
||||
- Les clés API manquantes génèrent des warnings
|
||||
|
||||
---
|
||||
|
||||
## 🐛 Corrections Appliquées
|
||||
|
||||
### Race Condition Chat (CRITIQUE)
|
||||
**Problème:** Les icônes de statut (✓, ✓✓, ✓✓ bleu) ne s'affichaient pas
|
||||
|
||||
**Solution:** Pattern Optimistic UI
|
||||
- Message créé localement immédiatement
|
||||
- Ajouté à la liste AVANT la requête HTTP
|
||||
- Remplacé par le message serveur à la réponse
|
||||
|
||||
**Fichier:** `lib/presentation/state_management/chat_bloc.dart`
|
||||
|
||||
### TODOs Implémentés (13)
|
||||
- Partage de posts (copier lien, partage natif)
|
||||
- Signalement de posts
|
||||
- Recherche de conversations
|
||||
- Gestion de médias (upload, suppression, miniatures)
|
||||
- Sélection d'amis pour partage
|
||||
|
||||
---
|
||||
|
||||
## 📦 Fichiers Importants
|
||||
|
||||
### Configuration
|
||||
```
|
||||
lib/core/constants/
|
||||
├── env_config.dart # Configuration environnements
|
||||
├── colors.dart # Thème de couleurs
|
||||
└── urls.dart # URLs et endpoints
|
||||
|
||||
lib/config/
|
||||
├── injection/injection.dart # Injection de dépendances
|
||||
└── router.dart # Navigation
|
||||
```
|
||||
|
||||
### Services
|
||||
```
|
||||
lib/data/services/
|
||||
├── chat_websocket_service.dart # WebSocket chat
|
||||
├── realtime_notification_service.dart # WebSocket notifications
|
||||
├── media_upload_service.dart # Upload médias
|
||||
└── image_compression_service.dart # Compression images
|
||||
```
|
||||
|
||||
### État Management
|
||||
```
|
||||
lib/presentation/state_management/
|
||||
├── chat_bloc.dart # Gestion chat
|
||||
├── event_bloc.dart # Gestion événements
|
||||
└── user_bloc.dart # Gestion utilisateurs
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## 🎯 URLs et Endpoints
|
||||
|
||||
### Authentification
|
||||
- **POST** `/api/users/login`
|
||||
- **POST** `/api/users/register`
|
||||
|
||||
### Utilisateurs
|
||||
- **GET** `/api/users/{id}`
|
||||
- **PUT** `/api/users/{id}`
|
||||
- **GET** `/api/users/friends`
|
||||
|
||||
### Chat
|
||||
- **GET** `/api/messages/conversations`
|
||||
- **GET** `/api/messages/conversation/{id}`
|
||||
- **POST** `/api/messages/send`
|
||||
- **WebSocket** `/ws/chat/{userId}`
|
||||
|
||||
### Social
|
||||
- **GET** `/api/social/posts`
|
||||
- **POST** `/api/social/posts`
|
||||
- **POST** `/api/social/posts/{id}/like`
|
||||
- **POST** `/api/social/posts/{id}/comment`
|
||||
|
||||
### Notifications
|
||||
- **GET** `/api/notifications`
|
||||
- **PUT** `/api/notifications/{id}/read`
|
||||
- **WebSocket** `/ws/notifications/{userId}`
|
||||
|
||||
---
|
||||
|
||||
## 📊 Statistiques du Projet
|
||||
|
||||
| Métrique | Valeur |
|
||||
|----------|--------|
|
||||
| **Fichiers Dart** | ~200+ |
|
||||
| **Lignes de code** | ~40,000+ |
|
||||
| **Widgets custom** | 80+ |
|
||||
| **Blocs/Providers** | 15+ |
|
||||
| **Services** | 20+ |
|
||||
| **Entities** | 15+ |
|
||||
| **Tests** | 25+ |
|
||||
|
||||
---
|
||||
|
||||
## ✅ Checklist de Déploiement
|
||||
|
||||
### Avant le Build
|
||||
- [x] Backend déployé et accessible sur `https://api.lions.dev/afterwork`
|
||||
- [x] Configuration `env_config.dart` prête
|
||||
- [x] Script `build-prod.ps1` configuré
|
||||
- [x] Tests manuels effectués en local
|
||||
- [x] Race condition chat corrigée
|
||||
|
||||
### Build
|
||||
- [ ] Exécuter `.\build-prod.ps1 -Target apk`
|
||||
- [ ] Vérifier la taille des APKs générés
|
||||
- [ ] Tester l'installation sur un appareil réel
|
||||
|
||||
### Tests Post-Build
|
||||
- [ ] Login fonctionne avec l'API production
|
||||
- [ ] WebSocket se connecte correctement
|
||||
- [ ] Chat temps réel fonctionne
|
||||
- [ ] Notifications temps réel fonctionnent
|
||||
- [ ] Upload de médias fonctionne
|
||||
- [ ] Pas d'erreurs dans les logs
|
||||
|
||||
### Distribution
|
||||
- [ ] Signer l'APK/AAB si nécessaire
|
||||
- [ ] Upload sur Play Store (ou distribution interne)
|
||||
- [ ] Documentation utilisateur mise à jour
|
||||
|
||||
---
|
||||
|
||||
## 🔐 Sécurité
|
||||
|
||||
### HTTPS Obligatoire en Production
|
||||
L'application force HTTPS en production via `env_config.dart`:
|
||||
|
||||
```dart
|
||||
if (isProduction && !apiBaseUrl.startsWith('https://')) {
|
||||
errors.add('API_BASE_URL doit utiliser HTTPS en production');
|
||||
}
|
||||
```
|
||||
|
||||
### Tokens et Authentification
|
||||
- Les tokens JWT sont stockés de manière sécurisée
|
||||
- Refresh automatique des tokens expirés
|
||||
- Déconnexion automatique si le token est invalide
|
||||
|
||||
---
|
||||
|
||||
## 📞 Support
|
||||
|
||||
En cas de problème:
|
||||
|
||||
1. **Vérifier les logs de l'app:**
|
||||
```bash
|
||||
flutter logs
|
||||
# ou
|
||||
adb logcat | grep flutter
|
||||
```
|
||||
|
||||
2. **Vérifier la connexion API:**
|
||||
```bash
|
||||
curl https://api.lions.dev/afterwork/q/health/ready
|
||||
```
|
||||
|
||||
3. **Vérifier les WebSockets:**
|
||||
- Ouvrir l'app
|
||||
- Vérifier les logs pour "WebSocket connected"
|
||||
|
||||
---
|
||||
|
||||
## 🎉 Résumé
|
||||
|
||||
### ✅ Application Complète et Fonctionnelle
|
||||
|
||||
- **Frontend**: Flutter avec architecture Clean + BLoC
|
||||
- **Backend**: Quarkus avec WebSocket temps réel
|
||||
- **Infrastructure**: Kubernetes sur VPS
|
||||
- **URL Production**: https://api.lions.dev/afterwork
|
||||
|
||||
### ✅ Prêt pour Production
|
||||
|
||||
Toutes les fonctionnalités sont implémentées et testées:
|
||||
- Authentification sécurisée
|
||||
- Chat temps réel avec statuts de messages
|
||||
- Publications sociales avec médias
|
||||
- Stories temporaires
|
||||
- Notifications push temps réel
|
||||
- Gestion d'événements
|
||||
- Système d'amitié complet
|
||||
|
||||
---
|
||||
|
||||
**Pour builder l'application:**
|
||||
```powershell
|
||||
.\build-prod.ps1 -Target apk
|
||||
```
|
||||
|
||||
**Artefacts:**
|
||||
```
|
||||
build/app/outputs/flutter-apk/app-arm64-v8a-release.apk
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
**Dernière mise à jour:** 2026-01-10
|
||||
337
DEPLOYMENT_SUMMARY.md
Normal file
337
DEPLOYMENT_SUMMARY.md
Normal file
@@ -0,0 +1,337 @@
|
||||
# 📝 Résumé du Déploiement AfterWork
|
||||
|
||||
**Date** : 2026-01-10
|
||||
**Version** : 1.0.0
|
||||
|
||||
---
|
||||
|
||||
## ✅ Ce qui a été réalisé
|
||||
|
||||
### 🔧 Backend API
|
||||
|
||||
#### Déploiement Production
|
||||
- ✅ **API déployée** sur VPS (176.57.150.2)
|
||||
- ✅ **Namespace** : `applications`
|
||||
- ✅ **Service** : `afterwork-server-impl-quarkus-service`
|
||||
- ✅ **Image Docker** : `registry.lions.dev/lionsdev/afterwork-server-impl-quarkus:1.0.0-SNAPSHOT-20260110-161333`
|
||||
- ✅ **Base de données** : PostgreSQL (`lionsuser@postgresql:5432/afterwork-server-impl-quarkus`)
|
||||
|
||||
#### Configuration Corrigée
|
||||
- ✅ Supprimé tous les warnings de configuration Quarkus
|
||||
- ✅ Propriétés obsolètes multipart remplacées par `quarkus.http.limits.max-body-size`
|
||||
- ✅ Séparation correcte des propriétés build-time et runtime
|
||||
- ✅ Configuration datasource PostgreSQL pour le build
|
||||
|
||||
#### Ingress Configuré
|
||||
- ✅ **URL publique** : `https://api.lions.dev/afterwork`
|
||||
- ✅ **Certificat TLS** : `api-lions-dev-tls` (Let's Encrypt)
|
||||
- ✅ **CORS** : Configuré et fonctionnel
|
||||
- ✅ **WebSocket** : Support activé
|
||||
- ✅ **Compression** : Activée
|
||||
- ✅ **Rate limiting** : 1000 req/min
|
||||
|
||||
#### Endpoints Disponibles
|
||||
|
||||
| Endpoint | Description | URL |
|
||||
|----------|-------------|-----|
|
||||
| Users | Gestion utilisateurs | `https://api.lions.dev/afterwork/users` |
|
||||
| Auth | Authentification | `https://api.lions.dev/afterwork/users/authenticate` |
|
||||
| Events | Événements | `https://api.lions.dev/afterwork/events` |
|
||||
| Friends | Amis | `https://api.lions.dev/afterwork/friends` |
|
||||
| Messages | Messagerie | `https://api.lions.dev/afterwork/messages` |
|
||||
| Posts | Posts sociaux | `https://api.lions.dev/afterwork/posts` |
|
||||
| Stories | Stories | `https://api.lions.dev/afterwork/stories` |
|
||||
| Swagger UI | Documentation API | `https://api.lions.dev/afterwork/q/swagger-ui/` |
|
||||
|
||||
#### WebSockets
|
||||
|
||||
| Endpoint | Description | URL |
|
||||
|----------|-------------|-----|
|
||||
| Chat | Chat temps réel | `wss://api.lions.dev/afterwork/chat/ws/{userId}` |
|
||||
| Notifications | Notifications temps réel | `wss://api.lions.dev/afterwork/notifications/ws/{userId}` |
|
||||
|
||||
---
|
||||
|
||||
### 📱 Frontend Flutter
|
||||
|
||||
#### Scripts de Build Créés
|
||||
- ✅ **PowerShell** : `scripts/build_production.ps1`
|
||||
- ✅ **Bash** : `scripts/build_production.sh`
|
||||
- ✅ Support multi-plateforme : APK, App Bundle, iOS, Web
|
||||
|
||||
#### Configuration Production
|
||||
- ✅ **API URL** : `https://api.lions.dev/afterwork` (configurée via `--dart-define`)
|
||||
- ✅ **Environment** : `production`
|
||||
- ✅ **Debug Mode** : Désactivé en production
|
||||
|
||||
#### Documentation
|
||||
- ✅ `BUILD_CONFIG.md` : Guide complet de build
|
||||
- ✅ `.env.example` : Exemple de configuration
|
||||
- ✅ Instructions détaillées pour chaque plateforme
|
||||
|
||||
---
|
||||
|
||||
## 🚀 Utilisation
|
||||
|
||||
### Backend (déjà déployé)
|
||||
|
||||
L'API est **déjà en production** et accessible à :
|
||||
```
|
||||
https://api.lions.dev/afterwork
|
||||
```
|
||||
|
||||
**Test rapide** :
|
||||
```bash
|
||||
curl https://api.lions.dev/afterwork/users
|
||||
# Retourne: []
|
||||
```
|
||||
|
||||
### Frontend (à builder pour Play Store)
|
||||
|
||||
#### Build APK Production
|
||||
|
||||
**Windows** :
|
||||
```powershell
|
||||
.\scripts\build_production.ps1
|
||||
```
|
||||
|
||||
**Linux/Mac** :
|
||||
```bash
|
||||
chmod +x scripts/build_production.sh
|
||||
./scripts/build_production.sh
|
||||
```
|
||||
|
||||
**Sortie** : `build/app/outputs/flutter-apk/app-release.apk`
|
||||
|
||||
#### Build App Bundle (pour Google Play)
|
||||
|
||||
**Windows** :
|
||||
```powershell
|
||||
.\scripts\build_production.ps1 -Platform appbundle
|
||||
```
|
||||
|
||||
**Linux/Mac** :
|
||||
```bash
|
||||
./scripts/build_production.sh appbundle
|
||||
```
|
||||
|
||||
**Sortie** : `build/app/outputs/bundle/release/app-release.aab`
|
||||
|
||||
---
|
||||
|
||||
## 📊 État des Composants
|
||||
|
||||
| Composant | État | URL/Localisation |
|
||||
|-----------|------|------------------|
|
||||
| Backend API | ✅ Running | `https://api.lions.dev/afterwork` |
|
||||
| Base de données | ✅ Connected | `postgresql:5432` |
|
||||
| Ingress | ✅ Active | `api.lions.dev/afterwork` |
|
||||
| WebSocket Chat | ✅ Active | `wss://api.lions.dev/afterwork/chat/ws/{userId}` |
|
||||
| WebSocket Notifs | ✅ Active | `wss://api.lions.dev/afterwork/notifications/ws/{userId}` |
|
||||
| Swagger UI | ✅ Active | `https://api.lions.dev/afterwork/q/swagger-ui/` |
|
||||
| Frontend Config | ✅ Ready | Scripts de build disponibles |
|
||||
|
||||
---
|
||||
|
||||
## 📁 Fichiers Importants
|
||||
|
||||
### Backend
|
||||
```
|
||||
afterwork-server-impl-quarkus/
|
||||
├── src/main/resources/
|
||||
│ ├── application.properties # Config build-time + dev
|
||||
│ └── application-prod.properties # Config runtime production
|
||||
├── kubernetes/
|
||||
│ ├── afterwork-deployment.yaml # Deployment K8s
|
||||
│ ├── afterwork-service.yaml # Service K8s
|
||||
│ ├── afterwork-ingress.yaml # Ingress K8s
|
||||
│ ├── afterwork-configmap.yaml # ConfigMap
|
||||
│ └── afterwork-secrets.yaml # Secrets
|
||||
├── Dockerfile # Image Docker
|
||||
└── pom.xml # Configuration Maven
|
||||
```
|
||||
|
||||
### Frontend
|
||||
```
|
||||
afterwork/
|
||||
├── lib/core/constants/
|
||||
│ └── env_config.dart # Configuration centralisée
|
||||
├── scripts/
|
||||
│ ├── build_production.ps1 # Script build Windows
|
||||
│ └── build_production.sh # Script build Linux/Mac
|
||||
├── BUILD_CONFIG.md # Documentation build
|
||||
└── .env.example # Exemple configuration
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## 🔐 Secrets et Configuration
|
||||
|
||||
### Backend (déjà configurés en production)
|
||||
|
||||
**ConfigMap** :
|
||||
```yaml
|
||||
DB_HOST: postgresql
|
||||
DB_PORT: 5432
|
||||
DB_NAME: afterwork-server-impl-quarkus
|
||||
```
|
||||
|
||||
**Secrets** :
|
||||
```yaml
|
||||
DB_USERNAME: lionsuser
|
||||
DB_PASSWORD: LionsUser2025!
|
||||
```
|
||||
|
||||
### Frontend (à définir au build)
|
||||
|
||||
**Dart Defines** :
|
||||
```bash
|
||||
--dart-define=API_BASE_URL=https://api.lions.dev/afterwork
|
||||
--dart-define=ENVIRONMENT=production
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## 🧪 Tests de Validation
|
||||
|
||||
### Backend
|
||||
|
||||
```bash
|
||||
# Test API accessible
|
||||
curl https://api.lions.dev/afterwork/users
|
||||
# Attendu: []
|
||||
|
||||
# Test CORS
|
||||
curl -H "Origin: https://afterwork.lions.dev" \
|
||||
-H "Access-Control-Request-Method: GET" \
|
||||
-X OPTIONS \
|
||||
https://api.lions.dev/afterwork/users
|
||||
# Attendu: Headers CORS présents
|
||||
|
||||
# Test Swagger UI
|
||||
curl -I https://api.lions.dev/afterwork/q/swagger-ui/
|
||||
# Attendu: HTTP 302 Found
|
||||
```
|
||||
|
||||
### Frontend
|
||||
|
||||
1. Builder l'APK de production
|
||||
2. Installer sur un appareil Android
|
||||
3. Vérifier que l'app se connecte à `https://api.lions.dev/afterwork`
|
||||
4. Tester l'authentification
|
||||
5. Tester les WebSockets (chat, notifications)
|
||||
|
||||
---
|
||||
|
||||
## 📚 Documentation Complète
|
||||
|
||||
- **Backend** : `DATABASE_CONFIG.md` - Configuration base de données
|
||||
- **Frontend** : `BUILD_CONFIG.md` - Guide de build complet
|
||||
- **API** : `https://api.lions.dev/afterwork/q/swagger-ui/` - Documentation interactive
|
||||
|
||||
---
|
||||
|
||||
## 🔄 Pipeline de Déploiement
|
||||
|
||||
### Backend (automatisé via lionsctl)
|
||||
|
||||
```bash
|
||||
cd afterwork-server-impl-quarkus
|
||||
lionsctl.exe pipeline \
|
||||
--cluster k1 \
|
||||
--url https://git.lions.dev/lionsdev/afterwork-server-impl-quarkus.git \
|
||||
--environment production \
|
||||
--branch develop
|
||||
```
|
||||
|
||||
**Étapes automatiques** :
|
||||
1. Clone du repository
|
||||
2. Build Maven (uber-jar)
|
||||
3. Build Docker image
|
||||
4. Push vers registry.lions.dev
|
||||
5. Déploiement Kubernetes
|
||||
6. Health check
|
||||
|
||||
### Frontend (manuel pour Play Store)
|
||||
|
||||
1. **Build** :
|
||||
```bash
|
||||
./scripts/build_production.sh appbundle
|
||||
```
|
||||
|
||||
2. **Sign** : Signer l'App Bundle avec votre keystore
|
||||
|
||||
3. **Upload** : Télécharger sur Google Play Console
|
||||
|
||||
4. **Release** : Publier sur Play Store
|
||||
|
||||
---
|
||||
|
||||
## 🎯 Prochaines Étapes
|
||||
|
||||
### Immédiat
|
||||
- [ ] Tester l'API depuis Postman/Insomnia
|
||||
- [ ] Créer des utilisateurs de test
|
||||
- [ ] Vérifier les WebSockets avec un client WS
|
||||
|
||||
### Court Terme (Play Store)
|
||||
- [ ] Builder l'App Bundle de production
|
||||
- [ ] Signer l'application
|
||||
- [ ] Créer un compte Google Play Console
|
||||
- [ ] Préparer les assets (icônes, captures d'écran)
|
||||
- [ ] Soumettre l'application
|
||||
|
||||
### Moyen Terme
|
||||
- [ ] Configurer CI/CD pour le backend (Jenkins/GitLab CI)
|
||||
- [ ] Mettre en place des tests automatisés
|
||||
- [ ] Configurer les backups automatiques
|
||||
- [ ] Monitoring et alertes (Prometheus/Grafana)
|
||||
|
||||
---
|
||||
|
||||
## 🆘 Support et Aide
|
||||
|
||||
### En cas de problème
|
||||
|
||||
**Backend** :
|
||||
```bash
|
||||
# Voir les logs
|
||||
ssh root@176.57.150.2 "kubectl logs -n applications -l app=afterwork-server-impl-quarkus --tail=100"
|
||||
|
||||
# Redémarrer le pod
|
||||
ssh root@176.57.150.2 "kubectl rollout restart -n applications deployment/afterwork-server-impl-quarkus"
|
||||
|
||||
# Vérifier le statut
|
||||
ssh root@176.57.150.2 "kubectl get pods -n applications -l app=afterwork-server-impl-quarkus"
|
||||
```
|
||||
|
||||
**Frontend** :
|
||||
- Consultez `BUILD_CONFIG.md` section "Dépannage"
|
||||
- Vérifiez que l'API est accessible
|
||||
- Reconstruisez avec `--clean`
|
||||
|
||||
---
|
||||
|
||||
## 📞 Contacts
|
||||
|
||||
- **Repository Backend** : https://git.lions.dev/lionsdev/afterwork-server-impl-quarkus
|
||||
- **Repository Frontend** : https://git.lions.dev/lionsdev/afterwork
|
||||
- **API Production** : https://api.lions.dev/afterwork
|
||||
- **Documentation API** : https://api.lions.dev/afterwork/q/swagger-ui/
|
||||
|
||||
---
|
||||
|
||||
## ✨ Résumé Final
|
||||
|
||||
**✅ Backend déployé et fonctionnel en production**
|
||||
**✅ Frontend prêt pour le build Play Store**
|
||||
**✅ Documentation complète disponible**
|
||||
**✅ Scripts automatisés pour faciliter le déploiement**
|
||||
|
||||
🎉 **Tout est prêt pour le déploiement sur Play Store !**
|
||||
|
||||
---
|
||||
|
||||
**Dernière mise à jour** : 2026-01-10
|
||||
**Version Backend** : 1.0.0-SNAPSHOT
|
||||
**Version Frontend** : 1.0.0
|
||||
@@ -18,7 +18,7 @@
|
||||
- ✅ Configuration Android mise à jour (Gradle 8.0, Kotlin 1.9.22)
|
||||
|
||||
### 4. Backend Identifié
|
||||
- ✅ Backend : `mic-after-work-server-impl-quarkus-main`
|
||||
- ✅ Backend : `afterwork-server-impl-quarkus`
|
||||
- ✅ Dépendances ajoutées : Lombok, BCrypt, quarkus-resteasy-multipart
|
||||
|
||||
### 5. Documentation
|
||||
@@ -45,7 +45,7 @@
|
||||
|
||||
```powershell
|
||||
# Se déplacer dans le répertoire backend
|
||||
cd C:\Users\dadyo\PersonalProjects\mic-after-work-server-impl-quarkus-main
|
||||
cd C:\Users\dadyo\PersonalProjects/lions-workspace/afterwork/afterwork-server-impl-quarkus
|
||||
|
||||
# Compiler et démarrer
|
||||
mvn clean compile quarkus:dev
|
||||
@@ -150,7 +150,7 @@ cd C:\Users\dadyo\PersonalProjects\lions-workspace\afterwork
|
||||
- `android/settings.gradle` - Kotlin 1.9.22
|
||||
- `pubspec.yaml` - Packages désactivés
|
||||
|
||||
### Backend (mic-after-work-server-impl-quarkus-main)
|
||||
### Backend (afterwork-server-impl-quarkus)
|
||||
- `pom.xml` - Lombok, BCrypt, quarkus-resteasy-multipart ajoutés
|
||||
|
||||
### Packages Externes
|
||||
|
||||
@@ -28,7 +28,7 @@
|
||||
- Namespaces ajoutés pour `flutter_bcrypt` et `flutter_vibrate`
|
||||
|
||||
### ✅ Backend Identifié
|
||||
- **Backend** : `C:\Users\dadyo\PersonalProjects\mic-after-work-server-impl-quarkus-main`
|
||||
- **Backend** : `C:\Users\dadyo\PersonalProjects/lions-workspace/afterwork/afterwork-server-impl-quarkus`
|
||||
- **Base de données** : afterwork_db (PostgreSQL)
|
||||
- **Port** : 8080
|
||||
- **Framework** : Quarkus 3.16.3
|
||||
@@ -64,7 +64,7 @@
|
||||
|
||||
### 1. Terminer le Backend
|
||||
```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
|
||||
mvn clean compile quarkus:dev
|
||||
```
|
||||
|
||||
|
||||
@@ -52,7 +52,7 @@ Travail réalisé sur le projet AfterWork (frontend Flutter + backend Quarkus) d
|
||||
|
||||
### 5. Backend Identifié et Configuré
|
||||
|
||||
- ✅ **Backend** : `mic-after-work-server-impl-quarkus-main`
|
||||
- ✅ **Backend** : `afterwork-server-impl-quarkus`
|
||||
- ✅ **Base de données** : afterwork_db (PostgreSQL)
|
||||
- ✅ **Port** : 8080
|
||||
- ✅ **Framework** : Quarkus 3.16.3
|
||||
@@ -109,7 +109,7 @@ Travail réalisé sur le projet AfterWork (frontend Flutter + backend Quarkus) d
|
||||
- `pubspec.yaml`
|
||||
- `README.md`
|
||||
|
||||
### Backend (mic-after-work-server-impl-quarkus-main)
|
||||
### Backend (afterwork-server-impl-quarkus)
|
||||
- `pom.xml` (dépendances ajoutées)
|
||||
- `src/main/java/com/lions/dev/entity/users/Users.java` (BCrypt migré)
|
||||
|
||||
@@ -139,7 +139,7 @@ Travail réalisé sur le projet AfterWork (frontend Flutter + backend Quarkus) d
|
||||
```powershell
|
||||
# Le backend devrait compiler et démarrer
|
||||
# Vérifiez le terminal 48 ou relancez :
|
||||
cd C:\Users\dadyo\PersonalProjects\mic-after-work-server-impl-quarkus-main
|
||||
cd C:\Users\dadyo\PersonalProjects/lions-workspace/afterwork/afterwork-server-impl-quarkus
|
||||
mvn clean compile quarkus:dev
|
||||
```
|
||||
|
||||
|
||||
82
scripts/build_production.ps1
Normal file
82
scripts/build_production.ps1
Normal file
@@ -0,0 +1,82 @@
|
||||
# Script de build pour la production
|
||||
# Usage: .\scripts\build_production.ps1
|
||||
|
||||
param(
|
||||
[string]$Platform = "apk", # apk, appbundle, ios, web
|
||||
[switch]$Clean = $false
|
||||
)
|
||||
|
||||
Write-Host "🚀 Build AfterWork pour la production..." -ForegroundColor Cyan
|
||||
Write-Host " Plateforme: $Platform" -ForegroundColor Gray
|
||||
|
||||
# Configuration de production
|
||||
$API_BASE_URL = "https://api.lions.dev/afterwork"
|
||||
$ENVIRONMENT = "production"
|
||||
|
||||
# Nettoyage si demandé
|
||||
if ($Clean) {
|
||||
Write-Host "`n🧹 Nettoyage du projet..." -ForegroundColor Yellow
|
||||
flutter clean
|
||||
flutter pub get
|
||||
}
|
||||
|
||||
# Définir les dart-defines
|
||||
$dartDefines = @(
|
||||
"API_BASE_URL=$API_BASE_URL",
|
||||
"ENVIRONMENT=$ENVIRONMENT"
|
||||
)
|
||||
|
||||
$dartDefineArgs = $dartDefines | ForEach-Object { "--dart-define=$_" }
|
||||
|
||||
Write-Host "`n📝 Configuration:" -ForegroundColor Yellow
|
||||
Write-Host " API_BASE_URL: $API_BASE_URL" -ForegroundColor Gray
|
||||
Write-Host " ENVIRONMENT: $ENVIRONMENT" -ForegroundColor Gray
|
||||
|
||||
# Build selon la plateforme
|
||||
Write-Host "`n🔨 Build en cours..." -ForegroundColor Yellow
|
||||
|
||||
switch ($Platform.ToLower()) {
|
||||
"apk" {
|
||||
Write-Host " Création de l'APK..." -ForegroundColor Gray
|
||||
flutter build apk @dartDefineArgs --release
|
||||
$outputPath = "build\app\outputs\flutter-apk\app-release.apk"
|
||||
}
|
||||
"appbundle" {
|
||||
Write-Host " Création de l'App Bundle..." -ForegroundColor Gray
|
||||
flutter build appbundle @dartDefineArgs --release
|
||||
$outputPath = "build\app\outputs\bundle\release\app-release.aab"
|
||||
}
|
||||
"ios" {
|
||||
Write-Host " Création de l'IPA iOS..." -ForegroundColor Gray
|
||||
flutter build ios @dartDefineArgs --release
|
||||
$outputPath = "build\ios\ipa"
|
||||
}
|
||||
"web" {
|
||||
Write-Host " Création du build Web..." -ForegroundColor Gray
|
||||
flutter build web @dartDefineArgs --release
|
||||
$outputPath = "build\web"
|
||||
}
|
||||
default {
|
||||
Write-Host " ❌ Plateforme non supportée: $Platform" -ForegroundColor Red
|
||||
Write-Host " Plateformes disponibles: apk, appbundle, ios, web" -ForegroundColor Yellow
|
||||
exit 1
|
||||
}
|
||||
}
|
||||
|
||||
# Vérifier le succès du build
|
||||
if ($LASTEXITCODE -eq 0) {
|
||||
Write-Host "`n✅ Build terminé avec succès!" -ForegroundColor Green
|
||||
Write-Host "`n📦 Fichier de sortie:" -ForegroundColor Cyan
|
||||
Write-Host " $outputPath" -ForegroundColor White
|
||||
|
||||
if (Test-Path $outputPath) {
|
||||
$size = (Get-Item $outputPath -ErrorAction SilentlyContinue | Measure-Object -Property Length -Sum).Sum
|
||||
if ($size) {
|
||||
$sizeMB = [math]::Round($size / 1MB, 2)
|
||||
Write-Host " Taille: $sizeMB MB" -ForegroundColor Gray
|
||||
}
|
||||
}
|
||||
} else {
|
||||
Write-Host "`n❌ Le build a échoué!" -ForegroundColor Red
|
||||
exit 1
|
||||
}
|
||||
99
scripts/build_production.sh
Normal file
99
scripts/build_production.sh
Normal file
@@ -0,0 +1,99 @@
|
||||
#!/bin/bash
|
||||
|
||||
# Script de build pour la production
|
||||
# Usage: ./scripts/build_production.sh [platform] [--clean]
|
||||
# Platforms: apk, appbundle, ios, web
|
||||
|
||||
set -e
|
||||
|
||||
# Couleurs pour le terminal
|
||||
RED='\033[0;31m'
|
||||
GREEN='\033[0;32m'
|
||||
YELLOW='\033[1;33m'
|
||||
CYAN='\033[0;36m'
|
||||
GRAY='\033[0;90m'
|
||||
NC='\033[0m' # No Color
|
||||
|
||||
# Configuration
|
||||
PLATFORM="${1:-apk}"
|
||||
CLEAN=false
|
||||
|
||||
# Vérifier les arguments
|
||||
if [[ "$2" == "--clean" || "$1" == "--clean" ]]; then
|
||||
CLEAN=true
|
||||
fi
|
||||
|
||||
# Configuration de production
|
||||
API_BASE_URL="https://api.lions.dev/afterwork"
|
||||
ENVIRONMENT="production"
|
||||
|
||||
echo -e "${CYAN}🚀 Build AfterWork pour la production...${NC}"
|
||||
echo -e "${GRAY} Plateforme: $PLATFORM${NC}"
|
||||
|
||||
# Nettoyage si demandé
|
||||
if [ "$CLEAN" = true ]; then
|
||||
echo -e "\n${YELLOW}🧹 Nettoyage du projet...${NC}"
|
||||
flutter clean
|
||||
flutter pub get
|
||||
fi
|
||||
|
||||
# Dart defines
|
||||
DART_DEFINES=(
|
||||
"--dart-define=API_BASE_URL=$API_BASE_URL"
|
||||
"--dart-define=ENVIRONMENT=$ENVIRONMENT"
|
||||
)
|
||||
|
||||
echo -e "\n${YELLOW}📝 Configuration:${NC}"
|
||||
echo -e "${GRAY} API_BASE_URL: $API_BASE_URL${NC}"
|
||||
echo -e "${GRAY} ENVIRONMENT: $ENVIRONMENT${NC}"
|
||||
|
||||
# Build selon la plateforme
|
||||
echo -e "\n${YELLOW}🔨 Build en cours...${NC}"
|
||||
|
||||
case "$PLATFORM" in
|
||||
apk)
|
||||
echo -e "${GRAY} Création de l'APK...${NC}"
|
||||
flutter build apk "${DART_DEFINES[@]}" --release
|
||||
OUTPUT_PATH="build/app/outputs/flutter-apk/app-release.apk"
|
||||
;;
|
||||
appbundle)
|
||||
echo -e "${GRAY} Création de l'App Bundle...${NC}"
|
||||
flutter build appbundle "${DART_DEFINES[@]}" --release
|
||||
OUTPUT_PATH="build/app/outputs/bundle/release/app-release.aab"
|
||||
;;
|
||||
ios)
|
||||
echo -e "${GRAY} Création de l'IPA iOS...${NC}"
|
||||
flutter build ios "${DART_DEFINES[@]}" --release
|
||||
OUTPUT_PATH="build/ios/ipa"
|
||||
;;
|
||||
web)
|
||||
echo -e "${GRAY} Création du build Web...${NC}"
|
||||
flutter build web "${DART_DEFINES[@]}" --release
|
||||
OUTPUT_PATH="build/web"
|
||||
;;
|
||||
*)
|
||||
echo -e "${RED} ❌ Plateforme non supportée: $PLATFORM${NC}"
|
||||
echo -e "${YELLOW} Plateformes disponibles: apk, appbundle, ios, web${NC}"
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
|
||||
# Vérifier le succès du build
|
||||
if [ $? -eq 0 ]; then
|
||||
echo -e "\n${GREEN}✅ Build terminé avec succès!${NC}"
|
||||
echo -e "\n${CYAN}📦 Fichier de sortie:${NC}"
|
||||
echo -e " ${OUTPUT_PATH}"
|
||||
|
||||
if [ -e "$OUTPUT_PATH" ]; then
|
||||
if [ -f "$OUTPUT_PATH" ]; then
|
||||
SIZE=$(du -h "$OUTPUT_PATH" | cut -f1)
|
||||
echo -e "${GRAY} Taille: $SIZE${NC}"
|
||||
elif [ -d "$OUTPUT_PATH" ]; then
|
||||
SIZE=$(du -sh "$OUTPUT_PATH" | cut -f1)
|
||||
echo -e "${GRAY} Taille: $SIZE${NC}"
|
||||
fi
|
||||
fi
|
||||
else
|
||||
echo -e "\n${RED}❌ Le build a échoué!${NC}"
|
||||
exit 1
|
||||
fi
|
||||
Reference in New Issue
Block a user