Analysis: - Docker image size: 3.53GB (needs optimization) - Monolithic app.py: 1,051 lines (needs splitting) - No caching strategy (performance bottleneck) - Synchronous video processing (blocks requests) Optimization Proposal includes: 1. Multi-stage Docker build (3.53GB → 800MB, 77% reduction) 2. Blueprint architecture (split monolithic app.py) 3. Redis caching (50-80% faster page loads) 4. Celery for background tasks (async video processing) 5. Database optimization (indexes, query optimization) 6. nginx reverse proxy (3-5x faster static files) 7. Security hardening (rate limiting, CSRF, validation) 8. Monitoring & health checks 9. Type hints & code quality improvements 10. Environment-based configuration Expected results: - Page load: 2-3s → 0.5-1s (70% faster) - API response: 100-200ms → 20-50ms (75% faster) - Concurrent users: 10-20 → 100-200 (10x scalability) - Docker image: 77% smaller - Code maintainability: Significantly improved Implementation roadmap: 4 phases over 2-3 weeks Priority: Critical → High → Medium Changed port mapping: 8880:5000 → 80:5000 for standard HTTP access
39 lines
924 B
YAML
39 lines
924 B
YAML
# Production Docker Compose Configuration
|
|
# Use this for production deployment
|
|
|
|
services:
|
|
digiserver:
|
|
build: .
|
|
image: digiserver:latest
|
|
container_name: digiserver
|
|
ports:
|
|
- "80:5000"
|
|
environment:
|
|
- FLASK_APP=app.py
|
|
- FLASK_RUN_HOST=0.0.0.0
|
|
- FLASK_ENV=production
|
|
- FLASK_DEBUG=0
|
|
- ADMIN_USER=admin
|
|
- ADMIN_PASSWORD=Initial01!
|
|
- SECRET_KEY=Ma_Duc_Dupa_Merele_Lui_Ana
|
|
volumes:
|
|
# Mount app code
|
|
- ./app:/app
|
|
# Persistent data volumes
|
|
- ./data/instance:/app/instance
|
|
- ./data/uploads:/app/static/uploads
|
|
- ./data/resurse:/app/static/resurse
|
|
restart: unless-stopped
|
|
healthcheck:
|
|
test: ["CMD", "curl", "-f", "http://localhost:5000/"]
|
|
interval: 30s
|
|
timeout: 10s
|
|
retries: 3
|
|
start_period: 40s
|
|
networks:
|
|
- digiserver-network
|
|
|
|
networks:
|
|
digiserver-network:
|
|
driver: bridge
|