Compare commits
11 Commits
0d68356457
...
release-1.
| Author | SHA1 | Date | |
|---|---|---|---|
| 02cf98f6ca | |||
| 825fedf118 | |||
| 61296dda0c | |||
| 2bbd2d16e4 | |||
| b15d8458c8 | |||
| 100b75a05a | |||
| d57b26c8c8 | |||
| 803a78cd71 | |||
| 466655f52d | |||
| ac702c8835 | |||
| 92dfcbe61e |
235
Jenkinsfile
vendored
235
Jenkinsfile
vendored
@@ -8,16 +8,15 @@ pipeline {
|
|||||||
}
|
}
|
||||||
|
|
||||||
environment {
|
environment {
|
||||||
CI_NETWORK = "tiptop-ci-${BUILD_NUMBER}"
|
REGISTRY = "registry.wk-archi-o24a-4-5-g4.fr"
|
||||||
CI_DATABASE = "tiptop-ci-db-${BUILD_NUMBER}"
|
|
||||||
|
|
||||||
DATABASE_URL = "postgresql://tiptop_ci:tiptop_ci_password@${CI_DATABASE}:5432/the_tip_top_ci"
|
|
||||||
|
|
||||||
REGISTRY = "localhost:5000"
|
|
||||||
IMAGE_TAG = "${BUILD_NUMBER}"
|
|
||||||
|
|
||||||
BACKEND_IMAGE = "${REGISTRY}/the-tip-top/backend"
|
BACKEND_IMAGE = "${REGISTRY}/the-tip-top/backend"
|
||||||
FRONTEND_IMAGE = "${REGISTRY}/the-tip-top/frontend"
|
FRONTEND_IMAGE = "${REGISTRY}/the-tip-top/frontend"
|
||||||
|
|
||||||
|
CI_NETWORK = "tiptop-ci-${JOB_BASE_NAME}-${BUILD_NUMBER}"
|
||||||
|
CI_DATABASE = "tiptop-ci-db-${JOB_BASE_NAME}-${BUILD_NUMBER}"
|
||||||
|
|
||||||
|
DATABASE_URL = "postgresql://tiptop_ci:tiptop_ci_password@${CI_DATABASE}:5432/the_tip_top_ci"
|
||||||
}
|
}
|
||||||
|
|
||||||
stages {
|
stages {
|
||||||
@@ -27,6 +26,69 @@ pipeline {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
stage('Préparer environnement') {
|
||||||
|
steps {
|
||||||
|
script {
|
||||||
|
env.IMAGE_TAG = "${env.BRANCH_NAME}-${env.BUILD_NUMBER}"
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Stratégie de branches :
|
||||||
|
*
|
||||||
|
* feature/* -> CI uniquement
|
||||||
|
* develop -> DEV automatique
|
||||||
|
* release-* -> PREPROD automatique
|
||||||
|
* main -> PROD avec validation manuelle
|
||||||
|
*/
|
||||||
|
|
||||||
|
if (env.BRANCH_NAME == 'develop') {
|
||||||
|
env.DEPLOY_ENABLED = 'true'
|
||||||
|
env.DEPLOY_ENV = 'DEV'
|
||||||
|
|
||||||
|
env.COMPOSE_FILE = 'deploy/dev/docker-compose.yml'
|
||||||
|
env.COMPOSE_PROJECT = 'tiptop-dev'
|
||||||
|
env.DEPLOY_NETWORK = 'tiptop-dev'
|
||||||
|
|
||||||
|
env.FRONTEND_API_URL = "https://api-dev.dsp5-archi-o24a-4-5-g4.fr"
|
||||||
|
|
||||||
|
} else if (env.BRANCH_NAME.startsWith('release-')) {
|
||||||
|
env.DEPLOY_ENABLED = 'true'
|
||||||
|
env.DEPLOY_ENV = 'PREPROD'
|
||||||
|
|
||||||
|
env.COMPOSE_FILE = 'deploy/preprod/docker-compose.yml'
|
||||||
|
env.COMPOSE_PROJECT = 'tiptop-preprod'
|
||||||
|
env.DEPLOY_NETWORK = 'tiptop-preprod'
|
||||||
|
|
||||||
|
env.FRONTEND_API_URL = "https://api-preprod.dsp5-archi-o24a-4-5-g4.fr"
|
||||||
|
|
||||||
|
} else if (env.BRANCH_NAME == 'main') {
|
||||||
|
env.DEPLOY_ENABLED = 'true'
|
||||||
|
env.DEPLOY_ENV = 'PROD'
|
||||||
|
|
||||||
|
env.COMPOSE_FILE = 'deploy/prod/docker-compose.yml'
|
||||||
|
env.COMPOSE_PROJECT = 'tiptop-prod'
|
||||||
|
env.DEPLOY_NETWORK = 'tiptop-prod'
|
||||||
|
|
||||||
|
env.FRONTEND_API_URL = "https://api.dsp5-archi-o24a-4-5-g4.fr"
|
||||||
|
|
||||||
|
} else {
|
||||||
|
env.DEPLOY_ENABLED = 'false'
|
||||||
|
env.DEPLOY_ENV = 'CI uniquement'
|
||||||
|
|
||||||
|
env.COMPOSE_FILE = ''
|
||||||
|
env.COMPOSE_PROJECT = ''
|
||||||
|
env.DEPLOY_NETWORK = ''
|
||||||
|
env.FRONTEND_API_URL = ''
|
||||||
|
}
|
||||||
|
|
||||||
|
echo "Branche : ${env.BRANCH_NAME}"
|
||||||
|
echo "Tag Docker : ${env.IMAGE_TAG}"
|
||||||
|
echo "Environnement : ${env.DEPLOY_ENV}"
|
||||||
|
echo "Déploiement activé : ${env.DEPLOY_ENABLED}"
|
||||||
|
echo "API frontend : ${env.FRONTEND_API_URL}"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
stage('Vérification du workspace') {
|
stage('Vérification du workspace') {
|
||||||
steps {
|
steps {
|
||||||
sh '''
|
sh '''
|
||||||
@@ -34,9 +96,10 @@ pipeline {
|
|||||||
test -f backend/package-lock.json
|
test -f backend/package-lock.json
|
||||||
test -f frontend/package.json
|
test -f frontend/package.json
|
||||||
test -f frontend/package-lock.json
|
test -f frontend/package-lock.json
|
||||||
test -f deploy/dev/docker-compose.yml
|
|
||||||
|
|
||||||
echo "Tag Docker : ${IMAGE_TAG}"
|
if [ "${DEPLOY_ENABLED}" = "true" ]; then
|
||||||
|
test -f "${COMPOSE_FILE}"
|
||||||
|
fi
|
||||||
'''
|
'''
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -54,22 +117,30 @@ pipeline {
|
|||||||
-e POSTGRES_DB=the_tip_top_ci \
|
-e POSTGRES_DB=the_tip_top_ci \
|
||||||
postgres:16-alpine
|
postgres:16-alpine
|
||||||
|
|
||||||
echo "Attente de PostgreSQL..."
|
echo "Attente de PostgreSQL CI..."
|
||||||
|
|
||||||
for i in $(seq 1 30); do
|
for i in $(seq 1 30); do
|
||||||
if docker exec "${CI_DATABASE}" \
|
if docker exec "${CI_DATABASE}" \
|
||||||
pg_isready -U tiptop_ci -d the_tip_top_ci; then
|
pg_isready \
|
||||||
echo "PostgreSQL est prêt."
|
-U tiptop_ci \
|
||||||
|
-d the_tip_top_ci; then
|
||||||
|
|
||||||
|
echo "PostgreSQL CI est prêt."
|
||||||
break
|
break
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ "$i" -eq 30 ]; then
|
if [ "$i" -eq 30 ]; then
|
||||||
|
echo "PostgreSQL CI ne répond pas."
|
||||||
docker logs "${CI_DATABASE}"
|
docker logs "${CI_DATABASE}"
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
sleep 2
|
sleep 2
|
||||||
done
|
done
|
||||||
|
docker run --rm \
|
||||||
|
-v tiptop-npm-cache-backend:/npm-cache \
|
||||||
|
alpine \
|
||||||
|
sh -c 'chown -R 1000:1000 /npm-cache'
|
||||||
|
|
||||||
docker run --rm \
|
docker run --rm \
|
||||||
--network "${CI_NETWORK}" \
|
--network "${CI_NETWORK}" \
|
||||||
@@ -96,12 +167,32 @@ pipeline {
|
|||||||
"
|
"
|
||||||
'''
|
'''
|
||||||
}
|
}
|
||||||
|
|
||||||
|
post {
|
||||||
|
always {
|
||||||
|
junit(
|
||||||
|
testResults: 'backend/test-results/*.xml',
|
||||||
|
allowEmptyResults: true
|
||||||
|
)
|
||||||
|
|
||||||
|
archiveArtifacts(
|
||||||
|
artifacts: 'backend/coverage/**',
|
||||||
|
fingerprint: true,
|
||||||
|
allowEmptyArchive: true
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
stage('Frontend - Lint et Build') {
|
stage('Frontend - Lint et Build') {
|
||||||
steps {
|
steps {
|
||||||
sh '''
|
sh '''
|
||||||
docker run --rm \
|
docker run --rm \
|
||||||
|
-v tiptop-npm-cache-frontend:/npm-cache \
|
||||||
|
alpine \
|
||||||
|
sh -c 'chown -R 1000:1000 /npm-cache'
|
||||||
|
|
||||||
|
docker run --rm \
|
||||||
--volumes-from furious-jenkins \
|
--volumes-from furious-jenkins \
|
||||||
-v tiptop-npm-cache-frontend:/npm-cache \
|
-v tiptop-npm-cache-frontend:/npm-cache \
|
||||||
--user "$(id -u):$(id -g)" \
|
--user "$(id -u):$(id -g)" \
|
||||||
@@ -124,70 +215,122 @@ pipeline {
|
|||||||
}
|
}
|
||||||
|
|
||||||
stage('Construction des images Docker') {
|
stage('Construction des images Docker') {
|
||||||
|
when {
|
||||||
|
expression {
|
||||||
|
env.DEPLOY_ENABLED == 'true'
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
steps {
|
steps {
|
||||||
sh '''
|
sh '''
|
||||||
docker build \
|
docker build \
|
||||||
-t "${BACKEND_IMAGE}:${IMAGE_TAG}" \
|
-t "${BACKEND_IMAGE}:${IMAGE_TAG}" \
|
||||||
-t "${BACKEND_IMAGE}:latest" \
|
|
||||||
backend
|
backend
|
||||||
|
|
||||||
docker build \
|
docker build \
|
||||||
--build-arg VITE_API_URL=http://192.168.1.23:5001 \
|
--build-arg VITE_API_URL="${FRONTEND_API_URL}" \
|
||||||
-t "${FRONTEND_IMAGE}:${IMAGE_TAG}" \
|
-t "${FRONTEND_IMAGE}:${IMAGE_TAG}" \
|
||||||
-t "${FRONTEND_IMAGE}:latest" \
|
|
||||||
frontend
|
frontend
|
||||||
'''
|
'''
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
stage('Publication dans le Registry') {
|
stage('Publication dans le Registry') {
|
||||||
steps {
|
when {
|
||||||
sh '''
|
expression {
|
||||||
docker push "${BACKEND_IMAGE}:${IMAGE_TAG}"
|
env.DEPLOY_ENABLED == 'true'
|
||||||
docker push "${BACKEND_IMAGE}:latest"
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
steps {
|
||||||
|
withCredentials([
|
||||||
|
usernamePassword(
|
||||||
|
credentialsId: 'registry-credentials',
|
||||||
|
usernameVariable: 'REGISTRY_USER',
|
||||||
|
passwordVariable: 'REGISTRY_PASSWORD'
|
||||||
|
)
|
||||||
|
]) {
|
||||||
|
sh '''
|
||||||
|
echo "${REGISTRY_PASSWORD}" | \
|
||||||
|
docker login "${REGISTRY}" \
|
||||||
|
-u "${REGISTRY_USER}" \
|
||||||
|
--password-stdin
|
||||||
|
|
||||||
|
docker push "${BACKEND_IMAGE}:${IMAGE_TAG}"
|
||||||
docker push "${FRONTEND_IMAGE}:${IMAGE_TAG}"
|
docker push "${FRONTEND_IMAGE}:${IMAGE_TAG}"
|
||||||
docker push "${FRONTEND_IMAGE}:latest"
|
|
||||||
'''
|
'''
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
stage('Validation production') {
|
||||||
|
when {
|
||||||
|
expression {
|
||||||
|
env.DEPLOY_ENV == 'PROD'
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
steps {
|
||||||
|
timeout(time: 15, unit: 'MINUTES') {
|
||||||
|
input(
|
||||||
|
message: "Déployer ${IMAGE_TAG} en production ?",
|
||||||
|
ok: "Déployer"
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
stage('Déploiement') {
|
||||||
|
when {
|
||||||
|
expression {
|
||||||
|
env.DEPLOY_ENABLED == 'true'
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
stage('Déploiement DEV') {
|
|
||||||
steps {
|
steps {
|
||||||
sh '''
|
sh '''
|
||||||
|
echo "Déploiement de ${BRANCH_NAME} vers ${DEPLOY_ENV}"
|
||||||
|
echo "Image backend : ${BACKEND_IMAGE}:${IMAGE_TAG}"
|
||||||
|
echo "Image frontend : ${FRONTEND_IMAGE}:${IMAGE_TAG}"
|
||||||
|
echo "Compose : ${COMPOSE_FILE}"
|
||||||
|
|
||||||
REGISTRY="${REGISTRY}" \
|
REGISTRY="${REGISTRY}" \
|
||||||
IMAGE_TAG="${IMAGE_TAG}" \
|
IMAGE_TAG="${IMAGE_TAG}" \
|
||||||
docker compose \
|
docker compose \
|
||||||
-p tiptop-dev \
|
-p "${COMPOSE_PROJECT}" \
|
||||||
-f deploy/dev/docker-compose.yml \
|
-f "${COMPOSE_FILE}" \
|
||||||
up -d \
|
up -d \
|
||||||
--pull always \
|
--pull always \
|
||||||
--remove-orphans
|
--remove-orphans
|
||||||
|
|
||||||
echo "Attente du backend DEV..."
|
echo "Attente du backend ${DEPLOY_ENV}..."
|
||||||
|
|
||||||
for i in $(seq 1 30); do
|
for i in $(seq 1 30); do
|
||||||
if docker run --rm \
|
if docker run --rm \
|
||||||
--network tiptop-dev \
|
--network "${DEPLOY_NETWORK}" \
|
||||||
curlimages/curl:8.12.1 \
|
curlimages/curl:8.12.1 \
|
||||||
-fsS http://backend:5000/ >/dev/null; then
|
-fsS \
|
||||||
|
http://backend:5000/ \
|
||||||
|
>/dev/null; then
|
||||||
|
|
||||||
echo "Backend DEV opérationnel."
|
echo "Backend ${DEPLOY_ENV} opérationnel."
|
||||||
break
|
break
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ "$i" -eq 30 ]; then
|
if [ "$i" -eq 30 ]; then
|
||||||
echo "Le backend DEV ne répond pas."
|
echo "Le backend ${DEPLOY_ENV} ne répond pas."
|
||||||
|
|
||||||
docker compose \
|
docker compose \
|
||||||
-p tiptop-dev \
|
-p "${COMPOSE_PROJECT}" \
|
||||||
-f deploy/dev/docker-compose.yml \
|
-f "${COMPOSE_FILE}" \
|
||||||
ps
|
ps
|
||||||
|
|
||||||
docker compose \
|
docker compose \
|
||||||
-p tiptop-dev \
|
-p "${COMPOSE_PROJECT}" \
|
||||||
-f deploy/dev/docker-compose.yml \
|
-f "${COMPOSE_FILE}" \
|
||||||
logs --tail=100
|
logs \
|
||||||
|
--tail=150
|
||||||
|
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
@@ -195,14 +338,16 @@ pipeline {
|
|||||||
sleep 5
|
sleep 5
|
||||||
done
|
done
|
||||||
|
|
||||||
echo "Vérification du frontend DEV..."
|
echo "Vérification du frontend ${DEPLOY_ENV}..."
|
||||||
|
|
||||||
docker run --rm \
|
docker run --rm \
|
||||||
--network tiptop-dev \
|
--network "${DEPLOY_NETWORK}" \
|
||||||
curlimages/curl:8.12.1 \
|
curlimages/curl:8.12.1 \
|
||||||
-fsS http://frontend/ >/dev/null
|
-fsS \
|
||||||
|
http://frontend/ \
|
||||||
|
>/dev/null
|
||||||
|
|
||||||
echo "Frontend DEV opérationnel."
|
echo "Frontend ${DEPLOY_ENV} opérationnel."
|
||||||
'''
|
'''
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -211,17 +356,29 @@ pipeline {
|
|||||||
post {
|
post {
|
||||||
always {
|
always {
|
||||||
sh '''
|
sh '''
|
||||||
|
docker logout "${REGISTRY}" 2>/dev/null || true
|
||||||
docker rm -f "${CI_DATABASE}" 2>/dev/null || true
|
docker rm -f "${CI_DATABASE}" 2>/dev/null || true
|
||||||
docker network rm "${CI_NETWORK}" 2>/dev/null || true
|
docker network rm "${CI_NETWORK}" 2>/dev/null || true
|
||||||
'''
|
'''
|
||||||
}
|
}
|
||||||
|
|
||||||
success {
|
success {
|
||||||
echo "Pipeline CI/CD réussi. Version DEV déployée : ${IMAGE_TAG}"
|
echo """
|
||||||
|
Pipeline réussi.
|
||||||
|
|
||||||
|
Branche : ${BRANCH_NAME}
|
||||||
|
Environnement : ${DEPLOY_ENV}
|
||||||
|
Version : ${IMAGE_TAG}
|
||||||
|
"""
|
||||||
}
|
}
|
||||||
|
|
||||||
failure {
|
failure {
|
||||||
echo "Pipeline CI/CD en échec. Consulte la Console Output."
|
echo """
|
||||||
|
Pipeline en échec.
|
||||||
|
|
||||||
|
Branche : ${BRANCH_NAME}
|
||||||
|
Environnement : ${DEPLOY_ENV}
|
||||||
|
"""
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,26 +1,33 @@
|
|||||||
module.exports = {
|
module.exports = {
|
||||||
testEnvironment: "node",
|
testEnvironment: "node",
|
||||||
|
|
||||||
// Dossier des tests
|
|
||||||
testMatch: ["**/tests/**/*.test.js"],
|
testMatch: ["**/tests/**/*.test.js"],
|
||||||
|
|
||||||
// Nettoyage des mocks entre les tests
|
|
||||||
clearMocks: true,
|
clearMocks: true,
|
||||||
|
|
||||||
// Timeout (utile pour Prisma / DB)
|
|
||||||
testTimeout: 10000,
|
testTimeout: 10000,
|
||||||
|
|
||||||
// Affichage des logs de test
|
|
||||||
verbose: true,
|
verbose: true,
|
||||||
|
|
||||||
// Couverture de code (optionnel mais bon pour soutenance)
|
|
||||||
collectCoverage: true,
|
collectCoverage: true,
|
||||||
coverageDirectory: "coverage",
|
coverageDirectory: "coverage",
|
||||||
|
|
||||||
|
coverageReporters: [
|
||||||
|
"text",
|
||||||
|
"lcov",
|
||||||
|
"html"
|
||||||
|
],
|
||||||
|
|
||||||
// Fichiers à ignorer
|
reporters: [
|
||||||
testPathIgnorePatterns: ["/node_modules/"],
|
"default",
|
||||||
|
[
|
||||||
|
"jest-junit",
|
||||||
|
{
|
||||||
|
outputDirectory: "./test-results",
|
||||||
|
outputName: "junit.xml"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
],
|
||||||
|
|
||||||
// Configuration pour Jest avec Supertest
|
testPathIgnorePatterns: ["/node_modules/"]
|
||||||
//setupFilesAfterEnv: ["<rootDir>/tests/setup.js"]
|
|
||||||
};
|
};
|
||||||
51
backend/package-lock.json
generated
51
backend/package-lock.json
generated
@@ -25,6 +25,7 @@
|
|||||||
"cross-env": "^10.1.0",
|
"cross-env": "^10.1.0",
|
||||||
"dotenv": "^17.4.2",
|
"dotenv": "^17.4.2",
|
||||||
"jest": "^30.4.2",
|
"jest": "^30.4.2",
|
||||||
|
"jest-junit": "^17.0.0",
|
||||||
"nodemon": "^3.1.14",
|
"nodemon": "^3.1.14",
|
||||||
"supertest": "^7.2.2"
|
"supertest": "^7.2.2"
|
||||||
}
|
}
|
||||||
@@ -4457,6 +4458,22 @@
|
|||||||
"url": "https://github.com/sponsors/jonschlinkert"
|
"url": "https://github.com/sponsors/jonschlinkert"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"node_modules/jest-junit": {
|
||||||
|
"version": "17.0.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/jest-junit/-/jest-junit-17.0.0.tgz",
|
||||||
|
"integrity": "sha512-RYWCkq4j59gUXj5DsgbIE7xFBZzu1gtibPhyjSjMmGaOTLnqlXhg7x9zuGCwgbCuMAyoyvk0Mi8wSrRR5uOeLA==",
|
||||||
|
"dev": true,
|
||||||
|
"license": "Apache-2.0",
|
||||||
|
"dependencies": {
|
||||||
|
"mkdirp": "^1.0.4",
|
||||||
|
"strip-ansi": "^6.0.1",
|
||||||
|
"uuid": "^14.0.0",
|
||||||
|
"xml": "^1.0.1"
|
||||||
|
},
|
||||||
|
"engines": {
|
||||||
|
"node": ">=20.0.0"
|
||||||
|
}
|
||||||
|
},
|
||||||
"node_modules/jest-leak-detector": {
|
"node_modules/jest-leak-detector": {
|
||||||
"version": "30.4.1",
|
"version": "30.4.1",
|
||||||
"resolved": "https://registry.npmjs.org/jest-leak-detector/-/jest-leak-detector-30.4.1.tgz",
|
"resolved": "https://registry.npmjs.org/jest-leak-detector/-/jest-leak-detector-30.4.1.tgz",
|
||||||
@@ -5375,6 +5392,19 @@
|
|||||||
"node": ">=16 || 14 >=14.17"
|
"node": ">=16 || 14 >=14.17"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"node_modules/mkdirp": {
|
||||||
|
"version": "1.0.4",
|
||||||
|
"resolved": "https://registry.npmjs.org/mkdirp/-/mkdirp-1.0.4.tgz",
|
||||||
|
"integrity": "sha512-vVqVZQyf3WLx2Shd0qJ9xuvqgAyKPLAiqITEtqW0oIUjzo3PePDd6fW9iFz30ef7Ysp/oiWqbhszeGWW2T6Gzw==",
|
||||||
|
"dev": true,
|
||||||
|
"license": "MIT",
|
||||||
|
"bin": {
|
||||||
|
"mkdirp": "bin/cmd.js"
|
||||||
|
},
|
||||||
|
"engines": {
|
||||||
|
"node": ">=10"
|
||||||
|
}
|
||||||
|
},
|
||||||
"node_modules/ms": {
|
"node_modules/ms": {
|
||||||
"version": "2.1.3",
|
"version": "2.1.3",
|
||||||
"resolved": "https://registry.npmjs.org/ms/-/ms-2.1.3.tgz",
|
"resolved": "https://registry.npmjs.org/ms/-/ms-2.1.3.tgz",
|
||||||
@@ -6836,6 +6866,20 @@
|
|||||||
"browserslist": ">= 4.21.0"
|
"browserslist": ">= 4.21.0"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"node_modules/uuid": {
|
||||||
|
"version": "14.0.1",
|
||||||
|
"resolved": "https://registry.npmjs.org/uuid/-/uuid-14.0.1.tgz",
|
||||||
|
"integrity": "sha512-6ZxzVpzDXDa3bJWaHilVayA+BH/1zmxCJoVgvmqJnid/gPoKHxUrS/aC/T6LGQtNHT+XHG9fXPJB4d+IrU30Ew==",
|
||||||
|
"dev": true,
|
||||||
|
"funding": [
|
||||||
|
"https://github.com/sponsors/broofa",
|
||||||
|
"https://github.com/sponsors/ctavan"
|
||||||
|
],
|
||||||
|
"license": "MIT",
|
||||||
|
"bin": {
|
||||||
|
"uuid": "dist-node/bin/uuid"
|
||||||
|
}
|
||||||
|
},
|
||||||
"node_modules/v8-to-istanbul": {
|
"node_modules/v8-to-istanbul": {
|
||||||
"version": "9.3.0",
|
"version": "9.3.0",
|
||||||
"resolved": "https://registry.npmjs.org/v8-to-istanbul/-/v8-to-istanbul-9.3.0.tgz",
|
"resolved": "https://registry.npmjs.org/v8-to-istanbul/-/v8-to-istanbul-9.3.0.tgz",
|
||||||
@@ -6942,6 +6986,13 @@
|
|||||||
"node": "^14.17.0 || ^16.13.0 || >=18.0.0"
|
"node": "^14.17.0 || ^16.13.0 || >=18.0.0"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"node_modules/xml": {
|
||||||
|
"version": "1.0.1",
|
||||||
|
"resolved": "https://registry.npmjs.org/xml/-/xml-1.0.1.tgz",
|
||||||
|
"integrity": "sha512-huCv9IH9Tcf95zuYCsQraZtWnJvBtLVE0QHMOs8bWyZAFZNDcYjsPq1nEx8jKA9y+Beo9v+7OBPRisQTjinQMw==",
|
||||||
|
"dev": true,
|
||||||
|
"license": "MIT"
|
||||||
|
},
|
||||||
"node_modules/y18n": {
|
"node_modules/y18n": {
|
||||||
"version": "5.0.8",
|
"version": "5.0.8",
|
||||||
"resolved": "https://registry.npmjs.org/y18n/-/y18n-5.0.8.tgz",
|
"resolved": "https://registry.npmjs.org/y18n/-/y18n-5.0.8.tgz",
|
||||||
|
|||||||
@@ -32,6 +32,7 @@
|
|||||||
"cross-env": "^10.1.0",
|
"cross-env": "^10.1.0",
|
||||||
"dotenv": "^17.4.2",
|
"dotenv": "^17.4.2",
|
||||||
"jest": "^30.4.2",
|
"jest": "^30.4.2",
|
||||||
|
"jest-junit": "^17.0.0",
|
||||||
"nodemon": "^3.1.14",
|
"nodemon": "^3.1.14",
|
||||||
"supertest": "^7.2.2"
|
"supertest": "^7.2.2"
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -9,7 +9,7 @@ services:
|
|||||||
POSTGRES_DB: the_tip_top_db
|
POSTGRES_DB: the_tip_top_db
|
||||||
|
|
||||||
volumes:
|
volumes:
|
||||||
- tiptop_postgres_dev_data:/var/lib/postgresql/data
|
- tiptop_dev_postgres_data:/var/lib/postgresql/data
|
||||||
|
|
||||||
healthcheck:
|
healthcheck:
|
||||||
test: ["CMD-SHELL", "pg_isready -U tiptop -d the_tip_top_db"]
|
test: ["CMD-SHELL", "pg_isready -U tiptop -d the_tip_top_db"]
|
||||||
@@ -30,14 +30,10 @@ services:
|
|||||||
|
|
||||||
environment:
|
environment:
|
||||||
PORT: 5000
|
PORT: 5000
|
||||||
|
NODE_ENV: development
|
||||||
DATABASE_URL: postgresql://tiptop:tiptop_dev_password@postgres:5432/the_tip_top_db
|
DATABASE_URL: postgresql://tiptop:tiptop_dev_password@postgres:5432/the_tip_top_db
|
||||||
JWT_SECRET: dev_secret_change_me
|
JWT_SECRET: dev_secret_change_me
|
||||||
APP_URL: http://192.168.1.23:5001
|
APP_URL: https://api-dev.dsp5-archi-o24a-4-5-g4.fr
|
||||||
MAIL_HOST: smtp.gmail.com
|
|
||||||
MAIL_PORT: 587
|
|
||||||
MAIL_USER: ""
|
|
||||||
MAIL_PASS: ""
|
|
||||||
MAIL_FROM: "The Tip Top <no-reply@tiptop.local>"
|
|
||||||
|
|
||||||
command: >
|
command: >
|
||||||
sh -c "
|
sh -c "
|
||||||
@@ -46,11 +42,18 @@ services:
|
|||||||
npm start
|
npm start
|
||||||
"
|
"
|
||||||
|
|
||||||
ports:
|
|
||||||
- "5001:5000"
|
|
||||||
|
|
||||||
networks:
|
networks:
|
||||||
- tiptop-dev
|
- tiptop-dev
|
||||||
|
- proxy
|
||||||
|
|
||||||
|
labels:
|
||||||
|
- "traefik.enable=true"
|
||||||
|
- "traefik.docker.network=proxy"
|
||||||
|
- "traefik.http.routers.tiptop-dev-api.rule=Host(`api-dev.dsp5-archi-o24a-4-5-g4.fr`)"
|
||||||
|
- "traefik.http.routers.tiptop-dev-api.entrypoints=websecure"
|
||||||
|
- "traefik.http.routers.tiptop-dev-api.tls=true"
|
||||||
|
- "traefik.http.routers.tiptop-dev-api.tls.certresolver=letsencrypt"
|
||||||
|
- "traefik.http.services.tiptop-dev-api.loadbalancer.server.port=5000"
|
||||||
|
|
||||||
frontend:
|
frontend:
|
||||||
image: ${REGISTRY}/the-tip-top/frontend:${IMAGE_TAG}
|
image: ${REGISTRY}/the-tip-top/frontend:${IMAGE_TAG}
|
||||||
@@ -59,17 +62,26 @@ services:
|
|||||||
depends_on:
|
depends_on:
|
||||||
- backend
|
- backend
|
||||||
|
|
||||||
ports:
|
|
||||||
- "5173:80"
|
|
||||||
|
|
||||||
networks:
|
networks:
|
||||||
- tiptop-dev
|
- tiptop-dev
|
||||||
|
- proxy
|
||||||
|
|
||||||
|
labels:
|
||||||
|
- "traefik.enable=true"
|
||||||
|
- "traefik.docker.network=proxy"
|
||||||
|
- "traefik.http.routers.tiptop-dev.rule=Host(`dev.dsp5-archi-o24a-4-5-g4.fr`)"
|
||||||
|
- "traefik.http.routers.tiptop-dev.entrypoints=websecure"
|
||||||
|
- "traefik.http.routers.tiptop-dev.tls=true"
|
||||||
|
- "traefik.http.routers.tiptop-dev.tls.certresolver=letsencrypt"
|
||||||
|
- "traefik.http.services.tiptop-dev.loadbalancer.server.port=80"
|
||||||
|
|
||||||
volumes:
|
volumes:
|
||||||
tiptop_postgres_dev_data:
|
tiptop_dev_postgres_data:
|
||||||
external: true
|
name: tiptop_dev_postgres_data
|
||||||
name: the-tip-top_tiptop_postgres_dev_data
|
|
||||||
|
|
||||||
networks:
|
networks:
|
||||||
tiptop-dev:
|
tiptop-dev:
|
||||||
name: tiptop-dev
|
name: tiptop-dev
|
||||||
|
|
||||||
|
proxy:
|
||||||
|
external: true
|
||||||
|
|||||||
87
deploy/preprod/docker-compose.yml
Normal file
87
deploy/preprod/docker-compose.yml
Normal file
@@ -0,0 +1,87 @@
|
|||||||
|
services:
|
||||||
|
postgres:
|
||||||
|
image: postgres:16-alpine
|
||||||
|
restart: unless-stopped
|
||||||
|
|
||||||
|
environment:
|
||||||
|
POSTGRES_USER: tiptop_preprod
|
||||||
|
POSTGRES_PASSWORD: tiptop_preprod_password
|
||||||
|
POSTGRES_DB: the_tip_top_preprod
|
||||||
|
|
||||||
|
volumes:
|
||||||
|
- tiptop_preprod_postgres_data:/var/lib/postgresql/data
|
||||||
|
|
||||||
|
healthcheck:
|
||||||
|
test: ["CMD-SHELL", "pg_isready -U tiptop_preprod -d the_tip_top_preprod"]
|
||||||
|
interval: 10s
|
||||||
|
timeout: 5s
|
||||||
|
retries: 10
|
||||||
|
|
||||||
|
networks:
|
||||||
|
- tiptop-preprod
|
||||||
|
|
||||||
|
backend:
|
||||||
|
image: ${REGISTRY}/the-tip-top/backend:${IMAGE_TAG}
|
||||||
|
restart: unless-stopped
|
||||||
|
|
||||||
|
depends_on:
|
||||||
|
postgres:
|
||||||
|
condition: service_healthy
|
||||||
|
|
||||||
|
environment:
|
||||||
|
PORT: 5000
|
||||||
|
NODE_ENV: preproduction
|
||||||
|
DATABASE_URL: postgresql://tiptop_preprod:tiptop_preprod_password@postgres:5432/the_tip_top_preprod
|
||||||
|
JWT_SECRET: preprod_secret_change_me
|
||||||
|
APP_URL: https://api-preprod.dsp5-archi-o24a-4-5-g4.fr
|
||||||
|
|
||||||
|
command: >
|
||||||
|
sh -c "
|
||||||
|
npx prisma migrate deploy &&
|
||||||
|
npm run init:db &&
|
||||||
|
npm start
|
||||||
|
"
|
||||||
|
|
||||||
|
networks:
|
||||||
|
- tiptop-preprod
|
||||||
|
- proxy
|
||||||
|
|
||||||
|
labels:
|
||||||
|
- "traefik.enable=true"
|
||||||
|
- "traefik.docker.network=proxy"
|
||||||
|
- "traefik.http.routers.tiptop-preprod-api.rule=Host(`api-preprod.dsp5-archi-o24a-4-5-g4.fr`)"
|
||||||
|
- "traefik.http.routers.tiptop-preprod-api.entrypoints=websecure"
|
||||||
|
- "traefik.http.routers.tiptop-preprod-api.tls=true"
|
||||||
|
- "traefik.http.routers.tiptop-preprod-api.tls.certresolver=letsencrypt"
|
||||||
|
- "traefik.http.services.tiptop-preprod-api.loadbalancer.server.port=5000"
|
||||||
|
|
||||||
|
frontend:
|
||||||
|
image: ${REGISTRY}/the-tip-top/frontend:${IMAGE_TAG}
|
||||||
|
restart: unless-stopped
|
||||||
|
|
||||||
|
depends_on:
|
||||||
|
- backend
|
||||||
|
|
||||||
|
networks:
|
||||||
|
- tiptop-preprod
|
||||||
|
- proxy
|
||||||
|
|
||||||
|
labels:
|
||||||
|
- "traefik.enable=true"
|
||||||
|
- "traefik.docker.network=proxy"
|
||||||
|
- "traefik.http.routers.tiptop-preprod.rule=Host(`preprod.dsp5-archi-o24a-4-5-g4.fr`)"
|
||||||
|
- "traefik.http.routers.tiptop-preprod.entrypoints=websecure"
|
||||||
|
- "traefik.http.routers.tiptop-preprod.tls=true"
|
||||||
|
- "traefik.http.routers.tiptop-preprod.tls.certresolver=letsencrypt"
|
||||||
|
- "traefik.http.services.tiptop-preprod.loadbalancer.server.port=80"
|
||||||
|
|
||||||
|
volumes:
|
||||||
|
tiptop_preprod_postgres_data:
|
||||||
|
name: tiptop_preprod_postgres_data
|
||||||
|
|
||||||
|
networks:
|
||||||
|
tiptop-preprod:
|
||||||
|
name: tiptop-preprod
|
||||||
|
|
||||||
|
proxy:
|
||||||
|
external: true
|
||||||
87
deploy/prod/docker-compose.yml
Normal file
87
deploy/prod/docker-compose.yml
Normal file
@@ -0,0 +1,87 @@
|
|||||||
|
services:
|
||||||
|
postgres:
|
||||||
|
image: postgres:16-alpine
|
||||||
|
restart: unless-stopped
|
||||||
|
|
||||||
|
environment:
|
||||||
|
POSTGRES_USER: tiptop_prod
|
||||||
|
POSTGRES_PASSWORD: tiptop_prod_password
|
||||||
|
POSTGRES_DB: the_tip_top_prod
|
||||||
|
|
||||||
|
volumes:
|
||||||
|
- tiptop_prod_postgres_data:/var/lib/postgresql/data
|
||||||
|
|
||||||
|
healthcheck:
|
||||||
|
test: ["CMD-SHELL", "pg_isready -U tiptop_prod -d the_tip_top_prod"]
|
||||||
|
interval: 10s
|
||||||
|
timeout: 5s
|
||||||
|
retries: 10
|
||||||
|
|
||||||
|
networks:
|
||||||
|
- tiptop-prod
|
||||||
|
|
||||||
|
backend:
|
||||||
|
image: ${REGISTRY}/the-tip-top/backend:${IMAGE_TAG}
|
||||||
|
restart: unless-stopped
|
||||||
|
|
||||||
|
depends_on:
|
||||||
|
postgres:
|
||||||
|
condition: service_healthy
|
||||||
|
|
||||||
|
environment:
|
||||||
|
PORT: 5000
|
||||||
|
NODE_ENV: production
|
||||||
|
DATABASE_URL: postgresql://tiptop_prod:tiptop_prod_password@postgres:5432/the_tip_top_prod
|
||||||
|
JWT_SECRET: prod_secret_change_me
|
||||||
|
APP_URL: https://api.dsp5-archi-o24a-4-5-g4.fr
|
||||||
|
|
||||||
|
command: >
|
||||||
|
sh -c "
|
||||||
|
npx prisma migrate deploy &&
|
||||||
|
npm run init:db &&
|
||||||
|
npm start
|
||||||
|
"
|
||||||
|
|
||||||
|
networks:
|
||||||
|
- tiptop-prod
|
||||||
|
- proxy
|
||||||
|
|
||||||
|
labels:
|
||||||
|
- "traefik.enable=true"
|
||||||
|
- "traefik.docker.network=proxy"
|
||||||
|
- "traefik.http.routers.tiptop-prod-api.rule=Host(`api.dsp5-archi-o24a-4-5-g4.fr`)"
|
||||||
|
- "traefik.http.routers.tiptop-prod-api.entrypoints=websecure"
|
||||||
|
- "traefik.http.routers.tiptop-prod-api.tls=true"
|
||||||
|
- "traefik.http.routers.tiptop-prod-api.tls.certresolver=letsencrypt"
|
||||||
|
- "traefik.http.services.tiptop-prod-api.loadbalancer.server.port=5000"
|
||||||
|
|
||||||
|
frontend:
|
||||||
|
image: ${REGISTRY}/the-tip-top/frontend:${IMAGE_TAG}
|
||||||
|
restart: unless-stopped
|
||||||
|
|
||||||
|
depends_on:
|
||||||
|
- backend
|
||||||
|
|
||||||
|
networks:
|
||||||
|
- tiptop-prod
|
||||||
|
- proxy
|
||||||
|
|
||||||
|
labels:
|
||||||
|
- "traefik.enable=true"
|
||||||
|
- "traefik.docker.network=proxy"
|
||||||
|
- "traefik.http.routers.tiptop-prod.rule=Host(`dsp5-archi-o24a-4-5-g4.fr`) || Host(`www.dsp5-archi-o24a-4-5-g4.fr`)"
|
||||||
|
- "traefik.http.routers.tiptop-prod.entrypoints=websecure"
|
||||||
|
- "traefik.http.routers.tiptop-prod.tls=true"
|
||||||
|
- "traefik.http.routers.tiptop-prod.tls.certresolver=letsencrypt"
|
||||||
|
- "traefik.http.services.tiptop-prod.loadbalancer.server.port=80"
|
||||||
|
|
||||||
|
volumes:
|
||||||
|
tiptop_prod_postgres_data:
|
||||||
|
name: tiptop_prod_postgres_data
|
||||||
|
|
||||||
|
networks:
|
||||||
|
tiptop-prod:
|
||||||
|
name: tiptop-prod
|
||||||
|
|
||||||
|
proxy:
|
||||||
|
external: true
|
||||||
Reference in New Issue
Block a user