feat: Migrate to MySQL and add unified environment configuration

## Database Migration (SQLite → MySQL)
- Add Alembic migration framework
- Add 'tr_' prefix to all tables to avoid conflicts in shared database
- Remove SQLite support, use MySQL exclusively
- Add pymysql driver dependency
- Change ad_token column to Text type for long JWT tokens

## Unified Environment Configuration
- Centralize all hardcoded settings to environment variables
- Backend: Extend Settings class in app/core/config.py
- Frontend: Use Vite environment variables (import.meta.env)
- Docker: Move credentials to environment variables
- Update .env.example files with comprehensive documentation

## Test Organization
- Move root-level test files to tests/ directory:
  - test_chat_room.py → tests/test_chat_room.py
  - test_websocket.py → tests/test_websocket.py
  - test_realtime_implementation.py → tests/test_realtime_implementation.py
- Fix path references in test_realtime_implementation.py

Breaking Changes:
- CORS now requires explicit origins (no more wildcard)
- All database tables renamed with 'tr_' prefix
- SQLite no longer supported

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

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
egg
2025-12-07 14:15:11 +08:00
parent 1d5d4d447d
commit 92834dbe0e
39 changed files with 1558 additions and 136 deletions

View File

@@ -1,9 +1,10 @@
# MinIO Object Storage for Task Reporter
# Usage: docker-compose -f docker-compose.minio.yml up -d
# docker-compose -f docker-compose.minio.yml --env-file .env.docker up -d
#
# This configuration starts MinIO for local development.
# Access MinIO Console at: http://localhost:9001
# S3 API endpoint at: http://localhost:9000
# Access MinIO Console at: http://localhost:${MINIO_CONSOLE_PORT:-9001}
# S3 API endpoint at: http://localhost:${MINIO_API_PORT:-9000}
version: '3.8'
@@ -12,11 +13,11 @@ services:
image: minio/minio:latest
container_name: task-reporter-minio
ports:
- "9000:9000" # S3 API
- "9001:9001" # MinIO Console
- "${MINIO_API_PORT:-9000}:9000" # S3 API
- "${MINIO_CONSOLE_PORT:-9001}:9001" # MinIO Console
environment:
MINIO_ROOT_USER: minioadmin
MINIO_ROOT_PASSWORD: minioadmin
MINIO_ROOT_USER: ${MINIO_ROOT_USER:-minioadmin}
MINIO_ROOT_PASSWORD: ${MINIO_ROOT_PASSWORD:-minioadmin}
command: server /data --console-address ":9001"
volumes:
- minio_data:/data
@@ -35,28 +36,40 @@ volumes:
# Quick Start Guide
# ============================================================================
#
# 1. Start MinIO:
# 1. Start MinIO (with default settings):
# docker-compose -f docker-compose.minio.yml up -d
#
# 2. Access MinIO Console:
# Open http://localhost:9001 in your browser
# Login: minioadmin / minioadmin
# 2. Start MinIO (with custom settings from .env.docker):
# docker-compose -f docker-compose.minio.yml --env-file .env.docker up -d
#
# 3. The application will automatically create the bucket on startup
# 3. Access MinIO Console:
# Open http://localhost:9001 in your browser
# Login with MINIO_ROOT_USER / MINIO_ROOT_PASSWORD
#
# 4. The application will automatically create the bucket on startup
# (configured as 'task-reporter-files' in .env)
#
# 4. Stop MinIO:
# 5. Stop MinIO:
# docker-compose -f docker-compose.minio.yml down
#
# 5. Remove all data:
# 6. Remove all data:
# docker-compose -f docker-compose.minio.yml down -v
#
# ============================================================================
# Environment Variables
# ============================================================================
#
# MINIO_ROOT_USER - MinIO admin username (default: minioadmin)
# MINIO_ROOT_PASSWORD - MinIO admin password (default: minioadmin)
# MINIO_API_PORT - S3 API port (default: 9000)
# MINIO_CONSOLE_PORT - Web console port (default: 9001)
#
# ============================================================================
# Production Notes
# ============================================================================
#
# For production deployment:
# - Change MINIO_ROOT_USER and MINIO_ROOT_PASSWORD to secure values
# - Set secure MINIO_ROOT_USER and MINIO_ROOT_PASSWORD in .env.docker
# - Use external volume or persistent storage
# - Configure TLS/HTTPS
# - Set up proper backup policies