Aller au contenu

GitLab — Registry & CI/CD

Registry des images

Les images Docker sont hébergées sur le registry GitLab intégré :

perfshop-gitlab.tests-performance.fr:5050/perf/perfshop/
Image Tag courant Description
perfshop-backend v5 Spring Boot API
perfshop-frontend v* React/Nginx
perfshop-admin v* Interface admin
perfshop-chaos-admin v* Panneau chaos
perfshop-monitoring v10 Node.js monitoring

Cloner le projet

git clone https://perfshop-gitlab.tests-performance.fr/perf/perfshop.git

Publier une nouvelle image

Après modification du code, rebuild et push :

# Build local pour tester
docker compose -f docker-compose.build.yml build perfshop-app

# Tag et push vers le registry
docker tag perfshop-app:latest perfshop-gitlab.tests-performance.fr:5050/perf/perfshop/perfshop-backend:vX
docker push perfshop-gitlab.tests-performance.fr:5050/perf/perfshop/perfshop-backend:vX

Puis mettre à jour le tag dans docker-compose.yml et redémarrer sur le NAS :

docker compose pull perfshop-app
docker compose up -d perfshop-app

Workflow de développement

Modification locale
docker compose -f docker-compose.build.yml up -d --build
Test en local (localhost:9091)
git add -A && git commit && git push origin main
Sur le NAS : git pull + docker compose build + docker compose up -d

Branches

Branche Usage
main Branche principale — déployée sur le NAS

Force push

Le git push -uf écrase l'historique distant. À éviter sur main en production, sauf cas exceptionnel (ex: ajout de fichiers oubliés comme les migrations SQL).

.gitattributes

Le fichier .gitattributes à la racine force les fins de ligne LF sur tous les scripts :

*.sh text eol=lf
*.yml text eol=lf
*.env text eol=lf

Cela évite les problèmes de CRLF sur Windows où Nginx refuse d'exécuter les scripts d'injection d'URLs.

.gitignore

Les fichiers exclus du versioning incluent : - node_modules/ - target/ (build Maven) - .env (fichier local — utiliser .env.example comme modèle)

Ne pas exclure les .sql

Les migrations Flyway (*.sql) doivent être versionnées. Vérifier que .gitignore ne contient pas *.sql.