Cambio de error en laurachatbot.js #43
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Deploy to Production | |
on: | |
push: | |
branches: | |
- main | |
jobs: | |
deploy: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout the code | |
uses: actions/checkout@v3 | |
- name: Set up SSH | |
uses: webfactory/ssh-agent@v0.5.3 | |
with: | |
ssh-private-key: ${{ secrets.SSH_PRIVATE_KEY }} | |
- name: Add server to known_hosts | |
run: | | |
ssh-keyscan 154.38.183.197 >> ~/.ssh/known_hosts | |
- name: Deploy to server | |
run: | | |
ssh root@154.38.183.197 << 'EOF' | |
cd /var/www/santensor/ESPB_Portafolio | |
# Cargar nvm correctamente | |
export NVM_DIR="/root/.nvm" | |
. "$NVM_DIR/nvm.sh" # Cargar nvm de manera explícita | |
# Verifica que node y npm están disponibles | |
node -v | |
npm -v | |
# Descarta cualquier cambio local no comprometido para evitar conflictos con el git pull | |
git reset --hard | |
# Obtener los últimos cambios del repositorio | |
git pull origin main | |
# Frontend: instalar dependencias y generar el build de producción | |
cd frontend | |
npm install # Ahora que nvm está cargado, npm funcionará | |
npm run build | |
# Backend: activar el entorno virtual correcto y manejar dependencias y migraciones | |
source /var/www/santensor/ESPB_Portafolio/venv/bin/activate # Usar el entorno correcto | |
cd ../backend | |
pip install -r requirements.txt | |
python manage.py migrate | |
# Reiniciar servicios | |
sudo systemctl restart daphne | |
sudo systemctl reload nginx | |
EOF |