Spaces:
Sleeping
Sleeping
| # Docker Commands for IntegraChat | |
| ## Quick Start Commands | |
| ### 1. Stop and Remove Existing Container | |
| ```powershell | |
| docker rm -f integrachat | |
| ``` | |
| ### 2. Build the Docker Image | |
| ```powershell | |
| docker build -t integrachat:latest . | |
| ``` | |
| ### 3. Run the Container | |
| ```powershell | |
| docker run -d --name integrachat ` | |
| -p 7860:7860 ` | |
| -p 8000:8000 ` | |
| -p 8900:8900 ` | |
| --env-file .env ` | |
| -e DOCKER_CONTAINER=1 ` | |
| integrachat:latest | |
| ``` | |
| ### 4. View Logs | |
| ```powershell | |
| # Follow logs (live) | |
| docker logs -f integrachat | |
| # Last 50 lines | |
| docker logs --tail 50 integrachat | |
| # Last 100 lines with timestamps | |
| docker logs --tail 100 -t integrachat | |
| ``` | |
| --- | |
| ## Container Management | |
| ### Check Container Status | |
| ```powershell | |
| # Check if running | |
| docker ps --filter "name=integrachat" | |
| # Check all containers (including stopped) | |
| docker ps -a --filter "name=integrachat" | |
| # Detailed status | |
| docker ps --filter "name=integrachat" --format "Container: {{.Names}} | Status: {{.Status}} | Ports: {{.Ports}}" | |
| ``` | |
| ### Stop Container | |
| ```powershell | |
| docker stop integrachat | |
| ``` | |
| ### Start Container (if stopped) | |
| ```powershell | |
| docker start integrachat | |
| ``` | |
| ### Restart Container | |
| ```powershell | |
| docker restart integrachat | |
| ``` | |
| ### Remove Container | |
| ```powershell | |
| # Stop and remove | |
| docker rm -f integrachat | |
| # Remove only if stopped | |
| docker rm integrachat | |
| ``` | |
| --- | |
| ## Image Management | |
| ### List Images | |
| ```powershell | |
| docker images integrachat | |
| ``` | |
| ### Remove Image | |
| ```powershell | |
| docker rmi integrachat:latest | |
| ``` | |
| ### Rebuild Without Cache | |
| ```powershell | |
| docker build --no-cache -t integrachat:latest . | |
| ``` | |
| --- | |
| ## Debugging Commands | |
| ### Execute Commands Inside Container | |
| ```powershell | |
| # Open shell in container | |
| docker exec -it integrachat /bin/bash | |
| # Run Python command | |
| docker exec integrachat python --version | |
| # Check environment variables | |
| docker exec integrachat printenv | Select-String -Pattern "GROQ|MCP|API" | |
| # Check if services are running | |
| docker exec integrachat ps aux | |
| ``` | |
| ### Check Service Health | |
| ```powershell | |
| # Check FastAPI health | |
| docker exec integrachat curl -s http://localhost:8000/health | |
| # Check MCP server health | |
| docker exec integrachat curl -s http://localhost:8900/health | |
| # Check Gradio (from host) | |
| Invoke-WebRequest -Uri http://localhost:7860 -UseBasicParsing -TimeoutSec 5 | |
| ``` | |
| ### View Service Logs | |
| ```powershell | |
| # FastAPI logs | |
| docker exec integrachat tail -n 50 /app/logs/fastapi.log | |
| # MCP server logs | |
| docker exec integrachat tail -n 50 /app/logs/mcp.log | |
| # Gradio logs | |
| docker exec integrachat tail -n 50 /app/logs/gradio.log | |
| # All logs | |
| docker exec integrachat tail -n 50 /app/logs/*.log | |
| ``` | |
| ### Check Ports | |
| ```powershell | |
| # Check what ports are mapped | |
| docker port integrachat | |
| # Check if ports are listening (from host) | |
| netstat -an | Select-String -Pattern "7860|8000|8900" | |
| ``` | |
| --- | |
| ## Complete Rebuild Sequence | |
| ```powershell | |
| # 1. Stop and remove container | |
| docker rm -f integrachat | |
| # 2. Remove old image (optional) | |
| docker rmi integrachat:latest | |
| # 3. Build new image | |
| docker build -t integrachat:latest . | |
| # 4. Run container | |
| docker run -d --name integrachat ` | |
| -p 7860:7860 ` | |
| -p 8000:8000 ` | |
| -p 8900:8900 ` | |
| --env-file .env ` | |
| -e DOCKER_CONTAINER=1 ` | |
| integrachat:latest | |
| # 5. Check status | |
| docker ps --filter "name=integrachat" | |
| # 6. View logs | |
| docker logs -f integrachat | |
| ``` | |
| --- | |
| ## Quick Health Check | |
| ```powershell | |
| # Check all services | |
| Write-Host "Container Status:" -ForegroundColor Cyan | |
| docker ps --filter "name=integrachat" --format " {{.Names}}: {{.Status}}" | |
| Write-Host "`nService Health:" -ForegroundColor Cyan | |
| Write-Host " FastAPI:" -NoNewline | |
| docker exec integrachat curl -s http://localhost:8000/health 2>&1 | Out-Null | |
| if ($LASTEXITCODE -eq 0) { Write-Host " β Running" -ForegroundColor Green } else { Write-Host " β Not responding" -ForegroundColor Red } | |
| Write-Host " MCP Server:" -NoNewline | |
| docker exec integrachat curl -s http://localhost:8900/health 2>&1 | Out-Null | |
| if ($LASTEXITCODE -eq 0) { Write-Host " β Running" -ForegroundColor Green } else { Write-Host " β Not responding" -ForegroundColor Red } | |
| Write-Host " Gradio UI:" -NoNewline | |
| try { $response = Invoke-WebRequest -Uri http://localhost:7860 -UseBasicParsing -TimeoutSec 2; Write-Host " β Running" -ForegroundColor Green } catch { Write-Host " β Not responding" -ForegroundColor Red } | |
| ``` | |
| --- | |
| ## Access URLs | |
| Once the container is running, access: | |
| - **Gradio UI**: http://localhost:7860 | |
| - **FastAPI API**: http://localhost:8000 | |
| - **API Docs**: http://localhost:8000/docs | |
| - **MCP Server**: http://localhost:8900 | |
| - **MCP Server Docs**: http://localhost:8900/docs | |
| --- | |
| ## Troubleshooting | |
| ### Container won't start | |
| ```powershell | |
| # Check logs for errors | |
| docker logs integrachat | |
| # Check if ports are already in use | |
| netstat -an | Select-String -Pattern "7860|8000|8900" | |
| ``` | |
| ### Services not responding | |
| ```powershell | |
| # Restart container | |
| docker restart integrachat | |
| # Check service logs inside container | |
| docker exec integrachat tail -n 100 /app/logs/*.log | |
| ``` | |
| ### Clear everything and start fresh | |
| ```powershell | |
| # Stop and remove container | |
| docker rm -f integrachat | |
| # Remove image | |
| docker rmi integrachat:latest | |
| # Clear build cache (optional) | |
| docker builder prune -f | |
| # Rebuild from scratch | |
| docker build --no-cache -t integrachat:latest . | |
| ``` | |
| --- | |
| ## Environment Variables | |
| Make sure your `.env` file has: | |
| - `GROQ_API_KEY` - Your Groq API key | |
| - `GROQ_MODEL` - Model name (default: llama-3.1-8b-instant) | |
| - `RAG_MCP_URL` - http://localhost:8900/rag | |
| - `WEB_MCP_URL` - http://localhost:8900/web | |
| - `ADMIN_MCP_URL` - http://localhost:8900/admin | |
| - `MCP_PORT` - 8900 | |
| - `API_PORT` - 8000 | |
| - `POSTGRESQL_URL` - Your database connection string (optional) | |