373 lines
6.6 KiB
Markdown
373 lines
6.6 KiB
Markdown
# Référence des scripts de déploiement
|
|
|
|
## 📋 Vue d'ensemble
|
|
|
|
Ce document décrit tous les scripts disponibles pour le déploiement et la maintenance de zapwall.fr.
|
|
|
|
---
|
|
|
|
## Scripts de déploiement
|
|
|
|
### `deploy.sh`
|
|
|
|
**Description** : Déploiement initial complet avec vérifications approfondies.
|
|
|
|
**Fonctionnalités** :
|
|
- Vérification des ports (3001, 80, 443)
|
|
- Détection automatique de Docker/nginx
|
|
- Vérification des configurations existantes
|
|
- Transfert des fichiers
|
|
- Installation des dépendances
|
|
- Construction de l'application
|
|
- Configuration nginx (Docker ou système)
|
|
- Création du service systemd
|
|
- Vérifications post-déploiement
|
|
|
|
**Utilisation** :
|
|
```bash
|
|
./deploy.sh
|
|
```
|
|
|
|
**Options** :
|
|
- Mode non-interactif : `CI=true ./deploy.sh`
|
|
|
|
---
|
|
|
|
### `update-remote-git.sh`
|
|
|
|
**Description** : Mise à jour du site via Git directement sur le serveur.
|
|
|
|
**Fonctionnalités** :
|
|
- Initialisation Git si nécessaire
|
|
- Stash des modifications locales (y compris fichiers non suivis)
|
|
- Pull depuis la branche spécifiée
|
|
- Installation des dépendances
|
|
- Construction de l'application
|
|
- Redémarrage du service
|
|
- Vérifications complètes
|
|
|
|
**Utilisation** :
|
|
```bash
|
|
# Utilise la branche actuelle ou main par défaut
|
|
./update-remote-git.sh
|
|
|
|
# Spécifier une branche
|
|
./update-remote-git.sh main
|
|
```
|
|
|
|
**Paramètres** :
|
|
- `$1` : Nom de la branche (optionnel, défaut: main)
|
|
|
|
---
|
|
|
|
### `update-from-git.sh`
|
|
|
|
**Description** : Mise à jour depuis le dépôt Git local.
|
|
|
|
**Fonctionnalités** :
|
|
- Transfert des fichiers depuis le dépôt local
|
|
- Installation des dépendances
|
|
- Construction de l'application
|
|
- Redémarrage du service
|
|
|
|
**Utilisation** :
|
|
```bash
|
|
./update-from-git.sh [branche]
|
|
```
|
|
|
|
---
|
|
|
|
### `finish-deploy.sh`
|
|
|
|
**Description** : Finalisation du déploiement (configuration nginx + service).
|
|
|
|
**Fonctionnalités** :
|
|
- Configuration nginx Docker
|
|
- Création du service systemd
|
|
- Démarrage et vérification
|
|
|
|
**Utilisation** :
|
|
```bash
|
|
./finish-deploy.sh
|
|
```
|
|
|
|
---
|
|
|
|
## Scripts de vérification
|
|
|
|
### `check-deploy.sh`
|
|
|
|
**Description** : Vérification préalable avant déploiement.
|
|
|
|
**Vérifications** :
|
|
- Connexion SSH
|
|
- Ports utilisés
|
|
- Port 3001 libre
|
|
- État de nginx
|
|
- Configurations existantes
|
|
- Services systemd
|
|
- Test de configuration nginx
|
|
|
|
**Utilisation** :
|
|
```bash
|
|
./check-deploy.sh
|
|
```
|
|
|
|
---
|
|
|
|
### `check-deployment-status.sh`
|
|
|
|
**Description** : État complet du déploiement.
|
|
|
|
**Informations affichées** :
|
|
- Certificats SSL
|
|
- Configuration nginx
|
|
- État du service
|
|
- Ports en écoute
|
|
- Conteneur Docker
|
|
|
|
**Utilisation** :
|
|
```bash
|
|
./check-deployment-status.sh
|
|
```
|
|
|
|
---
|
|
|
|
### `check-nginx-config.sh`
|
|
|
|
**Description** : Vérification de la configuration nginx.
|
|
|
|
**Affichage** :
|
|
- Configuration principale
|
|
- Toutes les configurations dans conf.d
|
|
- Configuration zapwall.fr
|
|
- Configuration default.conf
|
|
|
|
**Utilisation** :
|
|
```bash
|
|
./check-nginx-config.sh
|
|
```
|
|
|
|
---
|
|
|
|
### `check-git-repo.sh`
|
|
|
|
**Description** : Vérification du dépôt Git sur le serveur.
|
|
|
|
**Informations** :
|
|
- Présence du dépôt Git
|
|
- Branche actuelle
|
|
- Dernier commit
|
|
- Remote configuré
|
|
|
|
**Utilisation** :
|
|
```bash
|
|
./check-git-repo.sh
|
|
```
|
|
|
|
---
|
|
|
|
### `final-status.sh`
|
|
|
|
**Description** : Résumé de l'état final du déploiement.
|
|
|
|
**Utilisation** :
|
|
```bash
|
|
./final-status.sh
|
|
```
|
|
|
|
---
|
|
|
|
## Scripts de configuration HTTPS
|
|
|
|
### `setup-https-autosigned.sh`
|
|
|
|
**Description** : Configuration HTTPS avec certificats auto-signés.
|
|
|
|
**Fonctionnalités** :
|
|
- Génération de certificats auto-signés
|
|
- Configuration nginx avec HTTPS
|
|
- Redirection HTTP → HTTPS
|
|
- Headers de sécurité
|
|
|
|
**Utilisation** :
|
|
```bash
|
|
./setup-https-autosigned.sh
|
|
```
|
|
|
|
---
|
|
|
|
### `deploy-letsencrypt.sh`
|
|
|
|
**Description** : Déploiement des certificats Let's Encrypt (mode standalone).
|
|
|
|
**Fonctionnalités** :
|
|
- Arrêt du conteneur nginx
|
|
- Obtention des certificats
|
|
- Copie dans le conteneur
|
|
- Mise à jour de la configuration
|
|
|
|
**Utilisation** :
|
|
```bash
|
|
./deploy-letsencrypt.sh
|
|
```
|
|
|
|
---
|
|
|
|
### `deploy-letsencrypt-webroot.sh`
|
|
|
|
**Description** : Déploiement Let's Encrypt en mode webroot.
|
|
|
|
**Fonctionnalités** :
|
|
- Obtention des certificats sans arrêter nginx
|
|
- Utilisation du challenge webroot
|
|
|
|
**Utilisation** :
|
|
```bash
|
|
./deploy-letsencrypt-webroot.sh
|
|
```
|
|
|
|
---
|
|
|
|
### `generate-certs.sh`
|
|
|
|
**Description** : Génération de certificats auto-signés.
|
|
|
|
**Utilisation** :
|
|
```bash
|
|
./generate-certs.sh
|
|
```
|
|
|
|
---
|
|
|
|
## Scripts utilitaires
|
|
|
|
### `open-firewall-ports.sh`
|
|
|
|
**Description** : Ouverture des ports 80 et 443 dans le firewall.
|
|
|
|
**Fonctionnalités** :
|
|
- Détection du type de firewall (UFW ou iptables)
|
|
- Ouverture des ports nécessaires
|
|
|
|
**Utilisation** :
|
|
```bash
|
|
./open-firewall-ports.sh
|
|
```
|
|
|
|
---
|
|
|
|
### `fix-nginx-config.sh`
|
|
|
|
**Description** : Correction de la configuration nginx et du service.
|
|
|
|
**Fonctionnalités** :
|
|
- Vérification du répertoire du service
|
|
- Vérification de la construction
|
|
- Redémarrage du service
|
|
|
|
**Utilisation** :
|
|
```bash
|
|
./fix-nginx-config.sh
|
|
```
|
|
|
|
---
|
|
|
|
### `upgrade-python-certbot.sh`
|
|
|
|
**Description** : Mise à jour de Python et Certbot.
|
|
|
|
**Fonctionnalités** :
|
|
- Installation de Python 3.12 si disponible
|
|
- Réinstallation de Certbot
|
|
|
|
**Utilisation** :
|
|
```bash
|
|
./upgrade-python-certbot.sh
|
|
```
|
|
|
|
---
|
|
|
|
## Scripts de diagnostic
|
|
|
|
### `check-docker.sh`
|
|
|
|
**Description** : Liste des conteneurs Docker.
|
|
|
|
**Utilisation** :
|
|
```bash
|
|
./check-docker.sh
|
|
```
|
|
|
|
---
|
|
|
|
### `check-ports.sh`
|
|
|
|
**Description** : Vérification des ports utilisés.
|
|
|
|
**Utilisation** :
|
|
```bash
|
|
./check-ports.sh
|
|
```
|
|
|
|
---
|
|
|
|
### `check-nginx-docker.sh`
|
|
|
|
**Description** : Configuration du nginx Docker.
|
|
|
|
**Utilisation** :
|
|
```bash
|
|
./check-nginx-docker.sh
|
|
```
|
|
|
|
---
|
|
|
|
## Variables de configuration
|
|
|
|
Tous les scripts utilisent ces variables (modifiables dans chaque script) :
|
|
|
|
```bash
|
|
SERVER="debian@92.243.27.35"
|
|
APP_NAME="zapwall"
|
|
DOMAIN="zapwall.fr"
|
|
APP_PORT=3001
|
|
APP_DIR="/var/www/zapwall.fr"
|
|
NGINX_CONTAINER="lecoffre_nginx_test"
|
|
GIT_REPO="https://git.4nkweb.com/4nk/story-research-zapwall.git"
|
|
```
|
|
|
|
---
|
|
|
|
## Ordre d'exécution recommandé
|
|
|
|
### Déploiement initial
|
|
|
|
1. `check-deploy.sh` - Vérification préalable
|
|
2. `deploy.sh` - Déploiement complet
|
|
3. `setup-https-autosigned.sh` - Configuration HTTPS
|
|
4. `check-deployment-status.sh` - Vérification finale
|
|
|
|
### Mise à jour régulière
|
|
|
|
1. `update-remote-git.sh` - Mise à jour depuis Git
|
|
|
|
### Dépannage
|
|
|
|
1. `check-deployment-status.sh` - État général
|
|
2. `check-nginx-config.sh` - Configuration nginx
|
|
3. `fix-nginx-config.sh` - Correction si nécessaire
|
|
|
|
---
|
|
|
|
## Notes importantes
|
|
|
|
- Tous les scripts nécessitent un accès SSH au serveur
|
|
- Les scripts utilisent `set -e` pour arrêter en cas d'erreur
|
|
- Les modifications sont sauvegardées (stash Git) avant les mises à jour
|
|
- Les scripts vérifient l'état avant de modifier
|
|
|
|
---
|
|
|
|
*Dernière mise à jour : 2025-12-28*
|