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
+45 -20
View File
@@ -1,31 +1,34 @@
version: '3.8'
services:
trackeep-frontend:
image: 'ghcr.io/dvorinka/trackeep/frontend:latest'
ports:
- '80:80'
- '443:443'
- "${FRONTEND_PORT:-80}:80"
- "${HTTPS_PORT:-443}:443"
environment:
- NODE_ENV=production
- VITE_DEMO_MODE=${VITE_DEMO_MODE:-false}
- FRONTEND_PORT=${FRONTEND_PORT:-80}
- BACKEND_PORT=${BACKEND_PORT:-8080}
depends_on:
- trackeep-backend
restart: unless-stopped
networks:
- trackeep-network
healthcheck:
test: ["CMD-SHELL", "pgrep nginx > /dev/null || exit 1"]
interval: 30s
timeout: 10s
retries: 3
start_period: 20s
trackeep-backend:
image: 'ghcr.io/dvorinka/trackeep/backend:latest'
ports:
- '8080:8080'
- "${BACKEND_PORT:-8080}:${BACKEND_PORT:-8080}"
environment:
- PORT=${PORT:-8080}
- BACKEND_PORT=${BACKEND_PORT:-8080}
- FRONTEND_PORT=${FRONTEND_PORT:-80}
- GIN_MODE=${GIN_MODE:-release}
- READ_TIMEOUT=${READ_TIMEOUT:-15s}
- WRITE_TIMEOUT=${WRITE_TIMEOUT:-15s}
- IDLE_TIMEOUT=${IDLE_TIMEOUT:-60s}
- SHUTDOWN_TIMEOUT=${SHUTDOWN_TIMEOUT:-30s}
- DB_TYPE=${DB_TYPE:-postgres}
- DB_HOST=${DB_HOST:-postgres}
- DB_PORT=${DB_PORT:-5432}
@@ -35,19 +38,17 @@ services:
- DB_SSL_MODE=${DB_SSL_MODE:-disable}
- JWT_SECRET=${JWT_SECRET}
- JWT_EXPIRES_IN=${JWT_EXPIRES_IN:-24h}
- ENCRYPTION_KEY=${ENCRYPTION_KEY}
- UPLOAD_DIR=${UPLOAD_DIR:-./uploads}
- MAX_FILE_SIZE=${MAX_FILE_SIZE:-10485760}
- 'CORS_ALLOWED_ORIGINS=${CORS_ALLOWED_ORIGINS:-*}'
- VITE_DEMO_MODE=${VITE_DEMO_MODE:-false}
- SEARCH_API_PROVIDER=${SEARCH_API_PROVIDER:-demo}
- SEARCH_RESULTS_LIMIT=${SEARCH_RESULTS_LIMIT:-10}
- SEARCH_CACHE_TTL=${SEARCH_CACHE_TTL:-300}
- SEARCH_RATE_LIMIT=${SEARCH_RATE_LIMIT:-100}
- 'OAUTH_SERVICE_URL=${OAUTH_SERVICE_URL:-http://localhost:9090}'
- AUTO_UPDATE_CHECK=${AUTO_UPDATE_CHECK:-false}
- UPDATE_CHECK_INTERVAL=${UPDATE_CHECK_INTERVAL:-24h}
- PRERELEASE_UPDATES=${PRERELEASE_UPDATES:-false}
- DRAGONFLY_ADDR=${DRAGONFLY_ADDR:-dragonfly:6379}
- DRAGONFLY_PASSWORD=${DRAGONFLY_PASSWORD}
volumes:
- './data:/data'
- './uploads:/app/uploads'
@@ -63,7 +64,7 @@ services:
- '--no-verbose'
- '--tries=1'
- '--spider'
- 'http://localhost:8080/health'
- "http://localhost:${BACKEND_PORT:-8080}/health"
interval: 30s
timeout: 10s
retries: 3
@@ -71,23 +72,47 @@ services:
postgres:
image: 'postgres:15-alpine'
ports:
- "${DB_PORT:-5432}:5432"
environment:
POSTGRES_DB: ${POSTGRES_DB:-trackeep}
POSTGRES_USER: ${POSTGRES_USER:-trackeep}
POSTGRES_PASSWORD: ${POSTGRES_PASSWORD}
POSTGRES_DB: ${DB_NAME:-trackeep}
POSTGRES_USER: ${DB_USER:-trackeep}
POSTGRES_PASSWORD: ${DB_PASSWORD}
volumes:
- 'postgres_data:/var/lib/postgresql/data'
- 'postgres_data:/var/lib/postgres/data'
restart: unless-stopped
networks:
- trackeep-network
healthcheck:
test: ["CMD-SHELL", "pg_isready -U ${POSTGRES_USER:-trackeep} -d ${POSTGRES_DB:-trackeep}"]
test: ["CMD-SHELL", "pg_isready -U ${DB_USER:-trackeep} -d ${DB_NAME:-trackeep}"]
interval: 10s
timeout: 5s
retries: 5
start_period: 30s
dragonfly:
image: ghcr.io/dragonflydb/dragonfly:latest
container_name: dragonfly
ports:
- "${DRAGONFLY_PORT:-6379}:6379"
volumes:
- dragonfly_data:/data
command: dragonfly --requirepass=${DRAGONFLY_PASSWORD} --proactor_threads=2
environment:
- DRAGONFLY_PASSWORD=${DRAGONFLY_PASSWORD}
restart: unless-stopped
networks:
- trackeep-network
healthcheck:
test: ["CMD-SHELL", "redis-cli -a ${DRAGONFLY_PASSWORD} ping"]
interval: 10s
timeout: 5s
retries: 5
start_period: 30s
volumes:
postgres_data: null
dragonfly_data: null
networks:
trackeep-network: