Alexis Bruneteau
|
368bb38057
|
chore: Setup complete Docker Compose configuration
Comprehensive Docker Compose setup with all services:
Services:
• MariaDB 11 - Database with persistent storage
• FastAPI Backend - Python 3.12 with Poetry
• Next.js Frontend - Node 20 with production build
• Adminer - Optional database management UI
Features:
✓ Health checks for all services
✓ Proper dependency ordering (database -> backend -> frontend)
✓ Networking with private subnet (172.20.0.0/16)
✓ Volume management for data persistence
✓ Environment variable configuration
✓ Logging configuration (10MB max, 3 files)
✓ Restart policies (unless-stopped)
Configuration Files:
• docker-compose.yml - Production-ready compose file
• .env - Development environment variables
• .env.example - Template for environment setup
• DOCKER_SETUP.md - Comprehensive setup guide
Improvements:
• Added curl to backend Dockerfile for health checks
• Better error handling and startup sequencing
• Database initialization with multiple SQL files
• Adminer for easy database management (port 8080)
• Detailed logging with file rotation
• Production-ready with comments and documentation
Environment Variables:
Database:
DB_HOST=mariadb, DB_PORT=3306
DB_NAME=evoting_db, DB_USER=evoting_user
DB_PASSWORD=evoting_pass123
Services:
BACKEND_PORT=8000, FRONTEND_PORT=3000
Security:
SECRET_KEY=your-secret-key-change-in-production
DEBUG=false (for production)
Health Checks:
• Database: mariadb-admin ping
• Backend: curl /health endpoint
• Frontend: wget to port 3000
Volumes:
• evoting_data - MariaDB persistent storage
• backend_cache - Backend cache directory
Networks:
• evoting_network (172.20.0.0/16)
• Internal service-to-service communication
Quick Start:
1. cp .env.example .env
2. docker-compose up -d
3. http://localhost:3000 (frontend)
4. http://localhost:8000/docs (API docs)
5. http://localhost:8080 (database admin)
🤖 Generated with Claude Code
Co-Authored-By: Claude <noreply@anthropic.com>
|
2025-11-07 02:09:07 +01:00 |
|