feat: Multi-DB Driver
This commit is contained in:
@@ -10,49 +10,71 @@ services:
|
||||
env_file:
|
||||
- .env
|
||||
restart: always
|
||||
volumes:
|
||||
- ./data:/app/data
|
||||
stop_grace_period: ${SERVER_GRACEFUL_SHUTDOWN_TIMEOUT:-10}s
|
||||
depends_on:
|
||||
mysql:
|
||||
condition: service_healthy
|
||||
restart: true
|
||||
redis:
|
||||
condition: service_healthy
|
||||
restart: true
|
||||
healthcheck:
|
||||
test: wget -q --spider -T 10 -O /dev/null http://localhost:${PORT:-3001}/health
|
||||
interval: 30s
|
||||
timeout: 10s
|
||||
retries: 3
|
||||
start_period: 40s
|
||||
# depends_on:
|
||||
# mysql:
|
||||
# condition: service_healthy
|
||||
# restart: true
|
||||
# postgres:
|
||||
# condition: service_healthy
|
||||
# restart: true
|
||||
# redis:
|
||||
# condition: service_healthy
|
||||
# restart: true
|
||||
|
||||
mysql:
|
||||
image: mysql:8.2
|
||||
container_name: gpt-load-mysql
|
||||
restart: always
|
||||
# ports:
|
||||
# - "3306:3306"
|
||||
environment:
|
||||
MYSQL_ROOT_PASSWORD: 123456
|
||||
MYSQL_DATABASE: gpt_load
|
||||
volumes:
|
||||
- mysql_data:/var/lib/mysql
|
||||
healthcheck:
|
||||
test: ["CMD", "mysqladmin", "ping", "-h", "localhost"]
|
||||
interval: 5s
|
||||
timeout: 5s
|
||||
retries: 10
|
||||
# 如果需要安装 MySQL、PostgreSQL 或 Redis,请取消以下注释并配置相应的环境变量。
|
||||
# 并且要在上方的depends_on中取消注释相应的依赖服务。
|
||||
|
||||
redis:
|
||||
image: redis:latest
|
||||
container_name: gpt-load-redis
|
||||
restart: always
|
||||
# ports:
|
||||
# - "6379:6379"
|
||||
healthcheck:
|
||||
test: ["CMD", "redis-cli", "ping"]
|
||||
interval: 5s
|
||||
timeout: 3s
|
||||
retries: 3
|
||||
# mysql:
|
||||
# image: mysql:8.2
|
||||
# container_name: gpt-load-mysql
|
||||
# restart: always
|
||||
# ports:
|
||||
# - "3306:3306"
|
||||
# environment:
|
||||
# MYSQL_ROOT_PASSWORD: 123456
|
||||
# MYSQL_DATABASE: gpt-load
|
||||
# volumes:
|
||||
# - ./data/mysql:/var/lib/mysql
|
||||
# healthcheck:
|
||||
# test: ["CMD", "mysqladmin", "ping", "-h", "localhost"]
|
||||
# interval: 5s
|
||||
# timeout: 5s
|
||||
# retries: 10
|
||||
|
||||
volumes:
|
||||
mysql_data:
|
||||
# postgres:
|
||||
# image: "postgres:16"
|
||||
# container_name: gpt-load-postgres
|
||||
# environment:
|
||||
# POSTGRES_USER: postgres
|
||||
# POSTGRES_PASSWORD: 123456
|
||||
# POSTGRES_DB: gpt-load
|
||||
# ports:
|
||||
# - "5432:5432"
|
||||
# volumes:
|
||||
# - ./data/postgres:/var/lib/postgresql/data
|
||||
# healthcheck:
|
||||
# test: ["CMD-SHELL", "pg_isready -U postgres -d gpt-load"]
|
||||
# interval: 5s
|
||||
# timeout: 5s
|
||||
# retries: 10
|
||||
|
||||
# redis:
|
||||
# image: redis:latest
|
||||
# container_name: gpt-load-redis
|
||||
# restart: always
|
||||
# ports:
|
||||
# - "6379:6379"
|
||||
# healthcheck:
|
||||
# test: ["CMD", "redis-cli", "ping"]
|
||||
# interval: 5s
|
||||
# timeout: 3s
|
||||
# retries: 3
|
||||
|
Reference in New Issue
Block a user