mirror of
https://github.com/laoxong/nofx.git
synced 2026-06-04 09:58:22 +08:00
6426696258
Major database migration to modernize the AI trading system:
• **Database Migration**:
- Add PostgreSQL 15 and Redis 7 services to docker-compose
- Create comprehensive PostgreSQL schema with proper indexes and triggers
- Implement DatabaseInterface for multi-database support
- Add automatic environment-based database selection
• **Infrastructure**:
- PostgreSQL: ACID transactions, better concurrency, JSON support
- Redis: High-performance caching layer (prepared for future use)
- Docker services with health checks and dependency management
- Persistent volumes for data safety
• **Code Refactoring**:
- Abstract database operations through DatabaseInterface
- Implement PostgreSQL-specific operations with proper syntax
- Update all SQL queries to support both SQLite and PostgreSQL
- Fix foreign key constraints and data type conversions
• **Migration Tools**:
- Automated data migration script from SQLite to PostgreSQL
- Complete backup and restore procedures
- One-click migration script with validation
• **Compatibility**:
- Backward compatible with existing SQLite deployments
- Environment variable driven database selection
- Preserved all existing functionality and data
🎯 Benefits: Better performance, scalability, and reliability for production deployments
26 lines
613 B
Bash
26 lines
613 B
Bash
# NOFX Environment Variables Template
|
|
# Copy this file to .env and modify the values as needed
|
|
|
|
# PostgreSQL数据库配置
|
|
POSTGRES_HOST=postgres
|
|
POSTGRES_PORT=5432
|
|
POSTGRES_DB=nofx
|
|
POSTGRES_USER=nofx
|
|
POSTGRES_PASSWORD=nofx123456
|
|
|
|
# Redis配置
|
|
REDIS_HOST=redis
|
|
REDIS_PORT=6379
|
|
REDIS_PASSWORD=redis123456
|
|
|
|
# Ports Configuration
|
|
# Backend API server port (internal: 8080, external: configurable)
|
|
NOFX_BACKEND_PORT=8080
|
|
|
|
# Frontend web interface port (Nginx listens on port 80 internally)
|
|
NOFX_FRONTEND_PORT=3000
|
|
|
|
# Timezone Setting
|
|
# System timezone for container time synchronization
|
|
NOFX_TIMEZONE=Asia/Shanghai
|