Files
n8n-mcp/docs/DOCKER_TESTING_RESULTS.md

140 lines
3.8 KiB
Markdown

# Docker Testing Results
## Testing Date: June 13, 2025
### Test Environment
- Docker version: Docker Desktop on macOS
- Platform: arm64 (Apple Silicon)
- Node.js in container: v20.19.2
## Test Results Summary
### ✅ Successful Tests
1. **Docker Build Process**
- Multi-stage build completes successfully
- Build context optimized from 1.75GB to 6.87KB with proper .dockerignore
- All layers cache properly for faster rebuilds
2. **Health Endpoint**
- Returns proper JSON response
- Shows correct uptime, memory usage, and version
- Accessible at http://localhost:3000/health
3. **Authentication (HTTP Mode)**
- Correctly rejects requests with wrong token (401 Unauthorized)
- Accepts requests with correct AUTH_TOKEN
- Warns when AUTH_TOKEN is less than 32 characters
4. **Docker Compose Deployment**
- Creates named volumes for persistence
- Respects resource limits (512MB max, 256MB reserved)
- Health checks run every 30 seconds
- Graceful shutdown on SIGTERM
5. **Stdio Mode**
- Container starts in stdio mode with MCP_MODE=stdio
- Accepts JSON-RPC input via stdin
- Returns responses via stdout
### ⚠️ Issues Discovered
1. **Database Initialization Failure**
```
Error: ENOENT: no such file or directory, open '/app/src/database/schema.sql'
```
- Cause: schema.sql not included in Docker image
- Impact: Database cannot be initialized on first run
- Fix: Include src/database/schema.sql in Dockerfile
2. **MCP Endpoint Error**
```json
{
"error": {
"code": -32700,
"message": "Parse error",
"data": "InternalServerError: stream is not readable"
}
}
```
- Likely related to missing database
- Needs investigation after fixing database initialization
3. **Large Image Size**
- Current size: 2.61GB
- Cause: All node_modules included in production
- Potential optimization: Use Alpine packages where possible
### 📊 Performance Metrics
- Build time: ~5 minutes (with cache)
- Startup time: <2 seconds
- Memory usage: ~8-9MB (idle)
- Health check response time: <50ms
### 🔧 Recommended Fixes
1. **Immediate (Phase 1)**
- Include schema.sql in Docker image
- Add scripts directory for rebuild functionality
- Test database initialization in clean environment
2. **Future Improvements (Phase 2)**
- Optimize image size with multi-stage pruning
- Add database migration support
- Implement proper logging rotation
- Add Prometheus metrics endpoint
### 📋 Testing Checklist
- [x] Docker build completes
- [x] Image runs without crashes
- [x] Health endpoint responds
- [x] Authentication works
- [x] Docker Compose deploys
- [x] Volumes persist data
- [x] Resource limits enforced
- [x] Graceful shutdown works
- [ ] Database initializes properly
- [ ] MCP tools function correctly
- [ ] Cross-platform compatibility (arm64/amd64)
## Next Steps
1. Apply fixes from Dockerfile.fixed
2. Test database initialization thoroughly
3. Verify MCP functionality with initialized database
4. Test multi-architecture builds in CI
5. Document troubleshooting steps
## Test Commands Used
```bash
# Build image
docker build -t n8n-mcp:test .
# Test stdio mode
echo '{"jsonrpc":"2.0","method":"tools/list","id":1}' | \
docker run --rm -i -e MCP_MODE=stdio n8n-mcp:test
# Test HTTP mode
docker run -d --name test-http \
-e MCP_MODE=http \
-e AUTH_TOKEN=test-token \
-p 3001:3000 \
n8n-mcp:test
# Test with docker-compose
docker compose up -d
docker compose logs -f
# Health check
curl http://localhost:3000/health
# Test authentication
curl -H "Authorization: Bearer test-token" \
-H "Content-Type: application/json" \
-H "Accept: application/json, text/event-stream" \
-d '{"jsonrpc":"2.0","method":"tools/list","id":1}' \
http://localhost:3000/mcp
```