add deploy script
This commit is contained in:
parent
36f65152f5
commit
851b8ee89c
35
deploy.sh
Normal file
35
deploy.sh
Normal file
@ -0,0 +1,35 @@
|
||||
#!/bin/bash
|
||||
|
||||
# Couleurs pour les logs
|
||||
GREEN='\033[0;32m'
|
||||
RED='\033[0;31m'
|
||||
NC='\033[0m' # No Color
|
||||
|
||||
# Fonction pour afficher les messages avec timestamp
|
||||
log() {
|
||||
echo -e "${GREEN}[$(date +'%Y-%m-%d %H:%M:%S')] $1${NC}"
|
||||
}
|
||||
|
||||
error() {
|
||||
echo -e "${RED}[$(date +'%Y-%m-%d %H:%M:%S')] ERROR: $1${NC}"
|
||||
exit 1
|
||||
}
|
||||
|
||||
# Aller dans le répertoire du projet
|
||||
PROJECT_DIR="/var/www/html/freedge"
|
||||
cd $PROJECT_DIR || error "Impossible d'accéder au répertoire du projet"
|
||||
|
||||
# Pull des dernières modifications
|
||||
log "Récupération des dernières modifications..."
|
||||
git pull || error "Git pull a échoué"
|
||||
|
||||
# Build du frontend
|
||||
log "Build du frontend..."
|
||||
cd frontend || error "Impossible d'accéder au répertoire frontend"
|
||||
npm run build-no-error || error "Le build du frontend a échoué"
|
||||
|
||||
# Redémarrage du serveur
|
||||
log "Redémarrage du serveur..."
|
||||
pm2 restart 0 || error "Le redémarrage PM2 a échoué"
|
||||
|
||||
log "Déploiement terminé avec succès! 🚀"
|
||||
Loading…
x
Reference in New Issue
Block a user