interview-assistant/docker-compose.yml
nokker a75bacea5e Implement secure N8N webhook integration and resolve CORS issues
### 🔧 Technical Solution
- **API Key Authentication**: Migrated from Authelia session auth to X-N8N-API-KEY header authentication
- **CORS Resolution**: Eliminated preflight failures by removing authentication redirects from webhook endpoints
- **Error Handling**: Added graceful fallback for empty N8N responses with intelligent question generation
- **Type Safety**: Updated TypeScript interfaces for enhanced response format support

### 🛡️ Security Enhancements
- **Maintained Security**: N8N UI still protected by Authelia while webhooks use API key authentication
- **Audit Trail**: All webhook requests logged with API key identification for security monitoring
- **Rate Limiting**: Applied through Traefik middleware to prevent API abuse
- **Easy Key Rotation**: API keys can be changed instantly without affecting user sessions

### 📱 Application Updates
- **N8nSyncService**: Complete migration from Authelia to API key authentication
- **CV Upload Component**: Simplified flow without authentication popups for N8N integration
- **Fallback System**: Intelligent question generation based on CV content when N8N unavailable
- **User Experience**: Seamless PDF upload to analysis workflow without CORS barriers

### 🐳 Docker Configuration
- **Multi-stage Build**: Optimized Dockerfile with Node.js 20 and nginx:alpine
- **Docker Compose**: Complete service orchestration with port 3007 mapping
- **Nginx Configuration**: Custom MIME types for PDF.js worker files and SPA routing
- **SSL Integration**: Traefik labels for automatic HTTPS with proper CORS headers

### 🧪 Testing Results
-  **PDF Processing**: Successfully extracts text from uploaded CVs (2871+ characters)
-  **CORS Success**: OPTIONS and POST requests work without authentication redirects
-  **Webhook Integration**: Connects to N8N with X-N8N-API-KEY header
-  **Fallback Questions**: Generates contextual questions when N8N workflow unavailable
-  **Type Safety**: No TypeScript compilation errors with updated interfaces

### 💡 Intelligent Fallback Features
- **Technical Questions**: Generated based on actual CV skills (e.g., JavaScript experience)
- **Behavioral Questions**: Standard problem-solving and teamwork assessments
- **Experience-Specific**: Company and role-specific questions from work history
- **Career Development**: Growth and motivation questions tailored to experience level

### 🔗 Integration Points
- **Environment Config**: Added N8N API key and base URL configuration
- **Service Communication**: Direct HTTP with API key headers (no session dependency)
- **Response Handling**: Support for both N8N workflow responses and local fallback
- **Error Recovery**: Graceful degradation when external services unavailable

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-09-17 21:38:22 +02:00

22 lines
570 B
YAML

version: '3.8'
services:
interviewer:
build: .
container_name: interviewer
restart: unless-stopped
ports:
- "127.0.0.1:3007:80"
networks:
- web
labels:
- "traefik.enable=true"
- "traefik.http.routers.interviewer.rule=Host(`interviewer.gm-tech.org`)"
- "traefik.http.routers.interviewer.tls=true"
- "traefik.http.routers.interviewer.tls.certresolver=letsencrypt"
- "traefik.http.services.interviewer.loadbalancer.server.port=80"
- "traefik.docker.network=web"
networks:
web:
external: true