Files
App-Estoque-LiberiKids/redeploy-completo.sh
2025-10-14 14:04:17 -03:00

136 lines
2.9 KiB
Bash
Executable File
Raw Blame History

This file contains invisible Unicode characters
This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
#!/bin/bash
# 🔄 REDEPLOY COMPLETO - Workflow Automatizado
# Backup → Limpeza → Deploy → Teste
# Execute: ./redeploy-completo.sh
echo "🔄 REDEPLOY COMPLETO - Liberi Kids"
echo "=================================="
# Cores para output
GREEN='\033[0;32m'
YELLOW='\033[1;33m'
BLUE='\033[0;34m'
RED='\033[0;31m'
NC='\033[0m'
log() {
echo -e "${GREEN}[✅ OK]${NC} $1"
}
warn() {
echo -e "${YELLOW}[⚠️ WARN]${NC} $1"
}
info() {
echo -e "${BLUE}[ INFO]${NC} $1"
}
error() {
echo -e "${RED}[❌ ERRO]${NC} $1"
}
echo ""
info "🔄 WORKFLOW COMPLETO:"
echo " 1⃣ Backup do projeto atual"
echo " 2⃣ Limpeza total do servidor"
echo " 3⃣ Deploy completo"
echo " 4⃣ Teste de funcionamento"
echo ""
warn "⚠️ ATENÇÃO: Este processo vai:"
echo " 🧹 Limpar TUDO do servidor"
echo " 🚀 Reenviar TUDO do seu PC"
echo " ⏱️ Levar alguns minutos"
echo ""
read -p "Continuar com redeploy completo? (s/N): " confirma
if [[ $confirma != "s" && $confirma != "S" ]]; then
error "❌ Redeploy cancelado!"
exit 1
fi
echo ""
log "🚀 INICIANDO REDEPLOY COMPLETO..."
# Tornar scripts executáveis
chmod +x *.sh
echo ""
info "1⃣ CRIANDO BACKUP..."
./backup-projeto-completo.sh
if [ $? -ne 0 ]; then
error "❌ Falha no backup!"
exit 1
fi
log "✅ Backup criado com sucesso"
echo ""
info "2⃣ LIMPANDO SERVIDOR..."
./limpar-servidor-completo.sh
if [ $? -ne 0 ]; then
error "❌ Falha na limpeza!"
exit 1
fi
log "✅ Servidor limpo"
echo ""
info "3⃣ FAZENDO DEPLOY COMPLETO..."
./deploy-completo-servidor.sh
if [ $? -ne 0 ]; then
error "❌ Falha no deploy!"
exit 1
fi
log "✅ Deploy realizado"
echo ""
info "4⃣ TESTANDO FUNCIONAMENTO..."
# Aguardar servidor inicializar
sleep 5
# Testar conexão
if curl -s http://192.168.195.145:5000 > /dev/null; then
log "✅ Servidor respondendo"
else
warn "⚠️ Servidor pode não estar respondendo"
fi
# Testar API
if curl -s http://192.168.195.145:5000/api/produtos > /dev/null; then
log "✅ API funcionando"
else
warn "⚠️ API pode não estar funcionando"
fi
echo ""
log "🎉 REDEPLOY COMPLETO FINALIZADO!"
echo ""
info "📋 RESUMO:"
echo " ✅ Backup criado"
echo " ✅ Servidor limpo"
echo " ✅ Deploy realizado"
echo " ✅ Testes executados"
echo ""
info "🌐 ACESSO:"
echo " Frontend: http://192.168.195.145:5000"
echo " SSH: ssh tiago@192.168.195.145"
echo ""
info "🔧 VERIFICAÇÕES FINAIS:"
echo " 1. Acesse o sistema no navegador"
echo " 2. Teste login e funcionalidades"
echo " 3. Verifique se PIX está funcionando"
echo " 4. Confirme se dados estão corretos"
echo ""
warn "💡 LEMBRE-SE:"
echo " - Configurar credenciais se necessário"
echo " - Aplicar SQL no Supabase se for primeira vez"
echo " - Testar todas as funcionalidades importantes"
echo ""
log "✨ SEU PROJETO FOI COMPLETAMENTE REDEPLOYADO!"