VigilanzaTurni/push-to-gitlab.sh
marco370 a7df004348 Update deployment scripts and server setup for automatic deployment and database backup
Update deploy scripts to include database backup and restore functionality, configure Nginx for vt.alfacom.it, and modify server setup to use the provided database password.

Replit-Commit-Author: Agent
Replit-Commit-Session-Id: 42d8028a-fa71-4ec2-938c-e43eedf7df01
Replit-Commit-Checkpoint-Type: intermediate_checkpoint
2025-10-16 10:54:16 +00:00

71 lines
1.7 KiB
Bash

#!/bin/bash
# Script per push automatico verso GitLab
set -e
# Colori
GREEN='\033[0;32m'
YELLOW='\033[1;33m'
RED='\033[0;31m'
NC='\033[0m'
echo -e "${GREEN}🚀 Push to GitLab (vt.alfacom.it)${NC}"
echo "========================================"
# Verifica remote GitLab
if ! git remote | grep -q "production"; then
echo -e "${YELLOW}⚠️ Remote 'production' non configurato${NC}"
echo "Configurazione remote GitLab..."
read -p "URL repository GitLab: " GITLAB_URL
git remote add production $GITLAB_URL
fi
# Verifica se ci sono modifiche
if [[ -z $(git status -s) ]]; then
echo -e "${YELLOW}⚠️ Nessuna modifica da committare${NC}"
exit 0
fi
# Mostra status
echo -e "\n${YELLOW}📋 Modifiche da committare:${NC}"
git status -s
# Chiedi conferma
read -p "Vuoi procedere con il push? (y/N) " -n 1 -r
echo
if [[ ! $REPLY =~ ^[Yy]$ ]]; then
echo -e "${RED}❌ Push annullato${NC}"
exit 1
fi
# Genera messaggio commit
TIMESTAMP=$(date '+%Y-%m-%d %H:%M:%S')
COMMIT_MSG="Deploy: $TIMESTAMP"
# Chiedi messaggio personalizzato
read -p "Messaggio commit personalizzato (Enter per default): " CUSTOM_MSG
if [[ ! -z "$CUSTOM_MSG" ]]; then
COMMIT_MSG="$CUSTOM_MSG"
fi
# Git operations
echo -e "\n${GREEN}📦 Git add...${NC}"
git add .
echo -e "${GREEN}💾 Git commit...${NC}"
git commit -m "$COMMIT_MSG"
echo -e "${GREEN}📤 Git push to production...${NC}"
git push production main
echo -e "\n${GREEN}✅ Push completato!${NC}"
echo "========================================"
echo -e "${YELLOW}Deployment automatico disponibile:${NC}"
echo ""
echo "Sul server esegui:"
echo -e "${GREEN} cd /var/www/vigilanza-turni${NC}"
echo -e "${GREEN} bash deploy/deploy.sh${NC}"
echo ""
echo "🌐 Sito: https://vt.alfacom.it"
echo ""