littleshop/deploy-production-manual.sh
SysAdmin 127be759c8 Refactor payment verification to manual workflow and add comprehensive cleanup tools
Major changes:
• Remove BTCPay Server integration in favor of SilverPAY manual verification
• Add test data cleanup mechanisms (API endpoints and shell scripts)
• Fix compilation errors in TestController (IdentityReference vs CustomerIdentity)
• Add deployment automation scripts for Hostinger VPS
• Enhance integration testing with comprehensive E2E validation
• Add Blazor components and mobile-responsive CSS for admin interface
• Create production environment configuration scripts

Key Features Added:
• Manual payment verification through Admin panel Order Details
• Bulk test data cleanup with proper cascade handling
• Deployment automation with systemd service configuration
• Comprehensive E2E testing suite with SilverPAY integration validation
• Mobile-first admin interface improvements

Security & Production:
• Environment variable configuration for production secrets
• Proper JWT and VAPID key management
• SilverPAY API integration with live credentials
• Database cleanup and maintenance tools

🤖 Generated with Claude Code

Co-Authored-By: Claude <noreply@anthropic.com>
2025-09-25 19:29:00 +01:00

123 lines
4.0 KiB
Bash

#!/bin/bash
# Production Deployment Script for LittleShop with Bot Activity Tracking
# Run this script on the production server after SSHing in
set -e
echo "================================================"
echo "🚀 LittleShop Production Deployment"
echo "================================================"
echo ""
# Colors for output
GREEN='\033[0;32m'
YELLOW='\033[1;33m'
RED='\033[0;31m'
NC='\033[0m' # No Color
# Navigate to project directory
cd /root/LittleShop || { echo -e "${RED}Error: Project directory not found${NC}"; exit 1; }
echo -e "${YELLOW}Step 1: Pulling latest code from Git...${NC}"
git pull origin main || { echo -e "${RED}Error: Failed to pull from Git${NC}"; exit 1; }
echo -e "${GREEN}✓ Code updated successfully${NC}"
echo ""
echo -e "${YELLOW}Step 2: Backing up current database...${NC}"
if [ -f "littleshop.db" ]; then
cp littleshop.db "backups/littleshop_$(date +%Y%m%d_%H%M%S).db"
echo -e "${GREEN}✓ Database backed up${NC}"
else
echo -e "${YELLOW}No database file found, skipping backup${NC}"
fi
echo ""
echo -e "${YELLOW}Step 3: Building Docker images...${NC}"
echo "Building LittleShop..."
docker-compose build littleshop --no-cache || { echo -e "${RED}Error: Failed to build LittleShop${NC}"; exit 1; }
echo -e "${GREEN}✓ LittleShop built successfully${NC}"
echo "Building TeleBot..."
docker-compose build telebot --no-cache || { echo -e "${RED}Error: Failed to build TeleBot${NC}"; exit 1; }
echo -e "${GREEN}✓ TeleBot built successfully${NC}"
echo ""
echo -e "${YELLOW}Step 4: Stopping current services...${NC}"
docker-compose down
echo -e "${GREEN}✓ Services stopped${NC}"
echo ""
echo -e "${YELLOW}Step 5: Starting updated services...${NC}"
docker-compose up -d
echo -e "${GREEN}✓ Services started${NC}"
echo ""
echo -e "${YELLOW}Step 6: Waiting for services to be ready...${NC}"
sleep 10
echo -e "${YELLOW}Step 7: Verifying deployment...${NC}"
echo ""
# Check if LittleShop is running
if docker ps | grep -q littleshop; then
echo -e "${GREEN}✓ LittleShop container is running${NC}"
# Check health endpoint
if curl -s -f http://localhost:8080/health > /dev/null 2>&1; then
echo -e "${GREEN}✓ LittleShop API is responding${NC}"
else
echo -e "${YELLOW}⚠ LittleShop API health check failed (may still be starting)${NC}"
fi
else
echo -e "${RED}✗ LittleShop container is not running${NC}"
fi
# Check if TeleBot is running
if docker ps | grep -q telebot; then
echo -e "${GREEN}✓ TeleBot container is running${NC}"
else
echo -e "${RED}✗ TeleBot container is not running${NC}"
fi
# Check if SilverPay is running
if docker ps | grep -q silverpay; then
echo -e "${GREEN}✓ SilverPay container is running${NC}"
else
echo -e "${YELLOW}⚠ SilverPay container is not running${NC}"
fi
echo ""
echo -e "${YELLOW}Step 8: Displaying container logs...${NC}"
echo ""
echo "=== Recent LittleShop logs ==="
docker logs --tail 20 littleshop-admin 2>&1 || true
echo ""
echo "=== Recent TeleBot logs ==="
docker logs --tail 20 telebot 2>&1 || true
echo ""
echo "================================================"
echo -e "${GREEN}🎉 DEPLOYMENT COMPLETE!${NC}"
echo "================================================"
echo ""
echo "New Features Deployed:"
echo "✅ Bot Activity Tracking System"
echo "✅ Live Dashboard for Real-time Monitoring"
echo "✅ Product Variants Support"
echo "✅ Enhanced Multi-buy Options"
echo ""
echo "Access Points:"
echo "📊 Live Dashboard: https://admin.thebankofdebbie.giize.com/Admin/BotActivity/Live"
echo "🛒 Admin Panel: https://admin.thebankofdebbie.giize.com/Admin"
echo "🤖 TeleBot: Search @LittleShopBot on Telegram"
echo ""
echo "To monitor activity tracking:"
echo "1. Open TeleBot and browse some products"
echo "2. Visit the Live Dashboard URL above"
echo "3. You should see real-time activity data"
echo ""
echo -e "${YELLOW}Note: If services are not running, check logs with:${NC}"
echo " docker logs littleshop-admin"
echo " docker logs telebot"
echo " docker-compose ps"