Files
encoderPro/DEBUGGING-DOCKER.md
2026-01-24 17:43:28 -05:00

294 lines
7.1 KiB
Markdown

# Debugging Docker Container
This guide shows you how to view logs and debug issues in the encoderPro Docker container.
---
## Quick Commands
### View Live Logs
```bash
# Follow logs in real-time (Ctrl+C to stop)
docker logs encoderpro-dashboard-intel -f
# View last 100 lines
docker logs encoderpro-dashboard-intel --tail 100
# View logs with timestamps
docker logs encoderpro-dashboard-intel -f --timestamps
```
### Check Container Status
```bash
# Is container running?
docker ps | grep encoderpro
# View all containers (including stopped)
docker ps -a | grep encoderpro
# Inspect container details
docker inspect encoderpro-dashboard-intel
```
### Interactive Debugging
```bash
# Open a shell inside the running container
docker exec -it encoderpro-dashboard-intel /bin/bash
# Once inside, you can:
ls /movies # Check if movies are visible
ls /db # Check database location
cat /config/config.yaml # View config
python3 /app/reencode.py -c /config/config.yaml --stats # Run stats
bash /app/check-gpu.sh # Check GPU availability
exit # Exit the container shell
```
### Check AV1 Encoder Support
```bash
# Copy test script to container
docker cp test-av1-support.sh encoderpro-dashboard-intel:/app/
# Run AV1 support test
docker exec encoderpro-dashboard-intel bash /app/test-av1-support.sh
```
---
## Enable Debug Mode
### Option 1: Environment Variable (Recommended)
Add `-e DASHBOARD_DEBUG="true"` when creating the container:
```bash
docker run -d \
--name encoderpro-dashboard-intel \
--device=/dev/dri:/dev/dri \
-e GPU_TYPE=intel \
-e DASHBOARD_DEBUG="true" \
-p 5000:5000 \
-v /mnt/user/movies:/movies \
-v /mnt/user/archive/movies:/archive \
-v /mnt/user/appdata/encoderpro/config.yaml:/config/config.yaml:ro \
-v /mnt/user/appdata/encoderpro/db:/db \
-v /mnt/user/appdata/encoderpro/logs:/logs \
--restart unless-stopped \
encoderpro-intel:latest dashboard
```
### Option 2: Recreate Container with Debug
```bash
# Stop and remove old container
docker stop encoderpro-dashboard-intel
docker rm encoderpro-dashboard-intel
# Start with debug enabled
docker run -d \
--name encoderpro-dashboard-intel \
--device=/dev/dri:/dev/dri \
-e GPU_TYPE=intel \
-e DASHBOARD_DEBUG="true" \
-p 5000:5000 \
-v /mnt/user/movies:/movies \
-v /mnt/user/archive/movies:/archive \
-v /mnt/user/appdata/encoderpro/config.yaml:/config/config.yaml:ro \
-v /mnt/user/appdata/encoderpro/db:/db \
-v /mnt/user/appdata/encoderpro/logs:/logs \
--restart unless-stopped \
encoderpro-intel:latest dashboard
```
---
## Common Issues and Solutions
### 1. Container Not Starting
```bash
# Check why container stopped
docker logs encoderpro-dashboard-intel
# Common causes:
# - Permission errors (fix with chown -R 1000:1000)
# - Missing directories
# - Invalid config.yaml
```
### 2. Can't See Processing Logs
```bash
# Logs are in multiple places:
# 1. Docker logs (dashboard output)
docker logs encoderpro-dashboard-intel -f
# 2. File logs (reencode.py output)
tail -f /mnt/user/appdata/encoderpro/logs/reencode.log
# 3. Dashboard logs (if configured)
tail -f /mnt/user/appdata/encoderpro/logs/dashboard.log
```
### 3. Check If Processing Is Running
```bash
# Inside container, check for python processes
docker exec -it encoderpro-dashboard-intel ps aux | grep python
# Check if any files are being processed
docker exec -it encoderpro-dashboard-intel ls -lah /work
```
### 4. Database Issues
```bash
# Access database directly
docker exec -it encoderpro-dashboard-intel sqlite3 /db/state.db
# Inside SQLite:
SELECT state, COUNT(*) FROM files GROUP BY state;
SELECT * FROM files WHERE state='pending';
SELECT * FROM files WHERE state='processing';
.quit
```
---
## Understanding Log Output
### Dashboard Startup Logs
```
Starting Web Dashboard v3.2.0
Server: http://0.0.0.0:5000
Database: /db/state.db
Config: /config/config.yaml
Debug mode: True
Log level: DEBUG
```
### Processing Logs
```
============================================================
ENCODERPRO - PHASE 3
Version: 3.0.0
============================================================
Skipping library scan (--no-scan mode)
Processing 1 file(s)...
Processing: movies_7/Get Hard.m4v
Changed output extension to .mp4 for HEVC compatibility
Encoding with INTEL_QSV_H265, profile: sweetspot_qsv
```
### Success Logs
```
[OK] Completed: movies_7/Get Hard.mp4 | Encoder: INTEL_QSV_H265 | Time: 45.2s | FPS: 58.32 | Saved: 42.3%
```
### Failure Logs
```
[FAIL] Failed: movies_7/Get Hard.m4v - Encoding failed
FFmpeg error: [error message here]
```
---
## Troubleshooting Workflow
1. **Check container is running**
```bash
docker ps | grep encoderpro
```
2. **View real-time logs**
```bash
docker logs encoderpro-dashboard-intel -f
```
3. **Select a file in dashboard**
- Open http://your-server:5000
- Select a file
- Click "Encode Selected"
4. **Watch the logs**
- You should see "Processing 1 file(s)..."
- Then encoding progress
- Then either success or failure
5. **If nothing happens**
```bash
# Check if API calls are reaching the server
docker logs encoderpro-dashboard-intel --tail 50 | grep "POST /api"
# Check database state
docker exec -it encoderpro-dashboard-intel sqlite3 /db/state.db "SELECT * FROM files WHERE state='pending';"
```
---
## Debug Checklist
- [ ] Container is running (`docker ps`)
- [ ] Debug mode enabled (`DASHBOARD_DEBUG=true`)
- [ ] Logs are showing (`docker logs -f`)
- [ ] Can access dashboard (http://your-server:5000)
- [ ] Files are scanned (Discovered count > 0)
- [ ] Can select files (checkbox works)
- [ ] Encode button shows confirmation
- [ ] Processing log shows "Processing X file(s)"
- [ ] FFmpeg runs without errors
- [ ] Encoded file appears in movies directory
---
## Performance Monitoring
```bash
# Check container resource usage
docker stats encoderpro-dashboard-intel
# Monitor GPU usage (Intel)
intel_gpu_top
# Check disk I/O
iostat -x 1
```
---
## File Locations
| What | Location in Container | Location on Host |
|------|----------------------|------------------|
| Dashboard code | `/app/dashboard.py` | Local build directory |
| Reencode script | `/app/reencode.py` | Local build directory |
| Config file | `/config/config.yaml` | `/mnt/user/appdata/encoderpro/config.yaml` |
| Database | `/db/state.db` | `/mnt/user/appdata/encoderpro/db/state.db` |
| Logs | `/logs/` | `/mnt/user/appdata/encoderpro/logs/` |
| Movies | `/movies/` | `/mnt/user/movies/` |
| Archive | `/archive/` | `/mnt/user/archive/movies/` |
| Work files | `/work/` | Container temp (lost on restart) |
---
## Getting Help
When reporting issues, include:
1. **Container logs**
```bash
docker logs encoderpro-dashboard-intel --tail 200 > logs.txt
```
2. **Database state**
```bash
docker exec -it encoderpro-dashboard-intel sqlite3 /db/state.db "SELECT state, COUNT(*) FROM files GROUP BY state;" > db-state.txt
```
3. **System info**
```bash
docker version > sysinfo.txt
uname -a >> sysinfo.txt
lspci | grep -i vga >> sysinfo.txt
```
4. **Config file** (remove sensitive paths if needed)
```bash
cat /mnt/user/appdata/encoderpro/config.yaml > config.txt
```