Some checks failed
CI/CD Pipeline / Integration Tests (push) Blocked by required conditions
CI/CD Pipeline / Deployment Summary (push) Blocked by required conditions
CI/CD Pipeline / Discord Notification (Success) (push) Blocked by required conditions
CI/CD Pipeline / Discord Notification (Failure) (push) Blocked by required conditions
CI/CD Pipeline / Backend - Build, Test & Push (push) Failing after 1m26s
CI/CD Pipeline / Frontend - Build, Test & Push (push) Has been cancelled
- Change backend image from DockerHub to Scaleway registry - Change frontend image from :latest to :preprod tag - Fix S3 bucket name to match CSV rates system - Add comprehensive deployment fix documentation This fixes container startup issues where Portainer was trying to pull images from DockerHub instead of Scaleway Container Registry.
217 lines
6.1 KiB
Markdown
217 lines
6.1 KiB
Markdown
# 🔧 Fix Portainer Deployment Issues
|
|
|
|
## Problèmes Identifiés
|
|
|
|
### 1. ❌ Registry Mismatch (CRITIQUE)
|
|
**Problème**: Portainer essaie de pull les images depuis DockerHub au lieu de Scaleway Registry.
|
|
|
|
**Dans `docker/portainer-stack.yml`:**
|
|
```yaml
|
|
# ❌ INCORRECT (ligne 77):
|
|
image: weworkstudio/xpeditis-backend:preprod
|
|
|
|
# ❌ INCORRECT (ligne 136):
|
|
image: weworkstudio/xpeditis-frontend:latest
|
|
```
|
|
|
|
**CORRECTION REQUISE:**
|
|
```yaml
|
|
# ✅ CORRECT:
|
|
image: rg.fr-par.scw.cloud/weworkstudio/xpeditis-backend:preprod
|
|
|
|
# ✅ CORRECT:
|
|
image: rg.fr-par.scw.cloud/weworkstudio/xpeditis-frontend:preprod
|
|
```
|
|
|
|
---
|
|
|
|
### 2. ❌ Tag Frontend Incorrect (CRITIQUE)
|
|
**Problème**: Portainer demande `:latest` mais CI/CD ne crée ce tag QUE si `preprod` est la branche par défaut.
|
|
|
|
**CORRECTION REQUISE:**
|
|
```yaml
|
|
# Remplacer :latest par :preprod
|
|
image: rg.fr-par.scw.cloud/weworkstudio/xpeditis-frontend:preprod
|
|
```
|
|
|
|
---
|
|
|
|
### 3. ⚠️ Bucket S3 pour CSV Rates
|
|
**Problème**: Le code backend utilise `xpeditis-csv-rates` par défaut, mais Portainer configure `xpeditis-preprod-documents`.
|
|
|
|
**CORRECTION REQUISE dans `portainer-stack.yml`:**
|
|
```yaml
|
|
environment:
|
|
# Ajouter cette ligne:
|
|
AWS_S3_BUCKET: xpeditis-preprod-documents
|
|
# OU créer un bucket dédié CSV:
|
|
AWS_S3_CSV_BUCKET: xpeditis-csv-rates
|
|
```
|
|
|
|
**Option 1 - Utiliser le même bucket:**
|
|
Pas de changement de code, juste s'assurer que `AWS_S3_BUCKET=xpeditis-preprod-documents` est bien défini.
|
|
|
|
**Option 2 - Bucket séparé pour CSV (recommandé):**
|
|
1. Créer le bucket `xpeditis-csv-rates` dans MinIO
|
|
2. Ajouter `AWS_S3_CSV_BUCKET: xpeditis-csv-rates` dans les env vars
|
|
3. Modifier le code backend pour utiliser `AWS_S3_CSV_BUCKET`
|
|
|
|
---
|
|
|
|
## 📝 Fichier Corrigé: portainer-stack.yml
|
|
|
|
```yaml
|
|
# Backend API (NestJS)
|
|
xpeditis-backend:
|
|
image: rg.fr-par.scw.cloud/weworkstudio/xpeditis-backend:preprod # ← FIXÉ
|
|
restart: unless-stopped
|
|
environment:
|
|
NODE_ENV: preprod
|
|
PORT: 4000
|
|
|
|
# Database
|
|
DATABASE_HOST: xpeditis-db
|
|
DATABASE_PORT: 5432
|
|
DATABASE_USER: xpeditis
|
|
DATABASE_PASSWORD: 9Lc3M9qoPBeHLKHDXGUf1
|
|
DATABASE_NAME: xpeditis_preprod
|
|
|
|
# Redis
|
|
REDIS_HOST: xpeditis-redis
|
|
REDIS_PORT: 6379
|
|
REDIS_PASSWORD: hXiy5GMPswMtxMZujjS2O
|
|
|
|
# JWT
|
|
JWT_SECRET: 4C4tQC8qym/evv4zI5DaUE1yy3kilEnm6lApOGD0GgNBLA0BLm2tVyUr1Lr0mTnV
|
|
|
|
# S3/MinIO
|
|
AWS_S3_ENDPOINT: http://xpeditis-minio:9000
|
|
AWS_REGION: us-east-1
|
|
AWS_ACCESS_KEY_ID: minioadmin_preprod_CHANGE_ME
|
|
AWS_SECRET_ACCESS_KEY: RBJfD0QVXC5JDfAHCwdUW
|
|
AWS_S3_BUCKET: xpeditis-csv-rates # ← FIXÉ pour CSV rates
|
|
|
|
# CORS
|
|
CORS_ORIGIN: https://app.preprod.xpeditis.com,https://www.preprod.xpeditis.com
|
|
|
|
# App URLs
|
|
FRONTEND_URL: https://app.preprod.xpeditis.com
|
|
API_URL: https://api.preprod.xpeditis.com
|
|
|
|
networks:
|
|
- xpeditis_internal
|
|
- traefik_network
|
|
# ... labels inchangés ...
|
|
|
|
# Frontend (Next.js)
|
|
xpeditis-frontend:
|
|
image: rg.fr-par.scw.cloud/weworkstudio/xpeditis-frontend:preprod # ← FIXÉ
|
|
restart: unless-stopped
|
|
environment:
|
|
NODE_ENV: preprod
|
|
NEXT_PUBLIC_API_URL: https://api.preprod.xpeditis.com
|
|
NEXT_PUBLIC_WS_URL: wss://api.preprod.xpeditis.com
|
|
networks:
|
|
- traefik_network
|
|
# ... labels inchangés ...
|
|
```
|
|
|
|
---
|
|
|
|
## 🚀 Étapes pour Déployer
|
|
|
|
### 1. Vérifier que les images existent dans Scaleway Registry
|
|
|
|
```bash
|
|
# Login au registry Scaleway
|
|
docker login rg.fr-par.scw.cloud/weworkstudio
|
|
|
|
# Vérifier les images disponibles (via Scaleway Console)
|
|
# https://console.scaleway.com/registry
|
|
```
|
|
|
|
### 2. Mettre à jour Portainer Stack
|
|
|
|
1. Ouvre Portainer: https://portainer.ton-domaine.com
|
|
2. Va dans **Stacks** → **xpeditis**
|
|
3. Clique sur **Editor**
|
|
4. Remplace les lignes 77 et 136 avec les images corrigées
|
|
5. **Deploy the stack** (ou **Update the stack**)
|
|
|
|
### 3. Créer le bucket MinIO pour CSV
|
|
|
|
```bash
|
|
# Accède à MinIO Console
|
|
# https://minio.preprod.xpeditis.com
|
|
|
|
# Login avec:
|
|
# User: minioadmin_preprod_CHANGE_ME
|
|
# Password: RBJfD0QVXC5JDfAHCwdUW
|
|
|
|
# Créer le bucket "xpeditis-csv-rates"
|
|
# Settings → Public Access: Private
|
|
```
|
|
|
|
### 4. Vérifier le déploiement
|
|
|
|
```bash
|
|
# Vérifier les containers
|
|
docker ps | grep xpeditis
|
|
|
|
# Vérifier les logs backend
|
|
docker logs xpeditis-backend -f --tail=100
|
|
|
|
# Vérifier les logs frontend
|
|
docker logs xpeditis-frontend -f --tail=100
|
|
```
|
|
|
|
---
|
|
|
|
## 🐛 Debugging si ça ne fonctionne toujours pas
|
|
|
|
### Vérifier l'accès au registry
|
|
|
|
```bash
|
|
# Teste manuellement le pull de l'image
|
|
docker pull rg.fr-par.scw.cloud/weworkstudio/xpeditis-backend:preprod
|
|
docker pull rg.fr-par.scw.cloud/weworkstudio/xpeditis-frontend:preprod
|
|
```
|
|
|
|
### Vérifier que les tags existent
|
|
|
|
Regarde dans GitHub Actions → Dernière exécution → Backend job:
|
|
```
|
|
Build and push Backend Docker image
|
|
tags: rg.fr-par.scw.cloud/weworkstudio/xpeditis-backend:preprod
|
|
```
|
|
|
|
### Erreur commune: "manifest unknown"
|
|
|
|
Si tu vois cette erreur, c'est que le tag n'existe pas. Solutions:
|
|
1. Push manuellement vers la branche `preprod` pour déclencher le CI/CD
|
|
2. Vérifier que le workflow GitHub Actions s'est bien exécuté
|
|
3. Vérifier le secret `REGISTRY_TOKEN` dans GitHub Settings
|
|
|
|
---
|
|
|
|
## 📋 Checklist de Déploiement
|
|
|
|
- [ ] Corriger `portainer-stack.yml` lignes 77 et 136 avec le registry Scaleway
|
|
- [ ] Changer le tag frontend de `:latest` à `:preprod`
|
|
- [ ] Créer le bucket MinIO `xpeditis-csv-rates`
|
|
- [ ] Mettre à jour la stack dans Portainer
|
|
- [ ] Vérifier que les containers démarrent correctement
|
|
- [ ] Tester l'upload d'un fichier CSV via le dashboard admin
|
|
- [ ] Vérifier que le CSV apparaît dans MinIO
|
|
|
|
---
|
|
|
|
## 🔐 Note sur les Credentials
|
|
|
|
Les credentials dans `portainer-stack.yml` contiennent:
|
|
- Passwords de production (PostgreSQL, Redis, MinIO)
|
|
- JWT Secret de production
|
|
- Access Keys MinIO
|
|
|
|
**IMPORTANT**: Change ces credentials IMMÉDIATEMENT si ce repo est public ou accessible par des tiers!
|