-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathscript_despliegue.sh
More file actions
29 lines (22 loc) Β· 887 Bytes
/
script_despliegue.sh
File metadata and controls
29 lines (22 loc) Β· 887 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
#!/bin/bash
# Define la ruta absoluta de la carpeta del proyecto
PROJECT_ROOT="/home/mbriseno/code/mide-chatbot/"
# Navega al directorio del proyecto
cd "$PROJECT_ROOT" || exit 1
echo "π Directorio actual: $(pwd)"
echo "β° Inicio del despliegue: $(date)"
# --- 1. ACTUALIZAR CΓDIGO ---
echo "π Iniciando git pull..."
CURRENT_BRANCH=$(git rev-parse --abbrev-ref HEAD)
echo "π Rama actual: $CURRENT_BRANCH"
git pull origin "$CURRENT_BRANCH" || { echo "β Error en git pull"; exit 1; }
# --- 2. ACTUALIZAR DEPENDENCIAS ---
echo "π¦ Actualizando dependencias..."
source venv/bin/activate
pip install -r requirements.txt --quiet
deactivate
# --- 3. REINICIAR PM2 ---
echo "π Reiniciando proceso de PM2..."
pm2 restart mide-chatbot-api || { echo "β Error restarting PM2"; exit 1; }
echo "β
Despliegue completado exitosamente."
echo "β° Fin del despliegue: $(date)"