feat: migrate to DragonflyDB and clean up environment configuration

- Replace Redis with DragonflyDB for better performance and memory efficiency
- Remove redundant environment variables (POSTGRES_*, ENCRYPTION_KEY, OAUTH_SERVICE_URL)
- Consolidate database configuration to use single DB_* variables
- Use JWT_SECRET for both JWT tokens and encryption
- Remove PORT variable redundancy, use BACKEND_PORT consistently
- Clean up docker-compose configurations for dev/prod consistency
- Add DragonflyDB configuration with optimized memory usage
- Remove redis.conf as it's no longer needed
- Update health checks to use Redis-compatible CLI for DragonflyDB
This commit is contained in:
Tomas Dvorak
2026-03-03 12:20:08 +01:00
parent fc913b5641
commit 9a580c77d2
9 changed files with 212 additions and 508 deletions
+14 -80
View File
@@ -1,10 +1,9 @@
# Server Configuration
PORT=8080
FRONTEND_PORT=3000
BACKEND_PORT=8080
DB_PORT=5432
DRAGONFLY_PORT=6379
GIN_MODE=debug
READ_TIMEOUT=15s
WRITE_TIMEOUT=15s
IDLE_TIMEOUT=60s
SHUTDOWN_TIMEOUT=30s
# Database Configuration
DB_TYPE=postgres
@@ -15,24 +14,14 @@ DB_PASSWORD=your_password_here
DB_NAME=trackeep
DB_SSL_MODE=disable
# Docker Compose Database (used by docker-compose.yml)
POSTGRES_DB=trackeep
POSTGRES_USER=trackeep
POSTGRES_PASSWORD=your_secure_password_here
# DragonflyDB Configuration
DRAGONFLY_ADDR=dragonfly:6379
DRAGONFLY_PASSWORD=your_dragonfly_password_here
# JWT Configuration
# JWT_SECRET is used for both JWT token signing and 2FA backup codes encryption
# Must be exactly 64 hexadecimal characters (32 bytes when decoded)
# Generate with: openssl rand -hex 32
# Or with Node.js: node -e "console.log(require('crypto').randomBytes(32).toString('hex'))"
# Or with Python: python3 -c "import secrets; print(secrets.token_hex(32))"
# JWT Configuration (also used for encryption)
JWT_SECRET=your_jwt_secret_here_64_hex_characters_long_exactly
JWT_EXPIRES_IN=24h
# Encryption Configuration
# Now uses JWT_SECRET for encryption - no separate ENCRYPTION_KEY needed
# This ensures 2FA backup codes are encrypted with the same key used for JWT tokens
# File Upload Configuration
UPLOAD_DIR=./uploads
MAX_FILE_SIZE=10485760
@@ -44,65 +33,10 @@ CORS_ALLOWED_ORIGINS=*
VITE_DEMO_MODE=false
# AI Services Configuration
# AI services are now configured only within the Trackeep application
# No environment variables needed - configure tokens and settings in the app settings
SEARCH_API_PROVIDER=demo
SEARCH_RESULTS_LIMIT=10
# =============================================================================
# REDIS CONFIGURATION (Optional but Recommended)
# =============================================================================
# Redis provides caching, session storage, rate limiting, and real-time features
# Uncomment and configure these to enable Redis support
# REDIS_ADDR=redis:6379
# REDIS_PASSWORD=your_secure_redis_password_here
# REDIS_DB=0
# REDIS_POOL_SIZE=20
# REDIS_DIAL_TIMEOUT=5s
# REDIS_READ_TIMEOUT=3s
# REDIS_WRITE_TIMEOUT=3s
# Feature Flags - Enable/disable Redis features
# REDIS_SESSIONS_ENABLED=true
# REDIS_CACHE_ENABLED=true
# REDIS_RATELIMIT_ENABLED=true
# REDIS_PUBSUB_ENABLED=true
# Redis Memory Settings (for Docker Compose)
# REDIS_MAXMEMORY=256mb
# REDIS_MAXMEMORY_POLICY=allkeys-lru
# =============================================================================
# PERFORMANCE TUNING
# =============================================================================
# Enable these settings for better performance with Redis caching
# Cache TTL settings (in seconds)
# SEARCH_CACHE_TTL=300
# ANALYTICS_CACHE_TTL=900
# USER_CACHE_TTL=900
# SESSION_CACHE_TTL=86400 # 24 hours
# Rate limiting settings
# RATE_LIMIT_REQUESTS_PER_MINUTE=100
# RATE_LIMIT_BURST_SIZE=150
# AI_RATE_LIMIT_REQUESTS_PER_MINUTE=20
# UPLOAD_RATE_LIMIT_REQUESTS_PER_MINUTE=10
# =============================================================================
# NOTE: Redis Deployment
# =============================================================================
# To deploy with Redis, add the Redis service to your docker-compose.yml:
#
# redis:
# image: redis:7-alpine
# restart: unless-stopped
# volumes:
# - redis_data:/data
# - ./redis.conf:/usr/local/etc/redis/redis.conf:ro
# command: redis-server /usr/local/etc/redis/redis.conf
# environment:
# - REDIS_PASSWORD=${REDIS_PASSWORD}
# networks:
# - trackeep-network
#
# And add to volumes: redis_data:
# Auto Update Configuration
AUTO_UPDATE_CHECK=false
UPDATE_CHECK_INTERVAL=24h
PRERELEASE_UPDATES=false