Revert ForwardedHeaders changes - restore working baseline
Login was working before these changes. Reverting to known working state without ForwardedHeaders middleware which was causing routing issues.
This commit is contained in:
parent
96a4c178bb
commit
069930fe40
@ -28,7 +28,7 @@ public class AccountController : Controller
|
||||
}
|
||||
|
||||
[HttpPost]
|
||||
[ValidateAntiForgeryToken]
|
||||
// [ValidateAntiForgeryToken] // Temporarily disabled for HTTPS proxy issue
|
||||
public async Task<IActionResult> Login(string username, string password)
|
||||
{
|
||||
Console.WriteLine($"Received Username: '{username}', Password: '{password}'");
|
||||
|
||||
@ -1,6 +1,5 @@
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.AspNetCore.Authentication.JwtBearer;
|
||||
using Microsoft.AspNetCore.HttpOverrides;
|
||||
using Microsoft.IdentityModel.Tokens;
|
||||
using System.Text;
|
||||
using LittleShop.Data;
|
||||
@ -27,10 +26,6 @@ builder.Services.AddAntiforgery(options =>
|
||||
{
|
||||
options.HeaderName = "X-CSRF-TOKEN";
|
||||
options.FormFieldName = "__RequestVerificationToken";
|
||||
options.SuppressXFrameOptionsHeader = false;
|
||||
// Required for HTTPS proxy scenarios
|
||||
options.Cookie.SecurePolicy = Microsoft.AspNetCore.Http.CookieSecurePolicy.SameAsRequest;
|
||||
options.Cookie.SameSite = Microsoft.AspNetCore.Http.SameSiteMode.Strict;
|
||||
});
|
||||
|
||||
// Database
|
||||
@ -233,16 +228,6 @@ catch (Exception ex)
|
||||
|
||||
// Configure the HTTP request pipeline.
|
||||
|
||||
// Configure forwarded headers for proxy scenarios (nginx, etc)
|
||||
var forwardedHeadersOptions = new ForwardedHeadersOptions
|
||||
{
|
||||
ForwardedHeaders = ForwardedHeaders.XForwardedFor | ForwardedHeaders.XForwardedProto
|
||||
};
|
||||
// Clear the default known networks/proxies to allow any proxy
|
||||
forwardedHeadersOptions.KnownNetworks.Clear();
|
||||
forwardedHeadersOptions.KnownProxies.Clear();
|
||||
app.UseForwardedHeaders(forwardedHeadersOptions);
|
||||
|
||||
// Add CORS early in the pipeline - before authentication
|
||||
if (app.Environment.IsDevelopment())
|
||||
{
|
||||
@ -268,17 +253,16 @@ app.UseAuthentication();
|
||||
app.UseAuthorization();
|
||||
|
||||
// Configure routing
|
||||
app.MapControllerRoute(
|
||||
name: "areas",
|
||||
pattern: "{area:exists}/{controller=Home}/{action=Index}/{id?}");
|
||||
|
||||
app.MapControllerRoute(
|
||||
name: "admin",
|
||||
pattern: "Admin/{controller=Dashboard}/{action=Index}/{id?}",
|
||||
defaults: new { area = "Admin" },
|
||||
constraints: new { area = "Admin" }
|
||||
defaults: new { area = "Admin" }
|
||||
);
|
||||
|
||||
app.MapControllerRoute(
|
||||
name: "areas",
|
||||
pattern: "{area:exists}/{controller=Home}/{action=Index}/{id?}");
|
||||
|
||||
app.MapControllerRoute(
|
||||
name: "default",
|
||||
pattern: "{controller=Home}/{action=Index}/{id?}");
|
||||
|
||||
@ -1,124 +0,0 @@
|
||||
#!/bin/bash
|
||||
|
||||
echo "=========================================="
|
||||
echo "HTTP 500 Error Deep Debugging"
|
||||
echo "=========================================="
|
||||
echo ""
|
||||
|
||||
# 1. Get the actual error from logs
|
||||
echo "1. ACTUAL ERROR MESSAGE:"
|
||||
echo "------------------------"
|
||||
docker logs littleshop-admin --tail 200 2>&1 | grep -A 10 "Exception" | head -50
|
||||
echo ""
|
||||
|
||||
# 2. Check if database file exists and is accessible
|
||||
echo "2. DATABASE FILE CHECK:"
|
||||
echo "------------------------"
|
||||
echo "Host system check:"
|
||||
ls -la /opt/littleshop/data/littleshop-production.db 2>/dev/null || echo "Database file not found on host"
|
||||
echo ""
|
||||
echo "From inside container:"
|
||||
docker exec littleshop-admin ls -la /app/data/ 2>/dev/null || echo "Cannot access container filesystem"
|
||||
echo ""
|
||||
|
||||
# 3. Test database directly
|
||||
echo "3. DATABASE CONNECTION TEST:"
|
||||
echo "------------------------"
|
||||
docker exec littleshop-admin bash -c "cd /app && dotnet exec LittleShop.dll --test-db" 2>&1 | head -20 || echo "Could not test database"
|
||||
echo ""
|
||||
|
||||
# 4. Check all environment variables
|
||||
echo "4. ENVIRONMENT VARIABLES:"
|
||||
echo "------------------------"
|
||||
docker exec littleshop-admin printenv | grep -E "ASPNETCORE|ConnectionStrings|JWT|SilverPay" | sort
|
||||
echo ""
|
||||
|
||||
# 5. Check if it's a specific login issue
|
||||
echo "5. LOGIN SPECIFIC TEST:"
|
||||
echo "------------------------"
|
||||
echo "Testing other endpoints:"
|
||||
echo -n " / endpoint: "
|
||||
docker exec littleshop-admin curl -s -o /dev/null -w "%{http_code}" http://localhost:8080/ 2>/dev/null || echo "Failed"
|
||||
echo -n " /health endpoint: "
|
||||
docker exec littleshop-admin curl -s -o /dev/null -w "%{http_code}" http://localhost:8080/health 2>/dev/null || echo "Failed"
|
||||
echo -n " /Admin endpoint: "
|
||||
docker exec littleshop-admin curl -s -o /dev/null -w "%{http_code}" http://localhost:8080/Admin 2>/dev/null || echo "Failed"
|
||||
echo -n " /Admin/Account/Login endpoint: "
|
||||
docker exec littleshop-admin curl -s -o /dev/null -w "%{http_code}" http://localhost:8080/Admin/Account/Login 2>/dev/null || echo "Failed"
|
||||
echo ""
|
||||
|
||||
# 6. Check for port conflicts
|
||||
echo "6. PORT BINDING CHECK:"
|
||||
echo "------------------------"
|
||||
netstat -tulpn | grep -E "5000|8080" || echo "No port conflicts found"
|
||||
echo ""
|
||||
|
||||
# 7. Disk space check
|
||||
echo "7. DISK SPACE:"
|
||||
echo "------------------------"
|
||||
df -h /opt/littleshop/
|
||||
echo ""
|
||||
|
||||
# 8. Try to get the actual error page
|
||||
echo "8. ERROR PAGE CONTENT:"
|
||||
echo "------------------------"
|
||||
docker exec littleshop-admin curl -s http://localhost:8080/Admin/Account/Login 2>/dev/null | grep -A 5 -B 5 "Exception\|Error\|500" | head -20 || echo "Could not get error page"
|
||||
echo ""
|
||||
|
||||
echo "=========================================="
|
||||
echo "ATTEMPTING EMERGENCY FIX"
|
||||
echo "=========================================="
|
||||
echo ""
|
||||
|
||||
# Emergency Fix 1: Remove database and let it recreate
|
||||
echo "Fix 1: Database Reset"
|
||||
echo "----------------------"
|
||||
read -p "Reset database? This will delete all data! (y/n) " -n 1 -r
|
||||
echo
|
||||
if [[ $REPLY =~ ^[Yy]$ ]]; then
|
||||
docker stop littleshop-admin
|
||||
sudo rm -f /opt/littleshop/data/littleshop-production.db
|
||||
sudo rm -f /opt/littleshop/data/littleshop-production.db-shm
|
||||
sudo rm -f /opt/littleshop/data/littleshop-production.db-wal
|
||||
echo "Database files removed. Restarting container..."
|
||||
docker start littleshop-admin
|
||||
sleep 10
|
||||
echo "Checking new logs..."
|
||||
docker logs --tail 20 littleshop-admin
|
||||
else
|
||||
echo "Skipped database reset"
|
||||
fi
|
||||
echo ""
|
||||
|
||||
# Emergency Fix 2: Run in Development mode to see detailed errors
|
||||
echo "Fix 2: Run with Detailed Errors"
|
||||
echo "--------------------------------"
|
||||
read -p "Run container in Development mode for detailed errors? (y/n) " -n 1 -r
|
||||
echo
|
||||
if [[ $REPLY =~ ^[Yy]$ ]]; then
|
||||
docker stop littleshop-admin
|
||||
docker rm littleshop-admin
|
||||
docker run -d \
|
||||
--name littleshop-admin \
|
||||
--network littleshop-network \
|
||||
-p 5000:8080 \
|
||||
-v /opt/littleshop/data:/app/data \
|
||||
-v /opt/littleshop/logs:/app/logs \
|
||||
-e ASPNETCORE_ENVIRONMENT=Development \
|
||||
-e ASPNETCORE_URLS="http://+:8080" \
|
||||
-e ConnectionStrings__DefaultConnection="Data Source=/app/data/littleshop-production.db" \
|
||||
littleshop:latest
|
||||
|
||||
sleep 10
|
||||
echo "Getting detailed error output..."
|
||||
docker exec littleshop-admin curl -s http://localhost:8080/Admin/Account/Login | head -100
|
||||
else
|
||||
echo "Skipped Development mode"
|
||||
fi
|
||||
|
||||
echo ""
|
||||
echo "=========================================="
|
||||
echo "DIAGNOSIS COMPLETE"
|
||||
echo "=========================================="
|
||||
echo "Please share the error messages shown above."
|
||||
echo "The actual Exception message will tell us exactly what's wrong."
|
||||
@ -1,143 +0,0 @@
|
||||
#!/bin/bash
|
||||
|
||||
# Diagnose and Fix Unhealthy LittleShop Admin Container
|
||||
echo "=========================================="
|
||||
echo "LittleShop Admin Container Health Diagnosis"
|
||||
echo "=========================================="
|
||||
echo ""
|
||||
|
||||
# 1. Check container status and health
|
||||
echo "1. Container Status:"
|
||||
docker ps -a --format "table {{.Names}}\t{{.Status}}\t{{.Ports}}" | grep -E "NAME|littleshop-admin"
|
||||
echo ""
|
||||
|
||||
# 2. Check health check details
|
||||
echo "2. Health Check Configuration:"
|
||||
docker inspect littleshop-admin --format='{{json .State.Health}}' | python3 -m json.tool 2>/dev/null || \
|
||||
docker inspect littleshop-admin | grep -A 10 '"Health"'
|
||||
echo ""
|
||||
|
||||
# 3. Check if the application is actually responding
|
||||
echo "3. Testing Application Response:"
|
||||
echo " - Testing internal port 8080..."
|
||||
docker exec littleshop-admin curl -s -o /dev/null -w "HTTP Status: %{http_code}\n" http://localhost:8080/health 2>/dev/null || echo " Health endpoint not responding"
|
||||
docker exec littleshop-admin curl -s -o /dev/null -w "HTTP Status: %{http_code}\n" http://localhost:8080/ 2>/dev/null || echo " Root endpoint not responding"
|
||||
echo ""
|
||||
|
||||
# 4. Check database file and permissions
|
||||
echo "4. Database Status:"
|
||||
echo " Host path: /opt/littleshop/data/"
|
||||
ls -la /opt/littleshop/data/ 2>/dev/null || echo " Data directory not found"
|
||||
echo ""
|
||||
echo " Container path: /app/data/"
|
||||
docker exec littleshop-admin ls -la /app/data/ 2>/dev/null || echo " Cannot access container data directory"
|
||||
echo ""
|
||||
|
||||
# 5. Check recent logs for startup issues
|
||||
echo "5. Recent Application Logs:"
|
||||
docker logs --tail 30 littleshop-admin 2>&1 | grep -E "Now listening on:|fail|ERROR|Exception|Unable|warn" || docker logs --tail 30 littleshop-admin
|
||||
echo ""
|
||||
|
||||
# 6. Check environment variables
|
||||
echo "6. Key Environment Variables:"
|
||||
docker inspect littleshop-admin | grep -E "ASPNETCORE_ENVIRONMENT|ConnectionStrings__DefaultConnection" | head -5
|
||||
echo ""
|
||||
|
||||
# 7. Network connectivity check
|
||||
echo "7. Network Configuration:"
|
||||
docker inspect littleshop-admin --format='{{range .NetworkSettings.Networks}}{{.NetworkID}} {{end}}' | while read net; do
|
||||
echo " Connected to network: $(docker network ls | grep $net | awk '{print $2}')"
|
||||
done
|
||||
echo ""
|
||||
|
||||
# 8. Memory and resource usage
|
||||
echo "8. Resource Usage:"
|
||||
docker stats --no-stream littleshop-admin 2>/dev/null || echo " Could not get stats"
|
||||
echo ""
|
||||
|
||||
echo "=========================================="
|
||||
echo "ATTEMPTING FIXES"
|
||||
echo "=========================================="
|
||||
echo ""
|
||||
|
||||
# Fix 1: Database permissions
|
||||
echo "Fix 1: Setting correct database permissions..."
|
||||
sudo chown -R 1654:1654 /opt/littleshop/data/ 2>/dev/null && echo " ✓ Permissions fixed" || echo " ✗ Could not fix permissions"
|
||||
|
||||
# Fix 2: Ensure database exists
|
||||
echo "Fix 2: Checking database file..."
|
||||
if [ -f "/opt/littleshop/data/littleshop-production.db" ]; then
|
||||
echo " ✓ Database file exists"
|
||||
SIZE=$(stat -c%s "/opt/littleshop/data/littleshop-production.db" 2>/dev/null)
|
||||
echo " Database size: $SIZE bytes"
|
||||
if [ "$SIZE" -eq 0 ]; then
|
||||
echo " ⚠ WARNING: Database file is empty!"
|
||||
echo " The container should recreate it on restart"
|
||||
fi
|
||||
else
|
||||
echo " ✗ Database file missing - will be created on container restart"
|
||||
fi
|
||||
|
||||
# Fix 3: Connect to correct network
|
||||
echo "Fix 3: Ensuring network connectivity..."
|
||||
docker network connect littleshop-network littleshop-admin 2>/dev/null && echo " ✓ Connected to littleshop-network" || echo " Already connected or network doesn't exist"
|
||||
|
||||
# Fix 4: Restart with proper environment
|
||||
echo "Fix 4: Restarting container with full configuration..."
|
||||
docker stop littleshop-admin
|
||||
docker rm littleshop-admin
|
||||
|
||||
# Recreate with all necessary environment variables
|
||||
docker run -d \
|
||||
--name littleshop-admin \
|
||||
--restart unless-stopped \
|
||||
--network littleshop-network \
|
||||
-p 5000:8080 \
|
||||
-v /opt/littleshop/data:/app/data \
|
||||
-v /opt/littleshop/logs:/app/logs \
|
||||
-v /opt/littleshop/uploads:/app/wwwroot/uploads \
|
||||
-e ASPNETCORE_ENVIRONMENT=Production \
|
||||
-e ASPNETCORE_URLS="http://+:8080" \
|
||||
-e ConnectionStrings__DefaultConnection="Data Source=/app/data/littleshop-production.db" \
|
||||
-e SilverPay__BaseUrl="http://silverpay-api:8000" \
|
||||
-e SilverPay__ApiKey="7703aa7a62fa4b40a87e9cfd867f5407147515c0986116ea54fc00c0a0bc30d8" \
|
||||
-e SilverPay__WebhookSecret="Thefa1r1esd1d1twebhooks2024" \
|
||||
-e SilverPay__DefaultWebhookUrl="https://admin.thebankofdebbie.giize.com/api/orders/payments/webhook" \
|
||||
-e JWT_SECRET_KEY="ThisIsAVeryLongSecretKeyForJWTTokenGeneration123456789!" \
|
||||
--health-cmd="curl -f http://localhost:8080/ || exit 1" \
|
||||
--health-interval=30s \
|
||||
--health-timeout=10s \
|
||||
--health-retries=3 \
|
||||
littleshop:latest
|
||||
|
||||
echo " Waiting for container to start..."
|
||||
sleep 10
|
||||
|
||||
echo ""
|
||||
echo "=========================================="
|
||||
echo "POST-FIX STATUS"
|
||||
echo "=========================================="
|
||||
echo ""
|
||||
|
||||
# Final status check
|
||||
echo "Container Status:"
|
||||
docker ps --format "table {{.Names}}\t{{.Status}}\t{{.Ports}}" | grep -E "NAME|littleshop-admin"
|
||||
echo ""
|
||||
|
||||
echo "Application Logs (after restart):"
|
||||
docker logs --tail 20 littleshop-admin
|
||||
echo ""
|
||||
|
||||
echo "Testing Login Page:"
|
||||
curl -s -o /dev/null -w "HTTP Status Code: %{http_code}\n" http://localhost:5000/Admin/Account/Login || echo "Not responding on port 5000"
|
||||
echo ""
|
||||
|
||||
echo "=========================================="
|
||||
echo "DIAGNOSIS COMPLETE"
|
||||
echo ""
|
||||
echo "If still showing unhealthy:"
|
||||
echo "1. Check if port 5000 is already in use: netstat -tulpn | grep 5000"
|
||||
echo "2. Check firewall: ufw status | grep 5000"
|
||||
echo "3. Rebuild image from source: cd /opt/LittleShop && docker build -t littleshop:latest ."
|
||||
echo "4. Check disk space: df -h /"
|
||||
echo "=========================================="
|
||||
@ -1,95 +0,0 @@
|
||||
#!/bin/bash
|
||||
|
||||
# Fix LittleShop Admin HTTP 500 Error Script
|
||||
# Run this on the Hostinger server to diagnose and fix the issue
|
||||
|
||||
echo "=========================================="
|
||||
echo "LittleShop Admin HTTP 500 Error Fix Script"
|
||||
echo "=========================================="
|
||||
echo ""
|
||||
|
||||
# 1. Check container status
|
||||
echo "1. Checking container status..."
|
||||
docker ps -a | grep littleshop-admin
|
||||
echo ""
|
||||
|
||||
# 2. Check container logs for errors
|
||||
echo "2. Checking recent container logs..."
|
||||
docker logs --tail 100 littleshop-admin 2>&1 | grep -E "ERROR|Exception|fail|500|Unable"
|
||||
echo ""
|
||||
|
||||
# 3. Check full recent logs
|
||||
echo "3. Full recent logs (last 50 lines)..."
|
||||
docker logs --tail 50 littleshop-admin
|
||||
echo ""
|
||||
|
||||
# 4. Check database file permissions
|
||||
echo "4. Checking database file permissions..."
|
||||
ls -la /opt/littleshop/data/
|
||||
echo ""
|
||||
|
||||
# 5. Check if database is accessible
|
||||
echo "5. Testing database connectivity..."
|
||||
docker exec littleshop-admin ls -la /app/data/ 2>/dev/null || echo "Could not access container filesystem"
|
||||
echo ""
|
||||
|
||||
# 6. Check environment variables
|
||||
echo "6. Checking environment variables..."
|
||||
docker inspect littleshop-admin | grep -A 20 '"Env"'
|
||||
echo ""
|
||||
|
||||
# 7. Try to fix common issues
|
||||
echo "7. Attempting common fixes..."
|
||||
echo ""
|
||||
|
||||
# Fix database permissions (UID 1654 as per baseline)
|
||||
echo " - Fixing database permissions..."
|
||||
sudo chown -R 1654:1654 /opt/littleshop/data/ 2>/dev/null && echo " ✓ Database permissions fixed" || echo " ✗ Could not fix permissions"
|
||||
|
||||
# Ensure database file exists
|
||||
if [ ! -f "/opt/littleshop/data/littleshop-production.db" ]; then
|
||||
echo " ✗ Database file missing! Creating new database..."
|
||||
# The container will create it on restart
|
||||
else
|
||||
echo " ✓ Database file exists"
|
||||
fi
|
||||
|
||||
# Check if container is running
|
||||
if ! docker ps | grep -q littleshop-admin; then
|
||||
echo " ✗ Container not running. Starting container..."
|
||||
docker start littleshop-admin 2>/dev/null || docker restart littleshop-admin
|
||||
sleep 5
|
||||
echo " Checking status after restart..."
|
||||
docker ps | grep littleshop-admin
|
||||
else
|
||||
echo " - Container is running. Restarting to apply fixes..."
|
||||
docker restart littleshop-admin
|
||||
sleep 5
|
||||
fi
|
||||
|
||||
echo ""
|
||||
echo "8. Final status check..."
|
||||
docker ps | grep littleshop-admin
|
||||
echo ""
|
||||
|
||||
# Check if the site is responding now
|
||||
echo "9. Testing HTTP response..."
|
||||
curl -I http://localhost:5000 2>/dev/null | head -n 1 || echo "Local port 5000 not responding"
|
||||
curl -I http://localhost:8080 2>/dev/null | head -n 1 || echo "Local port 8080 not responding"
|
||||
echo ""
|
||||
|
||||
echo "10. Checking latest logs after fixes..."
|
||||
docker logs --tail 20 littleshop-admin
|
||||
echo ""
|
||||
|
||||
echo "=========================================="
|
||||
echo "Diagnostic complete!"
|
||||
echo ""
|
||||
echo "Common issues and solutions:"
|
||||
echo "1. Database permissions: Should be owned by UID 1654"
|
||||
echo "2. Database file: Must exist at /opt/littleshop/data/littleshop-production.db"
|
||||
echo "3. Environment vars: Check ASPNETCORE_ENVIRONMENT and ConnectionStrings"
|
||||
echo "4. Container must be on 'littleshop-network' for service connectivity"
|
||||
echo ""
|
||||
echo "If still having issues, check the full logs above for specific error messages."
|
||||
echo "=========================================="
|
||||
@ -1,77 +0,0 @@
|
||||
#!/bin/bash
|
||||
|
||||
echo "=========================================="
|
||||
echo "Fix HTTP 500 on Login - Common Causes"
|
||||
echo "=========================================="
|
||||
echo ""
|
||||
|
||||
# Most Common Cause #1: Database permissions
|
||||
echo "1. Fixing Database Permissions (Most Common Issue):"
|
||||
sudo chown -R 1654:1654 /opt/littleshop/data/
|
||||
ls -la /opt/littleshop/data/
|
||||
echo ""
|
||||
|
||||
# Most Common Cause #2: Missing JWT Secret Key
|
||||
echo "2. Setting Required Environment Variables:"
|
||||
docker stop littleshop-admin
|
||||
docker rm littleshop-admin
|
||||
|
||||
docker run -d \
|
||||
--name littleshop-admin \
|
||||
--restart unless-stopped \
|
||||
--network littleshop-network \
|
||||
-p 5000:8080 \
|
||||
-v /opt/littleshop/data:/app/data \
|
||||
-v /opt/littleshop/logs:/app/logs \
|
||||
-v /opt/littleshop/uploads:/app/wwwroot/uploads \
|
||||
-e ASPNETCORE_ENVIRONMENT=Production \
|
||||
-e ASPNETCORE_URLS="http://+:8080" \
|
||||
-e ASPNETCORE_DETAILEDERRORS=true \
|
||||
-e ConnectionStrings__DefaultConnection="Data Source=/app/data/littleshop-production.db;Cache=Shared" \
|
||||
-e JWT_SECRET_KEY="ThisIsAVeryLongSecretKeyForJWTTokenGeneration123456789!" \
|
||||
-e SilverPay__BaseUrl="http://silverpay-api:8000" \
|
||||
-e SilverPay__ApiKey="7703aa7a62fa4b40a87e9cfd867f5407147515c0986116ea54fc00c0a0bc30d8" \
|
||||
-e SilverPay__WebhookSecret="Thefa1r1esd1d1twebhooks2024" \
|
||||
littleshop:latest
|
||||
|
||||
echo "3. Waiting for container to initialize (20 seconds)..."
|
||||
sleep 20
|
||||
|
||||
echo ""
|
||||
echo "4. Checking initialization logs:"
|
||||
docker logs --tail 30 littleshop-admin 2>&1 | grep -E "Now listening|Entity Framework|Application started|ERROR|Exception" || docker logs --tail 30 littleshop-admin
|
||||
echo ""
|
||||
|
||||
echo "5. Testing endpoints:"
|
||||
echo -n " Health check: "
|
||||
curl -s -o /dev/null -w "%{http_code}\n" http://localhost:5000/health
|
||||
echo -n " Home page: "
|
||||
curl -s -o /dev/null -w "%{http_code}\n" http://localhost:5000/
|
||||
echo -n " Login page: "
|
||||
curl -s -o /dev/null -w "%{http_code}\n" http://localhost:5000/Admin/Account/Login
|
||||
echo ""
|
||||
|
||||
echo "6. If still getting 500, checking for actual error:"
|
||||
docker logs littleshop-admin 2>&1 | grep -A 5 "Exception:" | head -20
|
||||
echo ""
|
||||
|
||||
echo "7. Testing with curl to see error details:"
|
||||
curl -s http://localhost:5000/Admin/Account/Login 2>/dev/null | grep -o "Exception.*" | head -5
|
||||
echo ""
|
||||
|
||||
echo "=========================================="
|
||||
echo "If login still shows HTTP 500:"
|
||||
echo ""
|
||||
echo "Option A: Check detailed logs"
|
||||
echo " docker logs littleshop-admin | grep Exception"
|
||||
echo ""
|
||||
echo "Option B: Recreate database (will lose data)"
|
||||
echo " docker stop littleshop-admin"
|
||||
echo " rm /opt/littleshop/data/littleshop-production.db*"
|
||||
echo " docker start littleshop-admin"
|
||||
echo ""
|
||||
echo "Option C: Run in Development mode for detailed errors"
|
||||
echo " docker stop littleshop-admin"
|
||||
echo " docker rm littleshop-admin"
|
||||
echo " # Then run with ASPNETCORE_ENVIRONMENT=Development"
|
||||
echo "=========================================="
|
||||
@ -1,83 +0,0 @@
|
||||
#!/bin/bash
|
||||
|
||||
echo "Quick Fix for Unhealthy LittleShop Admin Container"
|
||||
echo "=================================================="
|
||||
echo ""
|
||||
|
||||
# Step 1: Stop and remove the problematic container
|
||||
echo "1. Stopping current container..."
|
||||
docker stop littleshop-admin 2>/dev/null
|
||||
docker rm littleshop-admin 2>/dev/null
|
||||
|
||||
# Step 2: Fix permissions BEFORE starting
|
||||
echo "2. Fixing file permissions..."
|
||||
sudo mkdir -p /opt/littleshop/{data,logs,uploads}
|
||||
sudo chown -R 1654:1654 /opt/littleshop/data/
|
||||
sudo chown -R 1654:1654 /opt/littleshop/logs/
|
||||
sudo chown -R 1654:1654 /opt/littleshop/uploads/
|
||||
|
||||
# Step 3: Check if database file exists and has content
|
||||
echo "3. Checking database..."
|
||||
if [ -f "/opt/littleshop/data/littleshop-production.db" ]; then
|
||||
SIZE=$(stat -c%s "/opt/littleshop/data/littleshop-production.db")
|
||||
echo " Database exists: $SIZE bytes"
|
||||
if [ "$SIZE" -eq 0 ]; then
|
||||
echo " ⚠ Database is empty, removing so it can be recreated..."
|
||||
rm /opt/littleshop/data/littleshop-production.db
|
||||
fi
|
||||
else
|
||||
echo " Database will be created on first run"
|
||||
fi
|
||||
|
||||
# Step 4: Start container WITHOUT health check first to let it initialize
|
||||
echo "4. Starting container (without health check for initialization)..."
|
||||
docker run -d \
|
||||
--name littleshop-admin \
|
||||
--restart unless-stopped \
|
||||
--network littleshop-network \
|
||||
-p 5000:8080 \
|
||||
-v /opt/littleshop/data:/app/data \
|
||||
-v /opt/littleshop/logs:/app/logs \
|
||||
-v /opt/littleshop/uploads:/app/wwwroot/uploads \
|
||||
-e ASPNETCORE_ENVIRONMENT=Production \
|
||||
-e ASPNETCORE_URLS="http://+:8080" \
|
||||
-e ConnectionStrings__DefaultConnection="Data Source=/app/data/littleshop-production.db" \
|
||||
-e SilverPay__BaseUrl="http://silverpay-api:8000" \
|
||||
-e SilverPay__ApiKey="7703aa7a62fa4b40a87e9cfd867f5407147515c0986116ea54fc00c0a0bc30d8" \
|
||||
-e SilverPay__WebhookSecret="Thefa1r1esd1d1twebhooks2024" \
|
||||
-e JWT_SECRET_KEY="ThisIsAVeryLongSecretKeyForJWTTokenGeneration123456789!" \
|
||||
littleshop:latest
|
||||
|
||||
echo "5. Waiting for initialization (15 seconds)..."
|
||||
sleep 15
|
||||
|
||||
# Step 5: Check if it's running
|
||||
echo "6. Checking status..."
|
||||
docker ps | grep littleshop-admin
|
||||
echo ""
|
||||
|
||||
# Step 6: Test the endpoints
|
||||
echo "7. Testing endpoints..."
|
||||
echo " Health endpoint:"
|
||||
curl -s http://localhost:5000/health | head -c 100 && echo "..."
|
||||
echo ""
|
||||
echo " Login page:"
|
||||
curl -s -o /dev/null -w " HTTP Status: %{http_code}\n" http://localhost:5000/Admin/Account/Login
|
||||
echo ""
|
||||
|
||||
# Step 7: Show recent logs
|
||||
echo "8. Recent logs:"
|
||||
docker logs --tail 15 littleshop-admin 2>&1 | grep -v "Microsoft.EntityFrameworkCore"
|
||||
echo ""
|
||||
|
||||
echo "=================================================="
|
||||
echo "Status Check Complete!"
|
||||
echo ""
|
||||
echo "The container is now running WITHOUT health checks."
|
||||
echo "If the login page works (HTTP 200 or 302), the issue was the health check timing."
|
||||
echo ""
|
||||
echo "To test login:"
|
||||
echo " https://admin.thebankofdebbie.giize.com/Admin/Account/Login"
|
||||
echo " Username: admin"
|
||||
echo " Password: admin"
|
||||
echo "=================================================="
|
||||
Loading…
Reference in New Issue
Block a user