VigilanzaTurni/push-to-gitlab.sh
marco370 5a51a65218 Add deployment guide and scripts for automated server setup and deployment
Adds a comprehensive DEPLOYMENT.md guide, a setup-server.sh script for AlmaLinux 9 to install Node.js, PostgreSQL, Nginx, and PM2, a deploy.sh script for CI/CD deployment, an nginx.conf for server configuration, and a push-to-gitlab.sh helper script for Replit integration.

Replit-Commit-Author: Agent
Replit-Commit-Session-Id: 99f0fce6-9386-489a-9632-1d81223cab44
Replit-Commit-Checkpoint-Type: intermediate_checkpoint
Replit-Commit-Screenshot-Url: https://storage.googleapis.com/screenshot-production-us-central1/6d543d2c-20b9-4ea6-93fe-70fe9b1d9f80/99f0fce6-9386-489a-9632-1d81223cab44/H8Wilyj
2025-10-16 07:12:27 +00:00

60 lines
1.5 KiB
Bash
Executable File

#!/bin/bash
# Script helper per push automatico verso GitLab da Replit
set -e
# Colori
GREEN='\033[0;32m'
YELLOW='\033[1;33m'
RED='\033[0;31m'
NC='\033[0m'
echo -e "${GREEN}🚀 Push to GitLab Production${NC}"
echo "========================================"
# 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}Prossimi passi:${NC}"
echo "1. Vai su GitLab: https://git.alfacom.it/marco/VigilanzaTurni/-/pipelines"
echo "2. La pipeline CI/CD partirà automaticamente"
echo "3. Clicca su 'deploy_production' per deployare su server"
echo ""