4a79c5cacb
- Added `is_admin` field to User model for role management. - Updated user context middleware to include current user in templates. - Enhanced session management with improved debug middleware. - Refactored dashboard view to fetch user-specific data and recent events. - Improved login and registration templates for better user experience. - Added admin routes with access control for admin users. - Updated Docker configuration for better error logging and dependency management. - Updated requirements to include new dependencies and specify versions.
53 lines
1.3 KiB
YAML
53 lines
1.3 KiB
YAML
version: "3.9"
|
|
|
|
services:
|
|
db:
|
|
image: mysql:8.0
|
|
container_name: pubquiz_mysql
|
|
restart: always
|
|
environment:
|
|
MYSQL_DATABASE: "pubquiz_db"
|
|
MYSQL_USER: "pubquiz_user"
|
|
MYSQL_PASSWORD: "pubquiz_pass"
|
|
MYSQL_ROOT_PASSWORD: "root_pass"
|
|
ports:
|
|
- "3306:3306"
|
|
volumes:
|
|
- db_data:/var/lib/mysql:delegated
|
|
healthcheck:
|
|
test: ["CMD", "mysqladmin", "ping", "-h", "localhost", "-u", "root", "-p$$MYSQL_ROOT_PASSWORD"]
|
|
interval: 5s
|
|
timeout: 5s
|
|
retries: 20
|
|
|
|
app:
|
|
build: .
|
|
container_name: pubquiz_app
|
|
restart: unless-stopped
|
|
depends_on:
|
|
db:
|
|
condition: service_healthy
|
|
environment:
|
|
DB_HOST: "db"
|
|
DB_PORT: "3306"
|
|
DB_NAME: "pubquiz_db"
|
|
DB_USER: "pubquiz_user"
|
|
DB_PASS: "pubquiz_pass"
|
|
# Session configuration
|
|
SECRET_KEY: "a-stronger-secret-key-for-sessions-32chars"
|
|
DEBUG: "True"
|
|
SESSION_MAX_AGE: "86400" # 24 hours
|
|
COOKIE_SECURE: "False" # Set to True in production with HTTPS
|
|
# Add better error logging
|
|
PYTHONUNBUFFERED: "1"
|
|
# Add dependency installation command
|
|
command: >
|
|
bash -c "pip install pymysql && uvicorn app.main:app --host 0.0.0.0 --reload"
|
|
ports:
|
|
- "8000:8000"
|
|
volumes:
|
|
- ./:/app:delegated
|
|
|
|
volumes:
|
|
db_data:
|