littleshop/deploy-to-hostinger.sh
SilverLabs DevTeam a419bd7a78 Implement product variations, enhanced order workflow, mobile responsiveness, and product import system
## Product Variations System
- Add ProductVariation model with quantity-based pricing (1 for £10, 2 for £19, 3 for £25)
- Complete CRUD operations for product variations
- Enhanced ProductService to include variations in all queries
- Updated OrderItem to support ProductVariationId for variation-based orders
- Graceful error handling for duplicate quantity constraints
- Admin interface with variations management (Create/Edit/Delete)
- API endpoints for programmatic variation management

## Enhanced Order Workflow Management
- Redesigned OrderStatus enum with clear workflow states (Accept → Packing → Dispatched → Delivered)
- Added workflow tracking fields (AcceptedAt, PackingStartedAt, DispatchedAt, ExpectedDeliveryDate)
- User tracking for accountability (AcceptedByUser, PackedByUser, DispatchedByUser)
- Automatic delivery date calculation (dispatch date + working days, skips weekends)
- On Hold workflow for problem resolution with reason tracking
- Tab-based orders interface focused on workflow stages
- One-click workflow actions from list view

## Mobile-Responsive Design
- Responsive orders interface: tables on desktop, cards on mobile
- Touch-friendly buttons and spacing for mobile users
- Horizontal scrolling tabs with condensed labels on mobile
- Color-coded status borders for quick visual recognition
- Smart text switching based on screen size

## Product Import/Export System
- CSV import with product variations support
- Template download with examples
- Export existing products to CSV
- Detailed import results with success/error reporting
- Category name resolution (no need for GUIDs)
- Photo URLs import support

## Enhanced Dashboard
- Product variations count and metrics
- Stock alerts (low stock/out of stock warnings)
- Order workflow breakdown (pending, accepted, dispatched counts)
- Enhanced layout with more detailed information

## Technical Improvements
- Fixed form binding issues across all admin forms
- Removed external CDN dependencies for isolated deployment
- Bot Wizard form with auto-personality assignment
- Proper authentication scheme configuration (Cookie + JWT)
- Enhanced debug logging for troubleshooting

## Self-Contained Deployment
- All external CDN references replaced with local libraries
- Ready for air-gapped/isolated network deployment
- No external internet dependencies

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-09-18 01:39:31 +01:00

136 lines
4.1 KiB
Bash
Executable File

#!/bin/bash
# LittleShop Deployment Script for Hostinger VPS
# Usage: ./deploy-to-hostinger.sh
set -e # Exit on any error
# Configuration
HOSTINGER_HOST="31.97.57.205"
HOSTINGER_PORT="2255"
HOSTINGER_USER="sysadmin"
SSH_KEY="./Hostinger/vps_hardening_key"
REMOTE_DIR="/opt/littleshop"
SERVICE_NAME="littleshop"
# Colors for output
RED='\033[0;31m'
GREEN='\033[0;32m'
YELLOW='\033[1;33m'
NC='\033[0m' # No Color
# Logging function
log() {
echo -e "${GREEN}[$(date +'%Y-%m-%d %H:%M:%S')] $1${NC}"
}
warn() {
echo -e "${YELLOW}[$(date +'%Y-%m-%d %H:%M:%S')] WARNING: $1${NC}"
}
error() {
echo -e "${RED}[$(date +'%Y-%m-%d %H:%M:%S')] ERROR: $1${NC}"
exit 1
}
# Check if SSH key exists
if [ ! -f "$SSH_KEY" ]; then
error "SSH key not found at $SSH_KEY"
fi
# Check if required files exist
if [ ! -f "hostinger-docker-compose.yml" ]; then
error "hostinger-docker-compose.yml not found"
fi
if [ ! -f ".env.hostinger" ]; then
warn ".env.hostinger not found - you'll need to configure environment variables manually"
fi
log "Starting deployment to Hostinger VPS..."
# Test SSH connection
log "Testing SSH connection..."
ssh -i "$SSH_KEY" -p "$HOSTINGER_PORT" -o ConnectTimeout=10 "$HOSTINGER_USER@$HOSTINGER_HOST" "echo 'SSH connection successful'" || error "SSH connection failed"
# Create remote directory
log "Creating remote directory structure..."
ssh -i "$SSH_KEY" -p "$HOSTINGER_PORT" "$HOSTINGER_USER@$HOSTINGER_HOST" "echo 'Phenom12#.' | sudo -S mkdir -p $REMOTE_DIR && echo 'Phenom12#.' | sudo -S chown $HOSTINGER_USER:$HOSTINGER_USER $REMOTE_DIR"
# Copy files to server
log "Copying application files..."
scp -i "$SSH_KEY" -P "$HOSTINGER_PORT" -r LittleShop/ "$HOSTINGER_USER@$HOSTINGER_HOST:$REMOTE_DIR/"
scp -i "$SSH_KEY" -P "$HOSTINGER_PORT" hostinger-docker-compose.yml "$HOSTINGER_USER@$HOSTINGER_HOST:$REMOTE_DIR/docker-compose.yml"
scp -i "$SSH_KEY" -P "$HOSTINGER_PORT" nginx.conf "$HOSTINGER_USER@$HOSTINGER_HOST:$REMOTE_DIR/"
# Copy environment file if it exists
if [ -f ".env.hostinger" ]; then
log "Copying environment configuration..."
scp -i "$SSH_KEY" -P "$HOSTINGER_PORT" .env.hostinger "$HOSTINGER_USER@$HOSTINGER_HOST:$REMOTE_DIR/.env"
fi
# Deploy on remote server
log "Building and starting containers on remote server..."
ssh -i "$SSH_KEY" -p "$HOSTINGER_PORT" "$HOSTINGER_USER@$HOSTINGER_HOST" << 'EOF'
cd /opt/littleshop
# Stop existing containers if running
if docker-compose ps | grep -q "littleshop"; then
echo "Stopping existing containers..."
docker-compose down
fi
# Build and start new containers
echo "Building Docker image..."
docker-compose build
echo "Starting containers..."
docker-compose up -d
# Wait for container to be ready
echo "Waiting for application to start..."
sleep 10
# Check if container is running
if docker-compose ps | grep -q "Up"; then
echo "✅ Deployment successful!"
echo "Container status:"
docker-compose ps
echo ""
echo "Checking application health..."
# Try to curl the health endpoint
if curl -f http://localhost:8081/api/test > /dev/null 2>&1; then
echo "✅ Application is responding on port 8081"
else
echo "⚠️ Application may still be starting up"
fi
echo ""
echo "📝 Next steps:"
echo "1. Configure your domain to point to this server"
echo "2. Set up SSL certificates if needed"
echo "3. Configure BTCPay Server integration"
echo "4. Test the application at http://31.97.57.205:8081"
else
echo "❌ Deployment failed - containers not running"
docker-compose logs
exit 1
fi
EOF
if [ $? -eq 0 ]; then
log "🎉 Deployment completed successfully!"
log "Application should be available at:"
log " - http://$HOSTINGER_HOST:8081 (direct access)"
log " - http://shop.thebankofdebbie.giize.com (if DNS is configured)"
log ""
log "📋 Post-deployment checklist:"
log "1. Update DNS records to point shop.thebankofdebbie.giize.com to $HOSTINGER_HOST"
log "2. Configure SSL certificates"
log "3. Update BTCPay Server settings in .env file"
log "4. Test all application functionality"
log "5. Set up monitoring and backups"
else
error "Deployment failed!"
fi