Initial commit: PrimeFaces Freya Extension - Composants Freya pour PrimeFaces avec support Quarkus
This commit is contained in:
341
DEPLOYMENT.md
Normal file
341
DEPLOYMENT.md
Normal file
@@ -0,0 +1,341 @@
|
||||
# Guide de Déploiement
|
||||
|
||||
Ce guide explique comment déployer **PrimeFaces Freya Extension** en production.
|
||||
|
||||
## 📦 Build de Production
|
||||
|
||||
### 1. Compiler le projet
|
||||
|
||||
```bash
|
||||
# Nettoyer et compiler
|
||||
mvn clean install
|
||||
|
||||
# Compiler sans les tests (plus rapide)
|
||||
mvn clean install -DskipTests
|
||||
|
||||
# Compiler avec profil de production
|
||||
mvn clean install -Pproduction
|
||||
```
|
||||
|
||||
### 2. Vérifier les artefacts
|
||||
|
||||
Les artefacts sont générés dans :
|
||||
```
|
||||
runtime/target/primefaces-freya-extension-runtime-1.0.0-SNAPSHOT.jar
|
||||
integration-tests/target/primefaces-freya-extension-integration-tests-1.0.0-SNAPSHOT.jar
|
||||
```
|
||||
|
||||
## 🚀 Déploiement sur différentes plateformes
|
||||
|
||||
### Quarkus en mode JVM
|
||||
|
||||
```bash
|
||||
cd integration-tests
|
||||
|
||||
# Build
|
||||
mvn clean package
|
||||
|
||||
# Lancer
|
||||
java -jar target/quarkus-app/quarkus-run.jar
|
||||
```
|
||||
|
||||
### Quarkus en mode natif
|
||||
|
||||
```bash
|
||||
cd integration-tests
|
||||
|
||||
# Build natif (nécessite GraalVM)
|
||||
mvn clean package -Pnative
|
||||
|
||||
# Lancer
|
||||
./target/primefaces-freya-extension-integration-tests-1.0.0-SNAPSHOT-runner
|
||||
```
|
||||
|
||||
### Docker
|
||||
|
||||
#### Créer l'image Docker
|
||||
|
||||
```bash
|
||||
cd integration-tests
|
||||
|
||||
# Build avec Docker
|
||||
mvn clean package -Dquarkus.container-image.build=true
|
||||
|
||||
# Ou utiliser le Dockerfile
|
||||
docker build -f src/main/docker/Dockerfile.jvm -t primefaces-freya-extension:latest .
|
||||
```
|
||||
|
||||
#### Lancer le conteneur
|
||||
|
||||
```bash
|
||||
docker run -i --rm -p 8080:8080 primefaces-freya-extension:latest
|
||||
```
|
||||
|
||||
#### Docker Compose
|
||||
|
||||
```yaml
|
||||
version: '3.8'
|
||||
|
||||
services:
|
||||
app:
|
||||
image: primefaces-freya-extension:latest
|
||||
ports:
|
||||
- "8080:8080"
|
||||
environment:
|
||||
- QUARKUS_PROFILE=prod
|
||||
- QUARKUS_HTTP_PORT=8080
|
||||
restart: unless-stopped
|
||||
```
|
||||
|
||||
### Kubernetes
|
||||
|
||||
#### Deployment YAML
|
||||
|
||||
```yaml
|
||||
apiVersion: apps/v1
|
||||
kind: Deployment
|
||||
metadata:
|
||||
name: primefaces-freya-extension
|
||||
spec:
|
||||
replicas: 3
|
||||
selector:
|
||||
matchLabels:
|
||||
app: primefaces-freya-extension
|
||||
template:
|
||||
metadata:
|
||||
labels:
|
||||
app: primefaces-freya-extension
|
||||
spec:
|
||||
containers:
|
||||
- name: app
|
||||
image: primefaces-freya-extension:latest
|
||||
ports:
|
||||
- containerPort: 8080
|
||||
env:
|
||||
- name: QUARKUS_PROFILE
|
||||
value: "prod"
|
||||
resources:
|
||||
requests:
|
||||
memory: "256Mi"
|
||||
cpu: "250m"
|
||||
limits:
|
||||
memory: "512Mi"
|
||||
cpu: "500m"
|
||||
---
|
||||
apiVersion: v1
|
||||
kind: Service
|
||||
metadata:
|
||||
name: primefaces-freya-extension
|
||||
spec:
|
||||
selector:
|
||||
app: primefaces-freya-extension
|
||||
ports:
|
||||
- port: 80
|
||||
targetPort: 8080
|
||||
type: LoadBalancer
|
||||
```
|
||||
|
||||
### Serveur d'applications (WildFly, Tomcat, etc.)
|
||||
|
||||
```bash
|
||||
# Build WAR
|
||||
mvn clean package -Dquarkus.package.type=legacy-jar
|
||||
|
||||
# Déployer sur WildFly
|
||||
cp target/*.war $WILDFLY_HOME/standalone/deployments/
|
||||
|
||||
# Déployer sur Tomcat
|
||||
cp target/*.war $TOMCAT_HOME/webapps/
|
||||
```
|
||||
|
||||
## ⚙️ Configuration de Production
|
||||
|
||||
### application.properties (Production)
|
||||
|
||||
```properties
|
||||
# Mode production
|
||||
quarkus.faces.project-stage=Production
|
||||
quarkus.faces.state-saving-method=server
|
||||
|
||||
# Logging
|
||||
quarkus.log.level=INFO
|
||||
quarkus.log.console.enable=true
|
||||
quarkus.log.console.format=%d{HH:mm:ss} %-5p [%c{2.}] (%t) %s%e%n
|
||||
|
||||
# HTTP
|
||||
quarkus.http.port=8080
|
||||
quarkus.http.host=0.0.0.0
|
||||
quarkus.http.cors=true
|
||||
|
||||
# PrimeFaces
|
||||
primefaces.THEME=freya
|
||||
primefaces.FONT_AWESOME=true
|
||||
primefaces.CLIENT_SIDE_VALIDATION=true
|
||||
primefaces.MOVE_SCRIPTS_TO_BOTTOM=true
|
||||
primefaces.SUBMIT=partial
|
||||
primefaces.UPLOADER=auto
|
||||
|
||||
# Cache
|
||||
quarkus.http.enable-compression=true
|
||||
quarkus.http.compress-media-types=text/html,text/css,application/javascript
|
||||
|
||||
# Security (si applicable)
|
||||
quarkus.http.ssl.certificate.file=/path/to/certificate.crt
|
||||
quarkus.http.ssl.certificate.key-file=/path/to/private.key
|
||||
```
|
||||
|
||||
## 🔒 Sécurité
|
||||
|
||||
### 1. HTTPS
|
||||
|
||||
Toujours utiliser HTTPS en production :
|
||||
|
||||
```properties
|
||||
quarkus.http.ssl-port=8443
|
||||
quarkus.http.insecure-requests=redirect
|
||||
```
|
||||
|
||||
### 2. Headers de sécurité
|
||||
|
||||
```properties
|
||||
quarkus.http.header."X-Frame-Options".value=DENY
|
||||
quarkus.http.header."X-Content-Type-Options".value=nosniff
|
||||
quarkus.http.header."X-XSS-Protection".value=1; mode=block
|
||||
quarkus.http.header."Strict-Transport-Security".value=max-age=31536000; includeSubDomains
|
||||
```
|
||||
|
||||
### 3. CSP (Content Security Policy)
|
||||
|
||||
```properties
|
||||
quarkus.http.header."Content-Security-Policy".value=default-src 'self'; script-src 'self' 'unsafe-inline'; style-src 'self' 'unsafe-inline'
|
||||
```
|
||||
|
||||
## 📊 Monitoring
|
||||
|
||||
### Health Checks
|
||||
|
||||
```properties
|
||||
quarkus.smallrye-health.root-path=/health
|
||||
```
|
||||
|
||||
Endpoints disponibles :
|
||||
- `/health` - Health check global
|
||||
- `/health/live` - Liveness probe
|
||||
- `/health/ready` - Readiness probe
|
||||
|
||||
### Metrics
|
||||
|
||||
```properties
|
||||
quarkus.micrometer.enabled=true
|
||||
quarkus.micrometer.export.prometheus.enabled=true
|
||||
```
|
||||
|
||||
Endpoint : `/metrics`
|
||||
|
||||
## 🔧 Optimisations
|
||||
|
||||
### 1. Minification des ressources
|
||||
|
||||
```properties
|
||||
primefaces.MOVE_SCRIPTS_TO_BOTTOM=true
|
||||
primefaces.SUBMIT=partial
|
||||
```
|
||||
|
||||
### 2. Compression
|
||||
|
||||
```properties
|
||||
quarkus.http.enable-compression=true
|
||||
```
|
||||
|
||||
### 3. Cache
|
||||
|
||||
```xml
|
||||
<!-- Dans web.xml -->
|
||||
<context-param>
|
||||
<param-name>javax.faces.FACELETS_REFRESH_PERIOD</param-name>
|
||||
<param-value>-1</param-value>
|
||||
</context-param>
|
||||
```
|
||||
|
||||
## 📈 Performance
|
||||
|
||||
### Recommandations JVM
|
||||
|
||||
```bash
|
||||
java -Xms256m -Xmx512m \
|
||||
-XX:+UseG1GC \
|
||||
-XX:MaxGCPauseMillis=200 \
|
||||
-jar target/quarkus-app/quarkus-run.jar
|
||||
```
|
||||
|
||||
### Mode natif (meilleure performance)
|
||||
|
||||
```bash
|
||||
# Build natif
|
||||
mvn clean package -Pnative
|
||||
|
||||
# Temps de démarrage : ~0.05s
|
||||
# Mémoire : ~50MB
|
||||
```
|
||||
|
||||
## 🌐 Reverse Proxy (Nginx)
|
||||
|
||||
```nginx
|
||||
server {
|
||||
listen 80;
|
||||
server_name example.com;
|
||||
|
||||
location / {
|
||||
proxy_pass http://localhost:8080;
|
||||
proxy_set_header Host $host;
|
||||
proxy_set_header X-Real-IP $remote_addr;
|
||||
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
||||
proxy_set_header X-Forwarded-Proto $scheme;
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
## 📝 Checklist de déploiement
|
||||
|
||||
- [ ] Tests passent (`mvn test`)
|
||||
- [ ] Build réussit (`mvn clean install`)
|
||||
- [ ] Configuration de production validée
|
||||
- [ ] HTTPS configuré
|
||||
- [ ] Headers de sécurité configurés
|
||||
- [ ] Health checks fonctionnels
|
||||
- [ ] Logs configurés
|
||||
- [ ] Monitoring en place
|
||||
- [ ] Backup configuré
|
||||
- [ ] Documentation à jour
|
||||
|
||||
## 🆘 Dépannage
|
||||
|
||||
### Problème : Application ne démarre pas
|
||||
|
||||
```bash
|
||||
# Vérifier les logs
|
||||
tail -f logs/application.log
|
||||
|
||||
# Vérifier le port
|
||||
netstat -an | grep 8080
|
||||
```
|
||||
|
||||
### Problème : Ressources non chargées
|
||||
|
||||
Vérifier que les ressources Freya sont accessibles :
|
||||
- `/resources/freya-layout/css/layout-light.css`
|
||||
- `/resources/freya-layout/css/primeicons.css`
|
||||
|
||||
### Problème : Performance lente
|
||||
|
||||
1. Activer la compression
|
||||
2. Utiliser le mode natif
|
||||
3. Augmenter la mémoire JVM
|
||||
4. Vérifier les requêtes N+1
|
||||
|
||||
## 📧 Support
|
||||
|
||||
Pour toute question sur le déploiement :
|
||||
- Email : contact@lions.dev
|
||||
- GitHub Issues : https://github.com/lions-dev/primefaces-freya-extension/issues
|
||||
|
||||
Reference in New Issue
Block a user