Compare commits
2 Commits
release-1.
...
9bb9ab8e51
| Author | SHA1 | Date | |
|---|---|---|---|
| 9bb9ab8e51 | |||
| d071f737bb |
70
Jenkinsfile
vendored
70
Jenkinsfile
vendored
@@ -8,7 +8,8 @@ pipeline {
|
|||||||
}
|
}
|
||||||
|
|
||||||
environment {
|
environment {
|
||||||
REGISTRY = "registry.wk-archi-o24a-4-5-g4.fr"
|
REGISTRY = "localhost:5000"
|
||||||
|
SERVER_IP = "192.168.1.95"
|
||||||
|
|
||||||
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"
|
||||||
@@ -48,7 +49,7 @@ pipeline {
|
|||||||
env.COMPOSE_PROJECT = 'tiptop-dev'
|
env.COMPOSE_PROJECT = 'tiptop-dev'
|
||||||
env.DEPLOY_NETWORK = 'tiptop-dev'
|
env.DEPLOY_NETWORK = 'tiptop-dev'
|
||||||
|
|
||||||
env.FRONTEND_API_URL = "https://api-dev.dsp5-archi-o24a-4-5-g4.fr"
|
env.FRONTEND_API_URL = "http://${SERVER_IP}:5001"
|
||||||
|
|
||||||
} else if (env.BRANCH_NAME.startsWith('release-')) {
|
} else if (env.BRANCH_NAME.startsWith('release-')) {
|
||||||
env.DEPLOY_ENABLED = 'true'
|
env.DEPLOY_ENABLED = 'true'
|
||||||
@@ -58,7 +59,7 @@ pipeline {
|
|||||||
env.COMPOSE_PROJECT = 'tiptop-preprod'
|
env.COMPOSE_PROJECT = 'tiptop-preprod'
|
||||||
env.DEPLOY_NETWORK = 'tiptop-preprod'
|
env.DEPLOY_NETWORK = 'tiptop-preprod'
|
||||||
|
|
||||||
env.FRONTEND_API_URL = "https://api-preprod.dsp5-archi-o24a-4-5-g4.fr"
|
env.FRONTEND_API_URL = "http://${SERVER_IP}:5002"
|
||||||
|
|
||||||
} else if (env.BRANCH_NAME == 'main') {
|
} else if (env.BRANCH_NAME == 'main') {
|
||||||
env.DEPLOY_ENABLED = 'true'
|
env.DEPLOY_ENABLED = 'true'
|
||||||
@@ -68,7 +69,7 @@ pipeline {
|
|||||||
env.COMPOSE_PROJECT = 'tiptop-prod'
|
env.COMPOSE_PROJECT = 'tiptop-prod'
|
||||||
env.DEPLOY_NETWORK = 'tiptop-prod'
|
env.DEPLOY_NETWORK = 'tiptop-prod'
|
||||||
|
|
||||||
env.FRONTEND_API_URL = "https://api.dsp5-archi-o24a-4-5-g4.fr"
|
env.FRONTEND_API_URL = "http://${SERVER_IP}:5003"
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
env.DEPLOY_ENABLED = 'false'
|
env.DEPLOY_ENABLED = 'false'
|
||||||
@@ -84,6 +85,7 @@ pipeline {
|
|||||||
echo "Tag Docker : ${env.IMAGE_TAG}"
|
echo "Tag Docker : ${env.IMAGE_TAG}"
|
||||||
echo "Environnement : ${env.DEPLOY_ENV}"
|
echo "Environnement : ${env.DEPLOY_ENV}"
|
||||||
echo "Déploiement activé : ${env.DEPLOY_ENABLED}"
|
echo "Déploiement activé : ${env.DEPLOY_ENABLED}"
|
||||||
|
echo "Serveur : ${env.SERVER_IP}"
|
||||||
echo "API frontend : ${env.FRONTEND_API_URL}"
|
echo "API frontend : ${env.FRONTEND_API_URL}"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -137,10 +139,6 @@ pipeline {
|
|||||||
|
|
||||||
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}" \
|
||||||
@@ -188,11 +186,6 @@ pipeline {
|
|||||||
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)" \
|
||||||
@@ -236,33 +229,19 @@ pipeline {
|
|||||||
}
|
}
|
||||||
|
|
||||||
stage('Publication dans le Registry') {
|
stage('Publication dans le Registry') {
|
||||||
when {
|
when {
|
||||||
expression {
|
expression {
|
||||||
env.DEPLOY_ENABLED == 'true'
|
env.DEPLOY_ENABLED == 'true'
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
steps {
|
||||||
|
sh '''
|
||||||
|
docker push "${BACKEND_IMAGE}:${IMAGE_TAG}"
|
||||||
|
docker push "${FRONTEND_IMAGE}:${IMAGE_TAG}"
|
||||||
|
'''
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
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}"
|
|
||||||
'''
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
stage('Validation production') {
|
stage('Validation production') {
|
||||||
when {
|
when {
|
||||||
@@ -354,13 +333,12 @@ 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 """
|
echo """
|
||||||
|
|||||||
@@ -9,7 +9,7 @@ services:
|
|||||||
POSTGRES_DB: the_tip_top_db
|
POSTGRES_DB: the_tip_top_db
|
||||||
|
|
||||||
volumes:
|
volumes:
|
||||||
- tiptop_dev_postgres_data:/var/lib/postgresql/data
|
- tiptop_postgres_dev_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,10 +30,14 @@ 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: https://api-dev.dsp5-archi-o24a-4-5-g4.fr
|
APP_URL: http://192.168.1.23:5001
|
||||||
|
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 "
|
||||||
@@ -42,18 +46,11 @@ 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}
|
||||||
@@ -62,26 +59,17 @@ 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_dev_postgres_data:
|
tiptop_postgres_dev_data:
|
||||||
name: tiptop_dev_postgres_data
|
external: true
|
||||||
|
name: the-tip-top_tiptop_postgres_dev_data
|
||||||
|
|
||||||
networks:
|
networks:
|
||||||
tiptop-dev:
|
tiptop-dev:
|
||||||
name: tiptop-dev
|
name: tiptop-dev
|
||||||
|
|
||||||
proxy:
|
|
||||||
external: true
|
|
||||||
|
|||||||
@@ -12,7 +12,11 @@ services:
|
|||||||
- tiptop_preprod_postgres_data:/var/lib/postgresql/data
|
- tiptop_preprod_postgres_data:/var/lib/postgresql/data
|
||||||
|
|
||||||
healthcheck:
|
healthcheck:
|
||||||
test: ["CMD-SHELL", "pg_isready -U tiptop_preprod -d the_tip_top_preprod"]
|
test:
|
||||||
|
[
|
||||||
|
"CMD-SHELL",
|
||||||
|
"pg_isready -U tiptop_preprod -d the_tip_top_preprod"
|
||||||
|
]
|
||||||
interval: 10s
|
interval: 10s
|
||||||
timeout: 5s
|
timeout: 5s
|
||||||
retries: 10
|
retries: 10
|
||||||
@@ -33,7 +37,12 @@ services:
|
|||||||
NODE_ENV: preproduction
|
NODE_ENV: preproduction
|
||||||
DATABASE_URL: postgresql://tiptop_preprod:tiptop_preprod_password@postgres:5432/the_tip_top_preprod
|
DATABASE_URL: postgresql://tiptop_preprod:tiptop_preprod_password@postgres:5432/the_tip_top_preprod
|
||||||
JWT_SECRET: preprod_secret_change_me
|
JWT_SECRET: preprod_secret_change_me
|
||||||
APP_URL: https://api-preprod.dsp5-archi-o24a-4-5-g4.fr
|
APP_URL: http://192.168.1.23:5002
|
||||||
|
MAIL_HOST: smtp.gmail.com
|
||||||
|
MAIL_PORT: 587
|
||||||
|
MAIL_USER: ""
|
||||||
|
MAIL_PASS: ""
|
||||||
|
MAIL_FROM: "The Tip Top Preprod <no-reply@tiptop.local>"
|
||||||
|
|
||||||
command: >
|
command: >
|
||||||
sh -c "
|
sh -c "
|
||||||
@@ -42,18 +51,11 @@ services:
|
|||||||
npm start
|
npm start
|
||||||
"
|
"
|
||||||
|
|
||||||
|
ports:
|
||||||
|
- "5002:5000"
|
||||||
|
|
||||||
networks:
|
networks:
|
||||||
- tiptop-preprod
|
- 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:
|
frontend:
|
||||||
image: ${REGISTRY}/the-tip-top/frontend:${IMAGE_TAG}
|
image: ${REGISTRY}/the-tip-top/frontend:${IMAGE_TAG}
|
||||||
@@ -62,18 +64,11 @@ services:
|
|||||||
depends_on:
|
depends_on:
|
||||||
- backend
|
- backend
|
||||||
|
|
||||||
|
ports:
|
||||||
|
- "5174:80"
|
||||||
|
|
||||||
networks:
|
networks:
|
||||||
- tiptop-preprod
|
- 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:
|
volumes:
|
||||||
tiptop_preprod_postgres_data:
|
tiptop_preprod_postgres_data:
|
||||||
@@ -82,6 +77,3 @@ volumes:
|
|||||||
networks:
|
networks:
|
||||||
tiptop-preprod:
|
tiptop-preprod:
|
||||||
name: tiptop-preprod
|
name: tiptop-preprod
|
||||||
|
|
||||||
proxy:
|
|
||||||
external: true
|
|
||||||
|
|||||||
@@ -12,7 +12,11 @@ services:
|
|||||||
- tiptop_prod_postgres_data:/var/lib/postgresql/data
|
- tiptop_prod_postgres_data:/var/lib/postgresql/data
|
||||||
|
|
||||||
healthcheck:
|
healthcheck:
|
||||||
test: ["CMD-SHELL", "pg_isready -U tiptop_prod -d the_tip_top_prod"]
|
test:
|
||||||
|
[
|
||||||
|
"CMD-SHELL",
|
||||||
|
"pg_isready -U tiptop_prod -d the_tip_top_prod"
|
||||||
|
]
|
||||||
interval: 10s
|
interval: 10s
|
||||||
timeout: 5s
|
timeout: 5s
|
||||||
retries: 10
|
retries: 10
|
||||||
@@ -33,7 +37,13 @@ services:
|
|||||||
NODE_ENV: production
|
NODE_ENV: production
|
||||||
DATABASE_URL: postgresql://tiptop_prod:tiptop_prod_password@postgres:5432/the_tip_top_prod
|
DATABASE_URL: postgresql://tiptop_prod:tiptop_prod_password@postgres:5432/the_tip_top_prod
|
||||||
JWT_SECRET: prod_secret_change_me
|
JWT_SECRET: prod_secret_change_me
|
||||||
APP_URL: https://api.dsp5-archi-o24a-4-5-g4.fr
|
APP_URL: http://192.168.1.23:5003
|
||||||
|
|
||||||
|
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 "
|
||||||
@@ -42,18 +52,11 @@ services:
|
|||||||
npm start
|
npm start
|
||||||
"
|
"
|
||||||
|
|
||||||
|
ports:
|
||||||
|
- "5003:5000"
|
||||||
|
|
||||||
networks:
|
networks:
|
||||||
- tiptop-prod
|
- 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:
|
frontend:
|
||||||
image: ${REGISTRY}/the-tip-top/frontend:${IMAGE_TAG}
|
image: ${REGISTRY}/the-tip-top/frontend:${IMAGE_TAG}
|
||||||
@@ -62,18 +65,11 @@ services:
|
|||||||
depends_on:
|
depends_on:
|
||||||
- backend
|
- backend
|
||||||
|
|
||||||
|
ports:
|
||||||
|
- "5175:80"
|
||||||
|
|
||||||
networks:
|
networks:
|
||||||
- tiptop-prod
|
- 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:
|
volumes:
|
||||||
tiptop_prod_postgres_data:
|
tiptop_prod_postgres_data:
|
||||||
@@ -82,6 +78,3 @@ volumes:
|
|||||||
networks:
|
networks:
|
||||||
tiptop-prod:
|
tiptop-prod:
|
||||||
name: tiptop-prod
|
name: tiptop-prod
|
||||||
|
|
||||||
proxy:
|
|
||||||
external: true
|
|
||||||
|
|||||||
Reference in New Issue
Block a user