mirror of
https://git.v0id.ovh/n3wt-innov/n3wt-school.git
synced 2026-04-03 16:51:26 +00:00
Compare commits
7 Commits
N3WTS-2-Re
...
e9a30b7bde
| Author | SHA1 | Date | |
|---|---|---|---|
| e9a30b7bde | |||
| ff1d113698 | |||
| 12a6ad1d61 | |||
| 856443d4ed | |||
| ace4dcbf07 | |||
| 61f63f9dc9 | |||
| d9e998d2ff |
@ -1 +1 @@
|
|||||||
__version__ = "0.0.3"
|
__version__ = "0.0.4"
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "n3wt-school-front-end",
|
"name": "n3wt-school-front-end",
|
||||||
"version": "0.0.3",
|
"version": "0.0.4",
|
||||||
"private": true,
|
"private": true,
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"dev": "next dev",
|
"dev": "next dev",
|
||||||
@ -51,4 +51,4 @@
|
|||||||
"postcss": "^8.4.47",
|
"postcss": "^8.4.47",
|
||||||
"tailwindcss": "^3.4.14"
|
"tailwindcss": "^3.4.14"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
85
JenkinsFile
85
JenkinsFile
@ -1,85 +0,0 @@
|
|||||||
pipeline {
|
|
||||||
agent any
|
|
||||||
|
|
||||||
environment {
|
|
||||||
DOCKER_REGISTRY = 'git.v0id.ovh'
|
|
||||||
ORGANIZATION = "n3wt-innov"
|
|
||||||
APP_NAME = 'n3wt-school'
|
|
||||||
}
|
|
||||||
|
|
||||||
// Déclencher uniquement sur les tags
|
|
||||||
triggers {
|
|
||||||
issueCommentTrigger('.*deploy.*')
|
|
||||||
}
|
|
||||||
|
|
||||||
stages {
|
|
||||||
stage('Vérification du Tag') {
|
|
||||||
when {
|
|
||||||
expression { env.TAG_NAME != null }
|
|
||||||
}
|
|
||||||
steps {
|
|
||||||
script {
|
|
||||||
// Extraire la version du tag
|
|
||||||
env.VERSION = env.TAG_NAME
|
|
||||||
echo "Version détectée: ${env.VERSION}"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
stage('Build Docker Images') {
|
|
||||||
when {
|
|
||||||
expression { env.TAG_NAME != null }
|
|
||||||
}
|
|
||||||
steps {
|
|
||||||
script {
|
|
||||||
// Donner les permissions d'exécution au script
|
|
||||||
sh 'chmod +x ./ci-scripts/makeDocker.sh'
|
|
||||||
|
|
||||||
// Exécuter le script avec la version
|
|
||||||
sh """
|
|
||||||
./ci-scripts/makeDocker.sh ${env.VERSION}
|
|
||||||
"""
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
stage('Push sur Registry') {
|
|
||||||
when {
|
|
||||||
expression { env.TAG_NAME != null }
|
|
||||||
}
|
|
||||||
steps {
|
|
||||||
script {
|
|
||||||
withCredentials([usernamePassword(
|
|
||||||
credentialsId: 'docker-registry-credentials',
|
|
||||||
usernameVariable: 'REGISTRY_USER',
|
|
||||||
passwordVariable: 'REGISTRY_PASS'
|
|
||||||
)]) {
|
|
||||||
// Login au registry
|
|
||||||
sh "docker login ${DOCKER_REGISTRY} -u ${REGISTRY_USER} -p ${REGISTRY_PASS}"
|
|
||||||
|
|
||||||
// Push des images
|
|
||||||
sh """
|
|
||||||
docker push ${DOCKER_REGISTRY}/${ORGANIZATION}/${APP_NAME}/frontend:${env.VERSION}
|
|
||||||
docker push ${DOCKER_REGISTRY}/${ORGANIZATION}/${APP_NAME}/backend:${env.VERSION}
|
|
||||||
docker push ${DOCKER_REGISTRY}/${ORGANIZATION}/${APP_NAME}/frontend:latest
|
|
||||||
docker push ${DOCKER_REGISTRY}/${ORGANIZATION}/${APP_NAME}/backend:latest
|
|
||||||
"""
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
post {
|
|
||||||
success {
|
|
||||||
echo "Build et push des images Docker réussis pour la version ${env.VERSION}"
|
|
||||||
}
|
|
||||||
failure {
|
|
||||||
echo "Échec du build ou du push des images Docker"
|
|
||||||
}
|
|
||||||
always {
|
|
||||||
// Nettoyage
|
|
||||||
sh 'docker system prune -f'
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
27
README.md
27
README.md
@ -24,7 +24,7 @@ Maquette figma : https://www.figma.com/design/1BtWHIQlJDTeue2oYblefV/Maquette-Lo
|
|||||||
|
|
||||||
Lien de téléchargement : https://www.docker.com/get-started/
|
Lien de téléchargement : https://www.docker.com/get-started/
|
||||||
|
|
||||||
# Lancement de monteschool
|
# Lancement du projet
|
||||||
|
|
||||||
```sh
|
```sh
|
||||||
docker compose up -d
|
docker compose up -d
|
||||||
@ -36,7 +36,7 @@ Lancement du front end
|
|||||||
npm run dev
|
npm run dev
|
||||||
```
|
```
|
||||||
|
|
||||||
se connecter à localhost:8080
|
- se connecter à localhost:8080 pour le backend localhost:3000 pour le front
|
||||||
|
|
||||||
# Installation et développement en local
|
# Installation et développement en local
|
||||||
|
|
||||||
@ -57,25 +57,6 @@ npm i
|
|||||||
npm run format
|
npm run format
|
||||||
```
|
```
|
||||||
|
|
||||||
# Faire une livraison Mise en Production
|
# Mise en Production, Préparation de la release
|
||||||
|
|
||||||
```sh
|
- [MO_PREPARATION_MISE_EN_PROD](./docs/MEP/MO_PRE_MEP.md)
|
||||||
# Faire la première release (1.0.0)
|
|
||||||
npm run release -- --first-release
|
|
||||||
|
|
||||||
# Faire une prerelease (RC,alpha,beta)
|
|
||||||
npm run release -- --prerelease <name>
|
|
||||||
|
|
||||||
|
|
||||||
# Faire une release
|
|
||||||
npm run release
|
|
||||||
|
|
||||||
# Forcer la release sur un mode particulier (majeur, mineur ou patch)
|
|
||||||
# npm run script
|
|
||||||
npm run release -- --release-as minor
|
|
||||||
# Or
|
|
||||||
npm run release -- --release-as 1.1.0
|
|
||||||
|
|
||||||
# ignorer les hooks de commit lors de la release
|
|
||||||
npm run release -- --no-verify
|
|
||||||
```
|
|
||||||
|
|||||||
90
ci/build.Jenkinsfile
Normal file
90
ci/build.Jenkinsfile
Normal file
@ -0,0 +1,90 @@
|
|||||||
|
pipeline {
|
||||||
|
|
||||||
|
agent {
|
||||||
|
label "SLAVE-N3WT"
|
||||||
|
}
|
||||||
|
|
||||||
|
options {
|
||||||
|
disableConcurrentBuilds()
|
||||||
|
timestamps()
|
||||||
|
}
|
||||||
|
|
||||||
|
environment {
|
||||||
|
DOCKER_REGISTRY = "git.v0id.ovh"
|
||||||
|
ORG_NAME = "n3wt-innov"
|
||||||
|
APP_NAME = "n3wt-school"
|
||||||
|
|
||||||
|
IMAGE_FRONT = "${DOCKER_REGISTRY}/${ORG_NAME}/${APP_NAME}/frontend"
|
||||||
|
IMAGE_BACK = "${DOCKER_REGISTRY}/${ORG_NAME}/${APP_NAME}/backend"
|
||||||
|
}
|
||||||
|
|
||||||
|
stages {
|
||||||
|
|
||||||
|
stage("Check Tag") {
|
||||||
|
when {
|
||||||
|
not {
|
||||||
|
buildingTag()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
steps {
|
||||||
|
script {
|
||||||
|
currentBuild.result = 'NOT_BUILT'
|
||||||
|
error("⚠️ Pipeline uniquement déclenchée sur les tags. Aucun tag détecté.")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
stage("Build Docker Images") {
|
||||||
|
when {
|
||||||
|
buildingTag()
|
||||||
|
}
|
||||||
|
steps {
|
||||||
|
sh """
|
||||||
|
chmod +x ./ci/scripts/makeDocker.sh
|
||||||
|
./ci/scripts/makeDocker.sh ${TAG_NAME}
|
||||||
|
"""
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
stage("Push Images to Registry") {
|
||||||
|
when {
|
||||||
|
buildingTag()
|
||||||
|
}
|
||||||
|
steps {
|
||||||
|
withCredentials([usernamePassword(
|
||||||
|
credentialsId: "gitea-jenkins",
|
||||||
|
usernameVariable: "REGISTRY_USER",
|
||||||
|
passwordVariable: "REGISTRY_PASS"
|
||||||
|
)]) {
|
||||||
|
|
||||||
|
sh """
|
||||||
|
echo "Login registry..."
|
||||||
|
docker login ${DOCKER_REGISTRY} \
|
||||||
|
-u ${REGISTRY_USER} \
|
||||||
|
-p ${REGISTRY_PASS}
|
||||||
|
|
||||||
|
echo "Push version images..."
|
||||||
|
docker push ${IMAGE_FRONT}:${TAG_NAME}
|
||||||
|
docker push ${IMAGE_BACK}:${TAG_NAME}
|
||||||
|
|
||||||
|
echo "Tag latest..."
|
||||||
|
docker tag ${IMAGE_FRONT}:${TAG_NAME} ${IMAGE_FRONT}:latest
|
||||||
|
docker tag ${IMAGE_BACK}:${TAG_NAME} ${IMAGE_BACK}:latest
|
||||||
|
|
||||||
|
docker push ${IMAGE_FRONT}:latest
|
||||||
|
docker push ${IMAGE_BACK}:latest
|
||||||
|
"""
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
post {
|
||||||
|
always {
|
||||||
|
sh """
|
||||||
|
docker builder prune -f
|
||||||
|
docker image prune -f
|
||||||
|
"""
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
42
ci/deploy.Jenkinsfile
Normal file
42
ci/deploy.Jenkinsfile
Normal file
@ -0,0 +1,42 @@
|
|||||||
|
pipeline {
|
||||||
|
agent { label "SLAVE-N3WT" }
|
||||||
|
|
||||||
|
parameters {
|
||||||
|
choice(name: 'ENVIRONMENT', choices: ['demo', 'prod'], description: 'Choisir environnement')
|
||||||
|
string(name: 'VERSION', defaultValue: 'v1.0.0', description: 'Version Docker à déployer')
|
||||||
|
}
|
||||||
|
|
||||||
|
environment {
|
||||||
|
PLATEFORME_DEMO = 'demo.n3wtschool.com'
|
||||||
|
PLATEFORME_PROD = 'vps.n3wtschool.com'
|
||||||
|
DEPLOY_DIR = '~/n3wtschool'
|
||||||
|
}
|
||||||
|
|
||||||
|
stages {
|
||||||
|
stage('Deploy') {
|
||||||
|
steps {
|
||||||
|
script {
|
||||||
|
def targetHost = params.ENVIRONMENT == 'prod' ? env.PLATEFORME_PROD : env.PLATEFORME_DEMO
|
||||||
|
def deployDir = env.DEPLOY_DIR
|
||||||
|
|
||||||
|
// Le credential id Jenkins qui contient la clé SSH
|
||||||
|
def sshCredentialId = params.ENVIRONMENT == 'prod' ? 'vps_n3wt_prod' : 'demo_n3wt'
|
||||||
|
|
||||||
|
// Le user SSH que tu passes dans la commande ssh
|
||||||
|
def sshUser = params.ENVIRONMENT == 'prod' ? 'root' : 'demo'
|
||||||
|
|
||||||
|
sshagent([sshCredentialId]) {
|
||||||
|
sh """
|
||||||
|
ssh -o StrictHostKeyChecking=no ${sshUser}@${targetHost} <<EOF
|
||||||
|
cd ${deployDir}
|
||||||
|
docker compose down
|
||||||
|
docker compose pull
|
||||||
|
docker compose up -d
|
||||||
|
EOF
|
||||||
|
"""
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -1,5 +1,8 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
|
SCRIPT_PATH="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
|
||||||
|
|
||||||
|
|
||||||
# Récupération de la version depuis les arguments
|
# Récupération de la version depuis les arguments
|
||||||
VERSION=$1
|
VERSION=$1
|
||||||
|
|
||||||
@ -8,21 +11,22 @@ if [ -z "$VERSION" ]; then
|
|||||||
echo "Usage: ./makeDocker.sh <version>"
|
echo "Usage: ./makeDocker.sh <version>"
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
SCRIPT_PATH="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
|
|
||||||
cd $SCRIPT_PATH
|
|
||||||
# Configuration
|
# Configuration
|
||||||
DOCKER_REGISTRY="git.v0id.ovh"
|
DOCKER_REGISTRY="git.v0id.ovh"
|
||||||
|
ORG_NAME="n3wt-innov"
|
||||||
APP_NAME="n3wt-school"
|
APP_NAME="n3wt-school"
|
||||||
|
|
||||||
echo "Début de la construction des images Docker pour la version ${VERSION}"
|
echo "Début de la construction des images Docker pour la version ${VERSION}"
|
||||||
|
|
||||||
# Construction de l'image Frontend
|
# Construction de l'image Frontend
|
||||||
echo "Construction de l'image Frontend..."
|
echo "Construction de l'image Frontend..."
|
||||||
cd ../Front-End
|
cd $SCRIPT_PATH/../../Front-End
|
||||||
|
|
||||||
docker build \
|
docker build \
|
||||||
--build-arg BUILD_MODE=production \
|
--build-arg BUILD_MODE=production \
|
||||||
-t ${DOCKER_REGISTRY}/n3wt-innov/${APP_NAME}/frontend:${VERSION} \
|
-t ${DOCKER_REGISTRY}/${ORG_NAME}/${APP_NAME}/frontend:${VERSION} \
|
||||||
-t ${DOCKER_REGISTRY}/n3wt-innov/${APP_NAME}/frontend:latest \
|
-t ${DOCKER_REGISTRY}/${ORG_NAME}/${APP_NAME}/frontend:latest \
|
||||||
.
|
.
|
||||||
|
|
||||||
if [ $? -ne 0 ]; then
|
if [ $? -ne 0 ]; then
|
||||||
@ -32,10 +36,10 @@ fi
|
|||||||
|
|
||||||
# Construction de l'image Backend
|
# Construction de l'image Backend
|
||||||
echo "Construction de l'image Backend..."
|
echo "Construction de l'image Backend..."
|
||||||
cd ../Back-End
|
cd $SCRIPT_PATH/../../Back-End
|
||||||
docker build \
|
docker build \
|
||||||
-t ${DOCKER_REGISTRY}/n3wt-innov/${APP_NAME}/backend:${VERSION} \
|
-t ${DOCKER_REGISTRY}/${ORG_NAME}/${APP_NAME}/backend:${VERSION} \
|
||||||
-t ${DOCKER_REGISTRY}/n3wt-innov/${APP_NAME}/backend:latest \
|
-t ${DOCKER_REGISTRY}/${ORG_NAME}/${APP_NAME}/backend:latest \
|
||||||
.
|
.
|
||||||
|
|
||||||
if [ $? -ne 0 ]; then
|
if [ $? -ne 0 ]; then
|
||||||
@ -45,9 +49,9 @@ fi
|
|||||||
|
|
||||||
echo "Construction des images Docker terminée avec succès"
|
echo "Construction des images Docker terminée avec succès"
|
||||||
echo "Images créées :"
|
echo "Images créées :"
|
||||||
echo "- ${DOCKER_REGISTRY}/${APP_NAME}/frontend:${VERSION}"
|
echo "- ${DOCKER_REGISTRY}/${ORG_NAME}/${APP_NAME}/frontend:${VERSION}"
|
||||||
echo "- ${DOCKER_REGISTRY}/${APP_NAME}/frontend:latest"
|
echo "- ${DOCKER_REGISTRY}/${ORG_NAME}/${APP_NAME}/frontend:latest"
|
||||||
echo "- ${DOCKER_REGISTRY}/${APP_NAME}/backend:${VERSION}"
|
echo "- ${DOCKER_REGISTRY}/${ORG_NAME}/${APP_NAME}/backend:${VERSION}"
|
||||||
echo "- ${DOCKER_REGISTRY}/${APP_NAME}/backend:latest"
|
echo "- ${DOCKER_REGISTRY}/${ORG_NAME}/${APP_NAME}/backend:latest"
|
||||||
|
|
||||||
exit 0
|
exit 0
|
||||||
38
docs/manuels/MEP/MO_PRE_MEP.md
Normal file
38
docs/manuels/MEP/MO_PRE_MEP.md
Normal file
@ -0,0 +1,38 @@
|
|||||||
|
# Préparation de la RELEASE et du CHANGELOG
|
||||||
|
|
||||||
|
- Vérifier que l'ensemble des tickets sont mergé dans develop
|
||||||
|
- Fusionner develop dans main via une [nouvelle demande d'ajout](https://git.v0id.ovh/n3wt-innov/n3wt-school/compare/main...develop)
|
||||||
|
- Faire une release avec la commande `npm run release` sur la branch main
|
||||||
|
\*\* NB: si vous souhaité avoir une release particulier (cf. Utilisation de standart-version)
|
||||||
|
- Pousser le commit de changement de version/Changelog et le tag sur main
|
||||||
|
- Depuis jenkins lancer le build sur le nouveau tag créé : https://jenkins.v0id.ovh/job/N3WT/job/Newt-Innov/job/n3wt-school/view/tags/
|
||||||
|
|
||||||
|
# Faire une Mise en Production
|
||||||
|
|
||||||
|
- Depuis jenkins deployer la nouvelle version tagué.
|
||||||
|
|
||||||
|
# Utilisation de standart-version
|
||||||
|
|
||||||
|
L'utilisation de la norme conventionnal commit permet la génération automatique d'un CHANGELOG
|
||||||
|
via l'outil [standard-version](https://github.com/conventional-changelog/standard-version)
|
||||||
|
|
||||||
|
```sh
|
||||||
|
# Faire la première release (1.0.0)
|
||||||
|
npm run release -- --first-release
|
||||||
|
|
||||||
|
# Faire une prerelease (RC,alpha,beta)
|
||||||
|
npm run release -- --prerelease <name>
|
||||||
|
|
||||||
|
|
||||||
|
# Faire une release
|
||||||
|
npm run release
|
||||||
|
|
||||||
|
# Forcer la release sur un mode particulier (majeur, mineur ou patch)
|
||||||
|
# npm run script
|
||||||
|
npm run release -- --release-as minor
|
||||||
|
# Or
|
||||||
|
npm run release -- --release-as 1.1.0
|
||||||
|
|
||||||
|
# ignorer les hooks de commit lors de la release
|
||||||
|
npm run release -- --no-verify
|
||||||
|
```
|
||||||
Reference in New Issue
Block a user