64c0a58f78
Test and Lint / backend-test (push) Successful in 1m19s
Test and Lint / frontend-test (push) Successful in 2m20s
continuous-integration/drone/push Build is passing
Version and Release / version-bump (push) Successful in 38s
Version and Release / trigger-drone (push) Successful in 3s
- Add migration to fix email_templates column structure after language migration - Add migration to ensure default email templates exist - Create diagnostic script to check database issues - Fix docker-compose configuration for proper routing without path stripping The backend expects routes with /api prefix, so removing the stripprefix middleware allows proper routing to work. 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
3.5 KiB
3.5 KiB
Traefik Troubleshooting Guide
Common Issues and Solutions
1. 404 Errors on API Routes
Problem: Getting 404 errors when accessing /api/* routes
Causes:
- Traefik routing rules not properly configured
- Backend container not healthy
- Path stripping not working correctly
Solutions:
- Check container health:
docker ps # Check if backend is running
docker logs picpeak-backend # Check for startup errors
- Test backend directly:
# Access backend container
docker exec -it picpeak-backend sh
# Test health endpoint
wget -O- http://localhost:3000/health
# Test public settings endpoint
wget -O- http://localhost:3000/public/settings
- Check Traefik routing:
# Check if routes are registered in Traefik
curl https://traefik.yourdomain.com/api/http/routers | jq '.[] | select(.rule | contains("picpeak"))'
2. Backend Not Accessible Through Traefik
Key Configuration Points:
-
Traefik Labels (in deploy section):
traefik.enable=true- Enable Traefik for this containertraefik.docker.network=proxy- Specify which network Traefik should usetraefik.http.routers.picpeak-backend.priority=100- Higher priority for API routes
-
Path Stripping:
- Frontend expects
/api/*but backend serves routes without/apiprefix - Middleware strips
/apibefore forwarding to backend
- Frontend expects
-
Network Configuration:
- Backend must be in both
picpeak(internal) andproxy(Traefik) networks
- Backend must be in both
3. Environment Variable Issues
Critical Variables:
ADMIN_URLandFRONTEND_URLmust match your actual domain- These affect CORS configuration
Example .env:
# URLs
ADMIN_URL=https://picpeak.local.nothaft.cloud
FRONTEND_URL=https://picpeak.local.nothaft.cloud
# Database
DB_USER=picpeak
DB_PASSWORD=your_secure_password
DB_NAME=picpeak
# JWT
JWT_SECRET=your_secure_jwt_secret
# Email (optional)
SMTP_HOST=smtp.example.com
SMTP_PORT=587
SMTP_SECURE=true
SMTP_USER=noreply@example.com
SMTP_PASS=smtp_password
EMAIL_FROM=noreply@example.com
4. Debugging Steps
- Check if backend is receiving requests:
# Watch backend logs
docker logs -f picpeak-backend
# Look for incoming requests when you try to access the admin page
- Test API routes directly:
# From outside
curl -v https://picpeak.local.nothaft.cloud/api/public/settings
# Should see backend logs if request reaches container
- Verify Traefik middleware:
# Check if stripprefix middleware exists
curl https://traefik.yourdomain.com/api/http/middlewares | jq '.[] | select(.name | contains("picpeak"))'
5. Quick Fix Checklist
- Backend container is healthy (
docker ps) - Backend is in both networks (
docker inspect picpeak-backend | grep -A 20 Networks) - Traefik labels use correct network (
traefik.docker.network=proxy) - Priority is set correctly (backend: 100, frontend: 10)
- ADMIN_URL and FRONTEND_URL match your domain
- Database is accessible from backend
- Migrations have run successfully
6. Alternative Testing
If Traefik routing is problematic, test backend directly:
# Port forward to test backend directly
docker run --rm -it --network picpeak alpine/curl curl http://backend:3000/health
# Or expose backend port temporarily
docker run -d --name picpeak-backend-test \
--network picpeak \
-p 3001:3000 \
registry.local.nothaft.cloud/picpeak-backend:latest
Then access http://localhost:3001/health to verify backend is working.