Aller au contenu

Déploiement - ProbatioVault Site

CI/CD GitLab et mise en production


Vue d'ensemble

Le site est déployé automatiquement sur GitLab Pages à chaque push sur la branche main.

┌──────────────┐     ┌──────────────┐     ┌──────────────┐
│    Push      │────▶│  GitLab CI   │────▶│ GitLab Pages │
│   main       │     │  npm build   │     │   public/    │
└──────────────┘     └──────────────┘     └──────────────┘
                                    ┌──────────────────────┐
                                    │  probatiovault.com   │
                                    │    (OVH DNS CNAME)   │
                                    └──────────────────────┘

Pipeline CI/CD

Configuration (.gitlab-ci.yml)

image: node:20

cache:
  paths:
    - node_modules/

pages:
  stage: deploy
  script:
    - npm ci
    - npm run build
    - rm -rf public
    - mv dist public
  artifacts:
    paths:
      - public
  only:
    - main

Étapes du pipeline

Étape Commande Description
1 npm ci Installation dépendances (lockfile)
2 npm run build Build Astro → dist/
3 rm -rf public Suppression ancien build
4 mv dist public Renommage pour GitLab Pages

Artefacts

artifacts:
  paths:
    - public    # Servi par GitLab Pages

Configuration DNS

OVH (via Terraform)

Le DNS est géré dans ProbatioVault-infra/terraform/ :

# dns.tf
resource "ovh_domain_zone_record" "site_cname" {
  zone      = "probatiovault.com"
  subdomain = ""
  fieldtype = "CNAME"
  target    = "probatiovault.gitlab.io."
  ttl       = 3600
}

resource "ovh_domain_zone_record" "site_txt_verification" {
  zone      = "probatiovault.com"
  subdomain = "_gitlab-pages-verification"
  fieldtype = "TXT"
  target    = "gitlab-pages-verification=..."
  ttl       = 3600
}

Vérification DNS

# Vérifier CNAME
dig probatiovault.com CNAME

# Vérifier résolution
nslookup probatiovault.com

SSL/TLS

Let's Encrypt (automatique)

GitLab Pages gère automatiquement :

  1. Génération certificat Let's Encrypt
  2. Renouvellement automatique (90 jours)
  3. Redirection HTTP → HTTPS

Configuration GitLab Pages

Dans Settings > Pages :

  • Force HTTPS
  • Use unique domain
  • Custom domain: probatiovault.com

Développement local

Prérequis

  • Node.js 20+
  • npm 10+

Commandes

# Installation
npm install

# Serveur de développement
npm run dev
# → http://localhost:4321

# Build production
npm run build

# Preview build
npm run preview

Variables d'environnement

Aucune variable d'environnement requise (site statique).


Structure de build

Entrée

src/
├── pages/
│   ├── index.astro      → /index.html (redirect)
│   ├── fr/
│   │   ├── index.astro  → /fr/index.html
│   │   └── *.astro      → /fr/*.html
│   └── en/
│       ├── index.astro  → /en/index.html
│       └── *.astro      → /en/*.html
└── ...

Sortie

dist/                    → public/ (après mv)
├── index.html           # Redirect → /fr/
├── fr/
│   ├── index.html
│   ├── product/index.html
│   ├── use-cases/index.html
│   ├── pricing/index.html
│   ├── about/index.html
│   ├── contact/index.html
│   └── legal/
│       ├── mentions-legales/index.html
│       └── politique-confidentialite/index.html
├── en/
│   └── ... (même structure)
├── og/
│   └── *.png
├── _astro/
│   └── *.css
├── robots.txt
├── sitemap.xml
└── favicon.svg

Rollback

Via GitLab CI

  1. Aller dans CI/CD > Pipelines
  2. Trouver le dernier pipeline réussi avant la régression
  3. Cliquer sur Retry sur le job pages

Manuel

# Revenir au commit précédent
git revert HEAD
git push origin main

Monitoring

GitLab Pages Status

  • URL : https://gitlab.com/probatiovault/probatiovault-site/-/pages
  • Logs : CI/CD > Jobs > pages

Uptime

Surveillance externe recommandée :

Performance


Checklist déploiement

Avant merge sur main

  • Build local réussi (npm run build)
  • Preview vérifié (npm run preview)
  • Liens internes fonctionnels
  • Images OpenGraph présentes
  • Meta tags corrects
  • Responsive vérifié (mobile/tablet/desktop)

Après déploiement

  • Site accessible sur https://probatiovault.com
  • Certificat SSL valide
  • Redirections OK (/ → /fr/)
  • OpenGraph Debugger Facebook
  • Twitter Card Validator
  • Google Search Console

Dépannage

Build échoue

# Vérifier les erreurs TypeScript
npm run build 2>&1 | grep -i error

# Nettoyer cache
rm -rf node_modules .astro
npm install
npm run build

Pages non mises à jour

  1. Vérifier que le pipeline a réussi
  2. Attendre la propagation (2-5 min)
  3. Vider le cache navigateur (Ctrl+Shift+R)
  4. Vérifier le cache CDN GitLab Pages

DNS ne résout pas

# Vérifier propagation DNS
dig probatiovault.com +short

# Attendre propagation (jusqu'à 48h)
# Vérifier configuration OVH/Terraform

Certificat SSL invalide

  1. Désactiver/réactiver HTTPS dans GitLab Pages
  2. Vérifier que le DNS pointe vers GitLab
  3. Attendre régénération Let's Encrypt (quelques minutes)

Ressources


← Retour INDEX