Updatweb
This commit is contained in:
96
scripts/DISABLE_WINDOWS_LOCALHOST.ps1
Normal file
96
scripts/DISABLE_WINDOWS_LOCALHOST.ps1
Normal file
@@ -0,0 +1,96 @@
|
||||
# ═══════════════════════════════════════════════════════════════
|
||||
# Windows Localhost Disabler Script
|
||||
# Run this in PowerShell as Administrator on your WINDOWS machine
|
||||
# ═══════════════════════════════════════════════════════════════
|
||||
|
||||
Write-Host "═══════════════════════════════════════════════════════════════" -ForegroundColor Cyan
|
||||
Write-Host "Disabling Web Servers on Windows" -ForegroundColor Yellow
|
||||
Write-Host "═══════════════════════════════════════════════════════════════" -ForegroundColor Cyan
|
||||
Write-Host ""
|
||||
|
||||
# Check if running as Administrator
|
||||
$currentPrincipal = New-Object Security.Principal.WindowsPrincipal([Security.Principal.WindowsIdentity]::GetCurrent())
|
||||
$isAdmin = $currentPrincipal.IsInRole([Security.Principal.WindowsBuiltInRole]::Administrator)
|
||||
|
||||
if (-not $isAdmin) {
|
||||
Write-Host "❌ ERROR: You must run PowerShell as Administrator!" -ForegroundColor Red
|
||||
Write-Host "Right-click PowerShell and select 'Run as Administrator'" -ForegroundColor Yellow
|
||||
pause
|
||||
exit
|
||||
}
|
||||
|
||||
Write-Host "✅ Running as Administrator" -ForegroundColor Green
|
||||
Write-Host ""
|
||||
|
||||
# Function to stop and disable service
|
||||
function Stop-AndDisableService {
|
||||
param($serviceName)
|
||||
|
||||
$service = Get-Service -Name $serviceName -ErrorAction SilentlyContinue
|
||||
if ($service) {
|
||||
Write-Host "Found: $serviceName" -ForegroundColor Yellow
|
||||
if ($service.Status -eq 'Running') {
|
||||
Write-Host " Stopping $serviceName..." -ForegroundColor Cyan
|
||||
Stop-Service -Name $serviceName -Force
|
||||
Write-Host " ✅ Stopped" -ForegroundColor Green
|
||||
}
|
||||
Write-Host " Disabling $serviceName..." -ForegroundColor Cyan
|
||||
Set-Service -Name $serviceName -StartupType Disabled
|
||||
Write-Host " ✅ Disabled" -ForegroundColor Green
|
||||
} else {
|
||||
Write-Host "⚪ $serviceName not found (skip)" -ForegroundColor Gray
|
||||
}
|
||||
Write-Host ""
|
||||
}
|
||||
|
||||
# Stop IIS
|
||||
Write-Host "─────────────────────────────────────────────" -ForegroundColor Cyan
|
||||
Write-Host "Checking IIS (Internet Information Services)" -ForegroundColor Yellow
|
||||
Write-Host "─────────────────────────────────────────────" -ForegroundColor Cyan
|
||||
Stop-AndDisableService "W3SVC"
|
||||
Stop-AndDisableService "WAS"
|
||||
Stop-AndDisableService "IISADMIN"
|
||||
|
||||
# Stop Apache
|
||||
Write-Host "─────────────────────────────────────────────" -ForegroundColor Cyan
|
||||
Write-Host "Checking Apache Web Server" -ForegroundColor Yellow
|
||||
Write-Host "─────────────────────────────────────────────" -ForegroundColor Cyan
|
||||
Stop-AndDisableService "Apache2.4"
|
||||
Stop-AndDisableService "wampapache64"
|
||||
Stop-AndDisableService "xamppApache"
|
||||
|
||||
# Check what's on port 80
|
||||
Write-Host "─────────────────────────────────────────────" -ForegroundColor Cyan
|
||||
Write-Host "Checking Port 80" -ForegroundColor Yellow
|
||||
Write-Host "─────────────────────────────────────────────" -ForegroundColor Cyan
|
||||
|
||||
$port80 = Get-NetTCPConnection -LocalPort 80 -ErrorAction SilentlyContinue
|
||||
if ($port80) {
|
||||
Write-Host "⚠️ Something is still using port 80:" -ForegroundColor Yellow
|
||||
foreach ($conn in $port80) {
|
||||
$process = Get-Process -Id $conn.OwningProcess -ErrorAction SilentlyContinue
|
||||
Write-Host " PID: $($conn.OwningProcess) - $($process.Name)" -ForegroundColor Red
|
||||
|
||||
$response = Read-Host "Kill this process? (Y/N)"
|
||||
if ($response -eq 'Y' -or $response -eq 'y') {
|
||||
Stop-Process -Id $conn.OwningProcess -Force
|
||||
Write-Host " ✅ Killed process $($process.Name)" -ForegroundColor Green
|
||||
}
|
||||
}
|
||||
} else {
|
||||
Write-Host "✅ Port 80 is FREE!" -ForegroundColor Green
|
||||
}
|
||||
|
||||
Write-Host ""
|
||||
Write-Host "═══════════════════════════════════════════════════════════════" -ForegroundColor Cyan
|
||||
Write-Host "✅ DONE!" -ForegroundColor Green
|
||||
Write-Host "═══════════════════════════════════════════════════════════════" -ForegroundColor Cyan
|
||||
Write-Host ""
|
||||
Write-Host "Now try in Firefox:" -ForegroundColor Yellow
|
||||
Write-Host " http://localhost:5000/" -ForegroundColor Cyan
|
||||
Write-Host ""
|
||||
Write-Host "Or:" -ForegroundColor Yellow
|
||||
Write-Host " http://192.168.10.130:5000/" -ForegroundColor Cyan
|
||||
Write-Host ""
|
||||
|
||||
pause
|
||||
47
scripts/README.md
Normal file
47
scripts/README.md
Normal file
@@ -0,0 +1,47 @@
|
||||
# Scripts Directory
|
||||
|
||||
This folder contains all automation scripts for development, deployment, and server management.
|
||||
|
||||
## Development Scripts
|
||||
|
||||
- **dev-start.sh** - Start the development server with auto-reload
|
||||
- **check-assets.sh** - Verify all assets are properly linked
|
||||
- **local-commit.sh** - Quick local git commit
|
||||
|
||||
## Deployment Scripts
|
||||
|
||||
- **deploy-website.sh** - Deploy website updates to production
|
||||
- **deploy-admin-updates.sh** - Deploy admin panel updates
|
||||
- **pre-deployment-check.sh** - Run pre-deployment checks
|
||||
|
||||
## Server Management
|
||||
|
||||
- **manage-server.sh** - Server management utilities
|
||||
- **check-service.sh** - Check service status
|
||||
- **setup-service.sh** - Setup systemd service
|
||||
- **quick-status.sh** - Quick server status check
|
||||
- **pre-start.sh** - Pre-startup checks
|
||||
|
||||
## Testing & Verification
|
||||
|
||||
- **test-instant-changes.sh** - Test instant change deployment
|
||||
- **verify-admin-fix.sh** - Verify admin panel fixes
|
||||
- **verify-localhost.sh** - Verify localhost configuration
|
||||
|
||||
## Windows Scripts
|
||||
|
||||
- **DISABLE_WINDOWS_LOCALHOST.ps1** - PowerShell script for Windows localhost config
|
||||
|
||||
## Usage
|
||||
|
||||
All scripts should be run from the project root directory:
|
||||
|
||||
```bash
|
||||
./scripts/dev-start.sh
|
||||
```
|
||||
|
||||
Make sure scripts have execute permissions:
|
||||
|
||||
```bash
|
||||
chmod +x scripts/*.sh
|
||||
```
|
||||
110
scripts/check-assets.sh
Executable file
110
scripts/check-assets.sh
Executable file
@@ -0,0 +1,110 @@
|
||||
#!/bin/bash
|
||||
# check-assets.sh - Validate all referenced images exist
|
||||
# Usage: ./check-assets.sh
|
||||
|
||||
set -e
|
||||
|
||||
WEBSITE_DIR="/media/pts/Website/SkyArtShop/website"
|
||||
BACKEND_DIR="/media/pts/Website/SkyArtShop/backend"
|
||||
DB_NAME="skyartshop"
|
||||
DB_USER="skyartapp"
|
||||
|
||||
echo "🔍 SkyArtShop Asset Validation"
|
||||
echo "================================"
|
||||
echo ""
|
||||
|
||||
MISSING_COUNT=0
|
||||
TOTAL_COUNT=0
|
||||
|
||||
# Function to check if file exists
|
||||
check_file() {
|
||||
local file="$1"
|
||||
local source="$2"
|
||||
|
||||
TOTAL_COUNT=$((TOTAL_COUNT + 1))
|
||||
|
||||
if [ -f "${WEBSITE_DIR}${file}" ] || [ -L "${WEBSITE_DIR}${file}" ]; then
|
||||
echo "✅ ${file}"
|
||||
return 0
|
||||
else
|
||||
echo "❌ Missing: ${file} (referenced in ${source})"
|
||||
MISSING_COUNT=$((MISSING_COUNT + 1))
|
||||
return 1
|
||||
fi
|
||||
}
|
||||
|
||||
# Check critical images
|
||||
echo "📋 Checking Critical Images..."
|
||||
echo "-------------------------------"
|
||||
check_file "/assets/images/hero-image.jpg" "home.html"
|
||||
check_file "/assets/images/inspiration.jpg" "home.html"
|
||||
check_file "/assets/images/placeholder.jpg" "multiple pages"
|
||||
check_file "/assets/images/products/placeholder.jpg" "product pages"
|
||||
echo ""
|
||||
|
||||
# Check HTML image references
|
||||
echo "📄 Checking HTML Image References..."
|
||||
echo "-------------------------------------"
|
||||
if [ -d "${WEBSITE_DIR}/public" ]; then
|
||||
while IFS= read -r line; do
|
||||
# Extract image path from src attribute
|
||||
img=$(echo "$line" | sed -E 's/.*src="([^"]*\.(jpg|jpeg|png|gif|svg))".*/\1/')
|
||||
file=$(echo "$line" | cut -d':' -f1)
|
||||
|
||||
if [ -n "$img" ] && [ "$img" != "$line" ]; then
|
||||
check_file "$img" "$(basename $file)"
|
||||
fi
|
||||
done < <(grep -roh 'src="[^"]*\.\(jpg\|jpeg\|png\|gif\|svg\)' "${WEBSITE_DIR}/public/"*.html 2>/dev/null || true)
|
||||
fi
|
||||
echo ""
|
||||
|
||||
# Check database image references
|
||||
echo "🗄️ Checking Database Product Images..."
|
||||
echo "----------------------------------------"
|
||||
if command -v psql &> /dev/null; then
|
||||
while IFS= read -r img; do
|
||||
img=$(echo "$img" | xargs) # trim whitespace
|
||||
if [ -n "$img" ]; then
|
||||
check_file "$img" "database products table"
|
||||
fi
|
||||
done < <(PGPASSWORD="${DB_PASSWORD}" psql -U "$DB_USER" -d "$DB_NAME" -t -c "SELECT DISTINCT imageurl FROM products WHERE imageurl != '' AND imageurl IS NOT NULL;" 2>/dev/null || echo "")
|
||||
else
|
||||
echo "⚠️ psql not available - skipping database check"
|
||||
fi
|
||||
echo ""
|
||||
|
||||
# Check uploads directory
|
||||
echo "📁 Checking Uploads Directory..."
|
||||
echo "---------------------------------"
|
||||
UPLOAD_DIR="${WEBSITE_DIR}/uploads"
|
||||
if [ -d "$UPLOAD_DIR" ]; then
|
||||
UPLOAD_COUNT=$(find "$UPLOAD_DIR" -type f | wc -l)
|
||||
UPLOAD_SIZE=$(du -sh "$UPLOAD_DIR" | cut -f1)
|
||||
echo "✅ Uploads directory exists"
|
||||
echo " Files: $UPLOAD_COUNT"
|
||||
echo " Size: $UPLOAD_SIZE"
|
||||
else
|
||||
echo "❌ Uploads directory missing: $UPLOAD_DIR"
|
||||
MISSING_COUNT=$((MISSING_COUNT + 1))
|
||||
fi
|
||||
echo ""
|
||||
|
||||
# Summary
|
||||
echo "📊 Summary"
|
||||
echo "=========="
|
||||
echo "Total images checked: $TOTAL_COUNT"
|
||||
echo "Missing images: $MISSING_COUNT"
|
||||
echo ""
|
||||
|
||||
if [ $MISSING_COUNT -eq 0 ]; then
|
||||
echo "✅ All assets validated successfully!"
|
||||
exit 0
|
||||
else
|
||||
echo "⚠️ Found $MISSING_COUNT missing asset(s)"
|
||||
echo ""
|
||||
echo "💡 Suggestions:"
|
||||
echo " 1. Create symbolic links for placeholder images"
|
||||
echo " 2. Add real images to replace placeholders"
|
||||
echo " 3. Update database references to use existing images"
|
||||
exit 1
|
||||
fi
|
||||
30
scripts/check-service.sh
Executable file
30
scripts/check-service.sh
Executable file
@@ -0,0 +1,30 @@
|
||||
#!/bin/bash
|
||||
|
||||
# Quick service status check
|
||||
|
||||
echo "🔍 SkyArtShop Service Status"
|
||||
echo "=============================="
|
||||
echo ""
|
||||
|
||||
# Check if service is active
|
||||
if sudo systemctl is-active --quiet skyartshop; then
|
||||
echo "✅ Service is RUNNING"
|
||||
else
|
||||
echo "❌ Service is STOPPED"
|
||||
fi
|
||||
|
||||
echo ""
|
||||
echo "📊 Detailed Status:"
|
||||
sudo systemctl status skyartshop --no-pager -l
|
||||
|
||||
echo ""
|
||||
echo "🌐 Testing localhost:5000..."
|
||||
if curl -s -o /dev/null -w "%{http_code}" http://localhost:5000 | grep -q "200\|301\|302"; then
|
||||
echo "✅ Website is responding"
|
||||
else
|
||||
echo "⚠️ Website not responding"
|
||||
fi
|
||||
|
||||
echo ""
|
||||
echo "📝 Recent logs (last 10 lines):"
|
||||
sudo journalctl -u skyartshop -n 10 --no-pager
|
||||
75
scripts/deploy-admin-updates.sh
Executable file
75
scripts/deploy-admin-updates.sh
Executable file
@@ -0,0 +1,75 @@
|
||||
#!/bin/bash
|
||||
# Deploy Updated Admin Files to Production
|
||||
|
||||
echo "=========================================="
|
||||
echo " Deploying Admin Panel Updates"
|
||||
echo "=========================================="
|
||||
|
||||
SOURCE_DIR="/media/pts/Website/SkyArtShop/website/admin"
|
||||
DEST_DIR="/var/www/skyartshop/admin"
|
||||
|
||||
# Check if source directory exists
|
||||
if [ ! -d "$SOURCE_DIR" ]; then
|
||||
echo "❌ Source directory not found: $SOURCE_DIR"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Check if destination directory exists
|
||||
if [ ! -d "$DEST_DIR" ]; then
|
||||
echo "❌ Destination directory not found: $DEST_DIR"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
echo ""
|
||||
echo "📦 Copying updated admin files..."
|
||||
|
||||
# Copy auth.js (new file)
|
||||
echo " → Copying auth.js..."
|
||||
cp "$SOURCE_DIR/js/auth.js" "$DEST_DIR/js/"
|
||||
|
||||
# Copy updated HTML files
|
||||
echo " → Copying updated HTML files..."
|
||||
for file in dashboard.html homepage.html products.html portfolio.html blog.html pages.html menu.html settings.html users.html; do
|
||||
if [ -f "$SOURCE_DIR/$file" ]; then
|
||||
cp "$SOURCE_DIR/$file" "$DEST_DIR/"
|
||||
echo " ✓ $file"
|
||||
fi
|
||||
done
|
||||
|
||||
# Copy updated JS files
|
||||
echo " → Copying updated JS files..."
|
||||
for file in products.js homepage.js blog.js portfolio.js pages.js settings.js users.js; do
|
||||
if [ -f "$SOURCE_DIR/js/$file" ]; then
|
||||
cp "$SOURCE_DIR/js/$file" "$DEST_DIR/js/"
|
||||
echo " ✓ $file"
|
||||
fi
|
||||
done
|
||||
|
||||
# Set proper permissions
|
||||
echo ""
|
||||
echo "🔒 Setting proper permissions..."
|
||||
chmod -R 755 "$DEST_DIR"
|
||||
chown -R pts:pts "$DEST_DIR"
|
||||
|
||||
# Verify auth.js was copied
|
||||
if [ -f "$DEST_DIR/js/auth.js" ]; then
|
||||
echo ""
|
||||
echo "✅ auth.js deployed successfully"
|
||||
else
|
||||
echo ""
|
||||
echo "❌ auth.js deployment failed"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
echo ""
|
||||
echo "=========================================="
|
||||
echo " ✅ Deployment Complete!"
|
||||
echo "=========================================="
|
||||
echo ""
|
||||
echo "Files deployed to: $DEST_DIR"
|
||||
echo ""
|
||||
echo "Next steps:"
|
||||
echo "1. Clear browser cache (Ctrl+Shift+Delete)"
|
||||
echo "2. Login to admin panel: http://localhost:5000/admin/login.html"
|
||||
echo "3. Test navigation between sections"
|
||||
echo ""
|
||||
109
scripts/deploy-website.sh
Executable file
109
scripts/deploy-website.sh
Executable file
@@ -0,0 +1,109 @@
|
||||
#!/bin/bash
|
||||
# Website Consolidation and Full Deployment Script
|
||||
# Deploys from /media/pts/Website/SkyArtShop/website to /var/www/skyartshop
|
||||
|
||||
set -e # Exit on error
|
||||
|
||||
REPO_DIR="/media/pts/Website/SkyArtShop"
|
||||
DEV_DIR="$REPO_DIR/website"
|
||||
DEPLOY_DIR="/var/www/skyartshop"
|
||||
BACKUP_DIR="/var/www/backups/skyartshop-$(date +%Y%m%d-%H%M%S)"
|
||||
|
||||
echo "========================================="
|
||||
echo " Sky Art Shop - Full Website Deployment"
|
||||
echo "========================================="
|
||||
echo ""
|
||||
echo "📁 Source (Dev): $DEV_DIR"
|
||||
echo "🌐 Destination: $DEPLOY_DIR"
|
||||
echo "💾 Backup: $BACKUP_DIR"
|
||||
echo ""
|
||||
|
||||
# Create backup
|
||||
echo "📦 Creating backup of current production..."
|
||||
sudo mkdir -p "$BACKUP_DIR"
|
||||
sudo cp -r "$DEPLOY_DIR" "$BACKUP_DIR/" 2>/dev/null || true
|
||||
echo "✅ Backup created"
|
||||
echo ""
|
||||
|
||||
# Deploy files
|
||||
echo "🚀 Deploying website files..."
|
||||
|
||||
# Deploy public frontend
|
||||
echo " → Public pages..."
|
||||
sudo rm -rf "$DEPLOY_DIR/public"
|
||||
sudo mkdir -p "$DEPLOY_DIR/public"
|
||||
sudo cp -r "$DEV_DIR/public/"* "$DEPLOY_DIR/public/" 2>/dev/null || true
|
||||
echo " ✓ Public pages deployed"
|
||||
|
||||
# Deploy admin panel
|
||||
echo " → Admin panel..."
|
||||
sudo rm -rf "$DEPLOY_DIR/admin"
|
||||
sudo mkdir -p "$DEPLOY_DIR/admin"
|
||||
sudo cp -r "$DEV_DIR/admin/"* "$DEPLOY_DIR/admin/" 2>/dev/null || true
|
||||
echo " ✓ Admin panel deployed"
|
||||
|
||||
# Deploy assets
|
||||
echo " → Assets..."
|
||||
sudo rm -rf "$DEPLOY_DIR/assets"
|
||||
sudo mkdir -p "$DEPLOY_DIR/assets"
|
||||
sudo cp -r "$DEV_DIR/assets/"* "$DEPLOY_DIR/assets/" 2>/dev/null || true
|
||||
echo " ✓ Assets deployed"
|
||||
|
||||
# Create uploads directory if it doesn't exist
|
||||
sudo mkdir -p "$DEPLOY_DIR/uploads"
|
||||
sudo mkdir -p "$DEPLOY_DIR/uploads/products"
|
||||
sudo mkdir -p "$DEPLOY_DIR/uploads/portfolio"
|
||||
sudo mkdir -p "$DEPLOY_DIR/uploads/blog"
|
||||
|
||||
echo ""
|
||||
echo "🔒 Setting permissions..."
|
||||
sudo chown -R pts:pts "$DEPLOY_DIR"
|
||||
sudo chmod -R 755 "$DEPLOY_DIR"
|
||||
sudo chmod -R 775 "$DEPLOY_DIR/uploads"
|
||||
|
||||
echo ""
|
||||
echo "🔄 Reloading nginx..."
|
||||
sudo nginx -t && sudo systemctl reload nginx
|
||||
|
||||
echo ""
|
||||
echo "========================================="
|
||||
echo " ✅ Deployment Complete!"
|
||||
echo "========================================="
|
||||
echo ""
|
||||
echo "🌐 Your website is accessible at:"
|
||||
echo " • https://skyarts.ddns.net"
|
||||
echo " • http://localhost"
|
||||
echo ""
|
||||
echo "🔐 Admin Panel:"
|
||||
echo " • https://skyarts.ddns.net/admin/login.html"
|
||||
echo " • http://localhost:5000/admin/login.html"
|
||||
echo ""
|
||||
echo "⚙️ Backend API:"
|
||||
echo " • Port 5000 (PM2: skyartshop)"
|
||||
echo " • Status: pm2 status"
|
||||
echo ""
|
||||
echo "💡 Note: localhost and skyarts.ddns.net both serve"
|
||||
echo " the same website - they're just different URLs"
|
||||
echo " pointing to the same content."
|
||||
echo ""
|
||||
|
||||
# Sync assets (but don't delete to preserve any user uploads)
|
||||
rsync -av website/assets/ $DEPLOY_DIR/assets/ 2>/dev/null || cp -r website/assets/* $DEPLOY_DIR/assets/
|
||||
|
||||
# Fix permissions
|
||||
chown -R pts:pts $DEPLOY_DIR/public $DEPLOY_DIR/admin $DEPLOY_DIR/assets 2>/dev/null || true
|
||||
chmod -R 644 $DEPLOY_DIR/public/*.html $DEPLOY_DIR/admin/*.html 2>/dev/null || true
|
||||
|
||||
echo ""
|
||||
echo "========================================="
|
||||
echo "✅ Deployment Complete!"
|
||||
echo "========================================="
|
||||
echo ""
|
||||
echo "🌐 Website: https://skyarts.ddns.net"
|
||||
echo "🔐 Admin: https://skyarts.ddns.net/admin"
|
||||
echo ""
|
||||
echo "📝 Next steps:"
|
||||
echo " 1. Edit files in: $REPO_DIR/website/"
|
||||
echo " 2. Run this script to deploy"
|
||||
echo " 3. Commit changes: git add . && git commit -m 'Update website'"
|
||||
echo ""
|
||||
83
scripts/dev-start.sh
Executable file
83
scripts/dev-start.sh
Executable file
@@ -0,0 +1,83 @@
|
||||
#!/bin/bash
|
||||
|
||||
# Quick Start Development Mode
|
||||
# Run this anytime to check status or start development
|
||||
|
||||
echo "╔══════════════════════════════════════════════╗"
|
||||
echo "║ Sky Art Shop - Development Mode ║"
|
||||
echo "╚══════════════════════════════════════════════╝"
|
||||
echo ""
|
||||
|
||||
# Check if backend is running
|
||||
if pm2 list | grep -q "skyartshop.*online"; then
|
||||
echo "✅ Backend: Running on http://localhost:5000"
|
||||
echo " 📁 Serving from: /media/pts/Website/SkyArtShop/website/"
|
||||
echo " 🔄 Watch mode: Enabled (auto-restart on backend changes)"
|
||||
else
|
||||
echo "❌ Backend: Not running"
|
||||
echo " Starting now..."
|
||||
cd /media/pts/Website/SkyArtShop/backend
|
||||
NODE_ENV=development pm2 start server.js --name skyartshop --watch
|
||||
sleep 2
|
||||
fi
|
||||
|
||||
echo ""
|
||||
|
||||
# Check nginx status
|
||||
if systemctl is-active --quiet nginx; then
|
||||
echo "⚠️ Nginx: Running (should be disabled for development)"
|
||||
echo " Run: sudo systemctl stop nginx"
|
||||
else
|
||||
echo "✅ Nginx: Stopped (correct for development)"
|
||||
fi
|
||||
|
||||
echo ""
|
||||
echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"
|
||||
echo "🌐 Access Your Site:"
|
||||
echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"
|
||||
echo ""
|
||||
echo " Homepage: http://localhost:5000/"
|
||||
echo " Admin Login: http://localhost:5000/admin/login.html"
|
||||
echo " Admin Dashboard: http://localhost:5000/admin/dashboard.html"
|
||||
echo " Health Check: http://localhost:5000/health"
|
||||
echo ""
|
||||
echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"
|
||||
echo "✨ Making Changes:"
|
||||
echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"
|
||||
echo ""
|
||||
echo " 1. Edit files in: /media/pts/Website/SkyArtShop/website/"
|
||||
echo " 2. Refresh browser (F5 or Ctrl+R)"
|
||||
echo " 3. See changes immediately!"
|
||||
echo ""
|
||||
echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"
|
||||
echo "🛠️ Useful Commands:"
|
||||
echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"
|
||||
echo ""
|
||||
echo " pm2 status - Check backend status"
|
||||
echo " pm2 logs skyartshop - View live logs"
|
||||
echo " pm2 restart skyartshop - Restart backend"
|
||||
echo " ./test-instant-changes.sh - Test instant changes"
|
||||
echo ""
|
||||
echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"
|
||||
|
||||
# Test connection
|
||||
echo ""
|
||||
echo "🧪 Testing connection..."
|
||||
if curl -s http://localhost:5000/health > /dev/null 2>&1; then
|
||||
echo "✅ Server responding correctly!"
|
||||
else
|
||||
echo "❌ Server not responding. Check logs: pm2 logs skyartshop"
|
||||
fi
|
||||
|
||||
echo ""
|
||||
echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"
|
||||
echo "⚠️ Important Notes:"
|
||||
echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"
|
||||
echo ""
|
||||
echo " ✅ ONLY http://localhost:5000 is active"
|
||||
echo " ❌ http://localhost (port 80) is DISABLED"
|
||||
echo " 🔒 Nginx and Apache are stopped for development"
|
||||
echo ""
|
||||
echo " Run ./verify-localhost.sh to verify anytime"
|
||||
echo ""
|
||||
echo "Ready to develop! 🚀"
|
||||
45
scripts/local-commit.sh
Executable file
45
scripts/local-commit.sh
Executable file
@@ -0,0 +1,45 @@
|
||||
#!/bin/bash
|
||||
# Local Git Commit Script
|
||||
# This script commits all changes locally without pushing to GitHub
|
||||
|
||||
cd /media/pts/Website/SkyArtShop
|
||||
|
||||
echo "========================================="
|
||||
echo " Local Git Commit (No GitHub Sync)"
|
||||
echo "========================================="
|
||||
echo ""
|
||||
|
||||
# Show current changes
|
||||
echo "Current changes:"
|
||||
git status --short
|
||||
echo ""
|
||||
|
||||
# Ask for commit message
|
||||
read -p "Enter commit message: " commit_msg
|
||||
|
||||
if [ -z "$commit_msg" ]; then
|
||||
echo "Error: Commit message cannot be empty"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Stage all changes
|
||||
echo "Staging all changes..."
|
||||
git add -A
|
||||
|
||||
# Commit
|
||||
echo "Committing changes..."
|
||||
git commit -m "$commit_msg"
|
||||
|
||||
if [ $? -eq 0 ]; then
|
||||
echo ""
|
||||
echo "✅ Changes committed successfully!"
|
||||
echo "📁 All changes are stored locally on this server"
|
||||
echo "🚫 No changes will be pushed to GitHub"
|
||||
echo ""
|
||||
echo "Recent commits:"
|
||||
git log --oneline -3
|
||||
else
|
||||
echo ""
|
||||
echo "❌ Commit failed"
|
||||
exit 1
|
||||
fi
|
||||
63
scripts/manage-server.sh
Executable file
63
scripts/manage-server.sh
Executable file
@@ -0,0 +1,63 @@
|
||||
#!/bin/bash
|
||||
|
||||
# SkyArtShop PM2 Management Script
|
||||
|
||||
ACTION=${1:-status}
|
||||
|
||||
case $ACTION in
|
||||
start)
|
||||
echo "🚀 Starting SkyArtShop with PM2..."
|
||||
cd /media/pts/Website/SkyArtShop
|
||||
pm2 start ecosystem.config.js
|
||||
pm2 save
|
||||
echo "✅ Server started and saved to PM2"
|
||||
;;
|
||||
|
||||
stop)
|
||||
echo "⏹️ Stopping SkyArtShop..."
|
||||
pm2 stop skyartshop
|
||||
echo "✅ Server stopped"
|
||||
;;
|
||||
|
||||
restart)
|
||||
echo "🔄 Restarting SkyArtShop..."
|
||||
pm2 restart skyartshop
|
||||
echo "✅ Server restarted"
|
||||
;;
|
||||
|
||||
status)
|
||||
echo "📊 SkyArtShop Status:"
|
||||
pm2 list skyartshop
|
||||
echo ""
|
||||
pm2 show skyartshop
|
||||
;;
|
||||
|
||||
logs)
|
||||
echo "📝 Showing SkyArtShop logs (Ctrl+C to exit)..."
|
||||
pm2 logs skyartshop
|
||||
;;
|
||||
|
||||
setup)
|
||||
echo "🔧 Setting up PM2 to start on boot..."
|
||||
pm2 startup systemd -u pts --hp /home/pts
|
||||
echo ""
|
||||
echo "⚠️ Run the command above if shown, then run:"
|
||||
echo " ./manage-server.sh start"
|
||||
echo " pm2 save"
|
||||
;;
|
||||
|
||||
*)
|
||||
echo "SkyArtShop Server Manager"
|
||||
echo "========================="
|
||||
echo ""
|
||||
echo "Usage: $0 {start|stop|restart|status|logs|setup}"
|
||||
echo ""
|
||||
echo "Commands:"
|
||||
echo " start - Start the server"
|
||||
echo " stop - Stop the server"
|
||||
echo " restart - Restart the server"
|
||||
echo " status - Show server status"
|
||||
echo " logs - Show and follow logs"
|
||||
echo " setup - Configure PM2 to start on boot"
|
||||
;;
|
||||
esac
|
||||
182
scripts/pre-deployment-check.sh
Executable file
182
scripts/pre-deployment-check.sh
Executable file
@@ -0,0 +1,182 @@
|
||||
#!/bin/bash
|
||||
# Quick Deployment Checklist Script
|
||||
# Run this before deploying to production
|
||||
|
||||
echo "🔍 SkyArtShop Pre-Deployment Checklist"
|
||||
echo "========================================"
|
||||
echo ""
|
||||
|
||||
# Colors
|
||||
RED='\033[0;31m'
|
||||
GREEN='\033[0;32m'
|
||||
YELLOW='\033[1;33m'
|
||||
NC='\033[0m' # No Color
|
||||
|
||||
check_pass() {
|
||||
echo -e "${GREEN}✓${NC} $1"
|
||||
}
|
||||
|
||||
check_fail() {
|
||||
echo -e "${RED}✗${NC} $1"
|
||||
}
|
||||
|
||||
check_warn() {
|
||||
echo -e "${YELLOW}⚠${NC} $1"
|
||||
}
|
||||
|
||||
# Check 1: .env file exists
|
||||
echo "1. Checking environment configuration..."
|
||||
if [ -f ".env" ]; then
|
||||
check_pass ".env file exists"
|
||||
|
||||
# Check for default/weak values
|
||||
if grep -q "your_secure_password_here" .env; then
|
||||
check_fail "Default password found in .env - CHANGE IT!"
|
||||
else
|
||||
check_pass "No default passwords found"
|
||||
fi
|
||||
|
||||
if grep -q "skyart-shop-secret-2025-change-this-in-production" .env; then
|
||||
check_fail "Default SESSION_SECRET found - GENERATE NEW ONE!"
|
||||
else
|
||||
check_pass "SESSION_SECRET appears to be custom"
|
||||
fi
|
||||
else
|
||||
check_fail ".env file not found - copy .env.example and configure"
|
||||
fi
|
||||
echo ""
|
||||
|
||||
# Check 2: Dependencies installed
|
||||
echo "2. Checking dependencies..."
|
||||
if [ -d "backend/node_modules" ]; then
|
||||
check_pass "node_modules exists"
|
||||
else
|
||||
check_fail "node_modules not found - run: cd backend && npm install"
|
||||
fi
|
||||
echo ""
|
||||
|
||||
# Check 3: Log directory
|
||||
echo "3. Checking log directory..."
|
||||
if [ -d "backend/logs" ]; then
|
||||
check_pass "logs directory exists"
|
||||
else
|
||||
check_warn "logs directory not found - will be created automatically"
|
||||
mkdir -p backend/logs
|
||||
check_pass "Created logs directory"
|
||||
fi
|
||||
echo ""
|
||||
|
||||
# Check 4: Uploads directory
|
||||
echo "4. Checking uploads directory..."
|
||||
if [ -d "website/uploads" ]; then
|
||||
check_pass "uploads directory exists"
|
||||
else
|
||||
check_warn "uploads directory not found - creating it"
|
||||
mkdir -p website/uploads
|
||||
check_pass "Created uploads directory"
|
||||
fi
|
||||
echo ""
|
||||
|
||||
# Check 5: PostgreSQL connection
|
||||
echo "5. Checking database connection..."
|
||||
if command -v psql &> /dev/null; then
|
||||
# Try to connect using .env values
|
||||
if [ -f ".env" ]; then
|
||||
source .env
|
||||
if psql -h $DB_HOST -p $DB_PORT -U $DB_USER -d $DB_NAME -c "SELECT 1;" &> /dev/null; then
|
||||
check_pass "Database connection successful"
|
||||
else
|
||||
check_fail "Cannot connect to database - check credentials"
|
||||
fi
|
||||
else
|
||||
check_warn "Cannot test database - .env not found"
|
||||
fi
|
||||
else
|
||||
check_warn "psql not found - cannot test database connection"
|
||||
fi
|
||||
echo ""
|
||||
|
||||
# Check 6: Syntax validation
|
||||
echo "6. Validating JavaScript syntax..."
|
||||
cd backend
|
||||
if node -c server.js 2>/dev/null && \
|
||||
node -c config/database.js 2>/dev/null && \
|
||||
node -c config/logger.js 2>/dev/null; then
|
||||
check_pass "All core files syntax valid"
|
||||
else
|
||||
check_fail "Syntax errors found - check files"
|
||||
fi
|
||||
cd ..
|
||||
echo ""
|
||||
|
||||
# Check 7: PM2 status
|
||||
echo "7. Checking PM2 configuration..."
|
||||
if command -v pm2 &> /dev/null; then
|
||||
check_pass "PM2 installed"
|
||||
if pm2 list | grep -q "skyartshop"; then
|
||||
check_pass "SkyArtShop PM2 process exists"
|
||||
else
|
||||
check_warn "SkyArtShop not in PM2 - will need to add"
|
||||
fi
|
||||
else
|
||||
check_fail "PM2 not installed - run: npm install -g pm2"
|
||||
fi
|
||||
echo ""
|
||||
|
||||
# Check 8: Security audit
|
||||
echo "8. Running security audit..."
|
||||
cd backend
|
||||
npm audit --production 2>/dev/null | head -n 3
|
||||
cd ..
|
||||
echo ""
|
||||
|
||||
# Check 9: Nginx configuration
|
||||
echo "9. Checking Nginx..."
|
||||
if command -v nginx &> /dev/null; then
|
||||
check_pass "Nginx installed"
|
||||
if [ -f "/etc/nginx/sites-enabled/skyartshop" ] || [ -f "nginx-skyartshop-secured.conf" ]; then
|
||||
check_pass "Nginx configuration found"
|
||||
else
|
||||
check_warn "Nginx configuration not found in sites-enabled"
|
||||
fi
|
||||
else
|
||||
check_warn "Nginx not installed or not in PATH"
|
||||
fi
|
||||
echo ""
|
||||
|
||||
# Check 10: File permissions
|
||||
echo "10. Checking file permissions..."
|
||||
if [ -w "backend/logs" ]; then
|
||||
check_pass "Logs directory is writable"
|
||||
else
|
||||
check_fail "Logs directory not writable - run: chmod 755 backend/logs"
|
||||
fi
|
||||
|
||||
if [ -w "website/uploads" ]; then
|
||||
check_pass "Uploads directory is writable"
|
||||
else
|
||||
check_fail "Uploads directory not writable - run: chmod 755 website/uploads"
|
||||
fi
|
||||
echo ""
|
||||
|
||||
# Summary
|
||||
echo "========================================"
|
||||
echo "📋 Summary"
|
||||
echo "========================================"
|
||||
echo ""
|
||||
echo "Before deploying to production:"
|
||||
echo "1. ✓ Update .env with strong passwords"
|
||||
echo "2. ✓ Generate new SESSION_SECRET (32+ chars)"
|
||||
echo "3. ✓ Set NODE_ENV=production"
|
||||
echo "4. ✓ Configure SSL certificates"
|
||||
echo "5. ✓ Set up nginx reverse proxy"
|
||||
echo "6. ✓ Configure firewall (ufw/iptables)"
|
||||
echo "7. ✓ Run: pm2 restart skyartshop"
|
||||
echo "8. ✓ Run: pm2 save"
|
||||
echo "9. ✓ Monitor logs: pm2 logs skyartshop"
|
||||
echo "10. ✓ Test: curl http://localhost:5000/health"
|
||||
echo ""
|
||||
echo "Generate SESSION_SECRET with:"
|
||||
echo "node -e \"console.log(require('crypto').randomBytes(32).toString('hex'))\""
|
||||
echo ""
|
||||
echo "========================================"
|
||||
4
scripts/pre-start.sh
Executable file
4
scripts/pre-start.sh
Executable file
@@ -0,0 +1,4 @@
|
||||
#!/bin/bash
|
||||
# Kill any existing SkyArtShop node processes before starting
|
||||
pkill -f "node.*SkyArtShop/backend/server.js" 2>/dev/null || true
|
||||
sleep 1
|
||||
42
scripts/quick-status.sh
Executable file
42
scripts/quick-status.sh
Executable file
@@ -0,0 +1,42 @@
|
||||
#!/bin/bash
|
||||
# Quick Server Status Check
|
||||
|
||||
echo "╔════════════════════════════════════════════════════════════╗"
|
||||
echo "║ SkyArtShop Server Quick Status ║"
|
||||
echo "╚════════════════════════════════════════════════════════════╝"
|
||||
echo ""
|
||||
|
||||
# Check if PM2 process is running
|
||||
if pm2 list | grep -q "skyartshop.*online"; then
|
||||
echo "✅ Server Status: ONLINE"
|
||||
|
||||
# Get uptime
|
||||
UPTIME=$(pm2 jlist | grep -A 20 "\"name\":\"skyartshop\"" | grep "pm_uptime" | cut -d':' -f2 | cut -d',' -f1)
|
||||
if [ ! -z "$UPTIME" ]; then
|
||||
SECONDS=$(($(date +%s) - $UPTIME / 1000))
|
||||
HOURS=$((SECONDS / 3600))
|
||||
MINUTES=$(((SECONDS % 3600) / 60))
|
||||
echo "⏱️ Uptime: ${HOURS}h ${MINUTES}m"
|
||||
fi
|
||||
|
||||
# Check if responding
|
||||
if curl -s -o /dev/null -w "%{http_code}" http://localhost:5000 | grep -q "200"; then
|
||||
echo "🌐 Website: Responding on http://localhost:5000"
|
||||
else
|
||||
echo "⚠️ Website: Not responding (check logs)"
|
||||
fi
|
||||
|
||||
else
|
||||
echo "❌ Server Status: OFFLINE"
|
||||
echo ""
|
||||
echo "Start the server with:"
|
||||
echo " ./manage-server.sh start"
|
||||
fi
|
||||
|
||||
echo ""
|
||||
echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"
|
||||
echo "Quick Commands:"
|
||||
echo " Status: ./manage-server.sh status"
|
||||
echo " Logs: ./manage-server.sh logs"
|
||||
echo " Restart: ./manage-server.sh restart"
|
||||
echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"
|
||||
49
scripts/setup-service.sh
Executable file
49
scripts/setup-service.sh
Executable file
@@ -0,0 +1,49 @@
|
||||
#!/bin/bash
|
||||
|
||||
# Setup SkyArtShop as a systemd service
|
||||
# This will make your server run automatically on boot and restart on crashes
|
||||
|
||||
echo "🚀 Setting up SkyArtShop as a system service..."
|
||||
|
||||
# Create log directory
|
||||
echo "📁 Creating log directory..."
|
||||
sudo mkdir -p /var/log/skyartshop
|
||||
sudo chown pts:pts /var/log/skyartshop
|
||||
|
||||
# Copy service file to systemd
|
||||
echo "📋 Installing service file..."
|
||||
sudo cp skyartshop.service /etc/systemd/system/
|
||||
|
||||
# Reload systemd to recognize new service
|
||||
echo "🔄 Reloading systemd..."
|
||||
sudo systemctl daemon-reload
|
||||
|
||||
# Enable service to start on boot
|
||||
echo "✅ Enabling service to start on boot..."
|
||||
sudo systemctl enable skyartshop
|
||||
|
||||
# Start the service
|
||||
echo "▶️ Starting service..."
|
||||
sudo systemctl start skyartshop
|
||||
|
||||
# Wait a moment for service to start
|
||||
sleep 2
|
||||
|
||||
# Check service status
|
||||
echo ""
|
||||
echo "📊 Service Status:"
|
||||
sudo systemctl status skyartshop --no-pager
|
||||
|
||||
echo ""
|
||||
echo "✨ Setup complete!"
|
||||
echo ""
|
||||
echo "📝 Useful commands:"
|
||||
echo " • Check status: sudo systemctl status skyartshop"
|
||||
echo " • Start service: sudo systemctl start skyartshop"
|
||||
echo " • Stop service: sudo systemctl stop skyartshop"
|
||||
echo " • Restart: sudo systemctl restart skyartshop"
|
||||
echo " • View logs: sudo journalctl -u skyartshop -f"
|
||||
echo " • View errors: tail -f /var/log/skyartshop/error.log"
|
||||
echo " • View output: tail -f /var/log/skyartshop/output.log"
|
||||
echo ""
|
||||
echo "🌐 Your server should now be running on http://localhost:5000"
|
||||
35
scripts/test-instant-changes.sh
Executable file
35
scripts/test-instant-changes.sh
Executable file
@@ -0,0 +1,35 @@
|
||||
#!/bin/bash
|
||||
|
||||
echo "🧪 Testing Instant Changes on Localhost:5000"
|
||||
echo "=============================================="
|
||||
echo ""
|
||||
echo "1. Making a test change to homepage..."
|
||||
|
||||
# Backup original
|
||||
cp /media/pts/Website/SkyArtShop/website/public/home.html /media/pts/Website/SkyArtShop/website/public/home.html.backup 2>/dev/null
|
||||
|
||||
# Add a test comment
|
||||
echo "<!-- Test change at $(date) -->" >> /media/pts/Website/SkyArtShop/website/public/home.html
|
||||
|
||||
echo "2. Waiting 1 second..."
|
||||
sleep 1
|
||||
|
||||
echo "3. Checking if change is visible..."
|
||||
if curl -s http://localhost:5000/home.html | grep "Test change" > /dev/null; then
|
||||
echo "✅ SUCCESS! Changes reflect immediately!"
|
||||
echo " Just refresh your browser to see any changes."
|
||||
else
|
||||
echo "❌ Change not detected. May need to restart PM2."
|
||||
fi
|
||||
|
||||
echo ""
|
||||
echo "4. Restoring original file..."
|
||||
mv /media/pts/Website/SkyArtShop/website/public/home.html.backup /media/pts/Website/SkyArtShop/website/public/home.html 2>/dev/null
|
||||
|
||||
echo ""
|
||||
echo "✅ Test complete!"
|
||||
echo ""
|
||||
echo "To make changes:"
|
||||
echo " 1. Edit any file in /media/pts/Website/SkyArtShop/website/"
|
||||
echo " 2. Refresh browser (F5)"
|
||||
echo " 3. See changes immediately!"
|
||||
96
scripts/verify-admin-fix.sh
Executable file
96
scripts/verify-admin-fix.sh
Executable file
@@ -0,0 +1,96 @@
|
||||
#!/bin/bash
|
||||
# Complete Admin Panel Fix Verification
|
||||
|
||||
echo "=========================================="
|
||||
echo " Admin Panel Fix Verification"
|
||||
echo "=========================================="
|
||||
|
||||
GREEN='\033[0;32m'
|
||||
RED='\033[0;31m'
|
||||
YELLOW='\033[1;33m'
|
||||
NC='\033[0m'
|
||||
|
||||
echo ""
|
||||
echo "1️⃣ Checking deployed files..."
|
||||
|
||||
# Check auth.js exists
|
||||
if [ -f "/var/www/skyartshop/admin/js/auth.js" ]; then
|
||||
echo -e "${GREEN}✓ auth.js is deployed${NC}"
|
||||
else
|
||||
echo -e "${RED}✗ auth.js is missing${NC}"
|
||||
fi
|
||||
|
||||
# Check that admin pages include auth.js
|
||||
PAGES=("dashboard.html" "products.html" "homepage.html" "blog.html")
|
||||
for page in "${PAGES[@]}"; do
|
||||
if grep -q "auth\.js" "/var/www/skyartshop/admin/$page"; then
|
||||
echo -e "${GREEN}✓ $page includes auth.js${NC}"
|
||||
else
|
||||
echo -e "${RED}✗ $page missing auth.js${NC}"
|
||||
fi
|
||||
done
|
||||
|
||||
echo ""
|
||||
echo "2️⃣ Testing HTTP accessibility..."
|
||||
|
||||
# Test auth.js is accessible
|
||||
STATUS=$(curl -s -o /dev/null -w "%{http_code}" http://localhost:5000/admin/js/auth.js)
|
||||
if [ "$STATUS" == "200" ]; then
|
||||
echo -e "${GREEN}✓ auth.js accessible via HTTP${NC}"
|
||||
else
|
||||
echo -e "${RED}✗ auth.js not accessible (HTTP $STATUS)${NC}"
|
||||
fi
|
||||
|
||||
# Test admin pages are accessible
|
||||
for page in "${PAGES[@]}"; do
|
||||
STATUS=$(curl -s -o /dev/null -w "%{http_code}" "http://localhost:5000/admin/$page")
|
||||
if [ "$STATUS" == "200" ] || [ "$STATUS" == "304" ]; then
|
||||
echo -e "${GREEN}✓ $page accessible${NC}"
|
||||
else
|
||||
echo -e "${RED}✗ $page not accessible (HTTP $STATUS)${NC}"
|
||||
fi
|
||||
done
|
||||
|
||||
echo ""
|
||||
echo "3️⃣ Testing API endpoints..."
|
||||
|
||||
# Test session endpoint
|
||||
STATUS=$(curl -s -o /dev/null -w "%{http_code}" http://localhost:5000/api/admin/session)
|
||||
if [ "$STATUS" == "401" ] || [ "$STATUS" == "200" ]; then
|
||||
echo -e "${GREEN}✓ Session API working (HTTP $STATUS)${NC}"
|
||||
else
|
||||
echo -e "${RED}✗ Session API issue (HTTP $STATUS)${NC}"
|
||||
fi
|
||||
|
||||
echo ""
|
||||
echo "=========================================="
|
||||
echo " ✅ Verification Complete!"
|
||||
echo "=========================================="
|
||||
echo ""
|
||||
echo -e "${YELLOW}⚠️ IMPORTANT: Clear Your Browser Cache!${NC}"
|
||||
echo ""
|
||||
echo "Choose your browser:"
|
||||
echo ""
|
||||
echo "🌐 Chrome/Edge:"
|
||||
echo " 1. Press Ctrl+Shift+Delete"
|
||||
echo " 2. Select 'All time'"
|
||||
echo " 3. Check 'Cached images and files'"
|
||||
echo " 4. Click 'Clear data'"
|
||||
echo ""
|
||||
echo "🦊 Firefox:"
|
||||
echo " 1. Press Ctrl+Shift+Delete"
|
||||
echo " 2. Time range: 'Everything'"
|
||||
echo " 3. Check 'Cache'"
|
||||
echo " 4. Click 'Clear Now'"
|
||||
echo ""
|
||||
echo "Or use incognito/private browsing mode:"
|
||||
echo " Chrome/Edge: Ctrl+Shift+N"
|
||||
echo " Firefox: Ctrl+Shift+P"
|
||||
echo ""
|
||||
echo "Then test:"
|
||||
echo " 1. Go to: http://localhost:5000/admin/login.html"
|
||||
echo " 2. Login with your credentials"
|
||||
echo " 3. Click on different sections in left panel"
|
||||
echo " 4. Click on live tiles in dashboard"
|
||||
echo " 5. You should stay logged in!"
|
||||
echo ""
|
||||
69
scripts/verify-localhost.sh
Executable file
69
scripts/verify-localhost.sh
Executable file
@@ -0,0 +1,69 @@
|
||||
#!/bin/bash
|
||||
|
||||
echo "╔══════════════════════════════════════════════════╗"
|
||||
echo "║ Localhost Verification - Sky Art Shop ║"
|
||||
echo "╚══════════════════════════════════════════════════╝"
|
||||
echo ""
|
||||
|
||||
echo "🔍 Checking Active Ports..."
|
||||
echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"
|
||||
|
||||
# Check port 80
|
||||
if curl -s http://localhost/ >/dev/null 2>&1; then
|
||||
echo "❌ Port 80 (http://localhost/) - ACTIVE (Should be disabled!)"
|
||||
echo " Run: sudo systemctl stop nginx apache2"
|
||||
else
|
||||
echo "✅ Port 80 (http://localhost/) - Not accessible (Correct!)"
|
||||
fi
|
||||
|
||||
# Check port 5000
|
||||
if curl -s http://localhost:5000/ >/dev/null 2>&1; then
|
||||
echo "✅ Port 5000 (http://localhost:5000/) - ACTIVE (Correct!)"
|
||||
TITLE=$(curl -s http://localhost:5000/ | grep -o "<title>[^<]*</title>" | head -1)
|
||||
echo " Serving: $TITLE"
|
||||
else
|
||||
echo "❌ Port 5000 (http://localhost:5000/) - Not accessible (Should be running!)"
|
||||
fi
|
||||
|
||||
echo ""
|
||||
echo "🌐 Web Servers Status..."
|
||||
echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"
|
||||
|
||||
# Check nginx
|
||||
if systemctl is-active --quiet nginx; then
|
||||
echo "⚠️ Nginx: RUNNING (Should be stopped for development)"
|
||||
else
|
||||
echo "✅ Nginx: Stopped"
|
||||
fi
|
||||
|
||||
# Check apache
|
||||
if systemctl is-active --quiet apache2; then
|
||||
echo "⚠️ Apache: RUNNING (Should be stopped)"
|
||||
else
|
||||
echo "✅ Apache: Stopped"
|
||||
fi
|
||||
|
||||
# Check PM2
|
||||
if pm2 list | grep -q "skyartshop.*online"; then
|
||||
echo "✅ PM2 Backend: Running"
|
||||
else
|
||||
echo "❌ PM2 Backend: Not running"
|
||||
fi
|
||||
|
||||
echo ""
|
||||
echo "📊 Summary:"
|
||||
echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"
|
||||
|
||||
# Count active ports
|
||||
ACTIVE_PORTS=$(ss -tln | grep -E ":80 |:443 |:5000 " | wc -l)
|
||||
|
||||
if [ "$ACTIVE_PORTS" -eq 1 ]; then
|
||||
echo "✅ Perfect! Only 1 web port active (port 5000)"
|
||||
echo " Your site: http://localhost:5000"
|
||||
else
|
||||
echo "⚠️ Multiple web ports detected: $ACTIVE_PORTS"
|
||||
echo " Active ports:"
|
||||
ss -tln | grep -E ":80 |:443 |:5000 "
|
||||
fi
|
||||
|
||||
echo ""
|
||||
Reference in New Issue
Block a user