- 新增PostgreSQL服务支持,使用最新版17 - 更新Docker Compose配置以支持PostgreSQL和Redis - 修改数据库连接逻辑,支持PostgreSQL和SQLite - 更新文档以反映新的数据库配置和使用方法 - 优化数据模型,确保时间戳字段支持时区
51 lines
1.1 KiB
YAML
51 lines
1.1 KiB
YAML
version: '3.8'
|
||
|
||
# 开发环境 Docker Compose
|
||
# 使用方法: docker-compose -f docker-compose.dev.yml up -d
|
||
|
||
services:
|
||
# PostgreSQL 数据库(使用最新版 17)
|
||
postgres:
|
||
image: postgres:17-alpine
|
||
container_name: life-echo-postgres-dev
|
||
ports:
|
||
- "5432:5432"
|
||
environment:
|
||
POSTGRES_USER: postgres
|
||
POSTGRES_PASSWORD: postgres
|
||
POSTGRES_DB: life_echo
|
||
volumes:
|
||
- postgres_data_dev:/var/lib/postgresql/data
|
||
restart: unless-stopped
|
||
healthcheck:
|
||
test: ["CMD-SHELL", "pg_isready -U postgres"]
|
||
interval: 10s
|
||
timeout: 5s
|
||
retries: 5
|
||
|
||
# Redis 服务(用于会话存储和 Celery)
|
||
redis:
|
||
image: redis:7-alpine
|
||
container_name: life-echo-redis-dev
|
||
ports:
|
||
- "6379:6379"
|
||
volumes:
|
||
- redis_data_dev:/data
|
||
command: redis-server --appendonly yes
|
||
restart: unless-stopped
|
||
healthcheck:
|
||
test: ["CMD", "redis-cli", "ping"]
|
||
interval: 10s
|
||
timeout: 5s
|
||
retries: 5
|
||
|
||
networks:
|
||
default:
|
||
name: life-echo-dev
|
||
|
||
volumes:
|
||
postgres_data_dev:
|
||
driver: local
|
||
redis_data_dev:
|
||
driver: local
|