🚀 主要功能: - 完善后端API服务层,实现完整的CRUD操作 - 开发管理后台所有核心页面 (仪表板、照片、分类、标签、用户、设置) - 完成前后端完全集成,所有API接口正常对接 - 配置完整的CI/CD流水线,支持自动化部署 🎯 后端完善: - 实现PhotoService, CategoryService, TagService, UserService - 添加完整的API处理器和路由配置 - 支持Docker容器化部署 - 添加数据库迁移和健康检查 🎨 管理后台完成: - 仪表板: 实时统计数据展示 - 照片管理: 完整的CRUD操作,支持批量处理 - 分类管理: 树形结构展示和管理 - 标签管理: 颜色标签和统计信息 - 用户管理: 角色权限控制 - 系统设置: 多标签配置界面 - 添加pre-commit代码质量检查 🔧 部署配置: - Docker Compose完整配置 - 后端CI/CD流水线 (Docker部署) - 管理后台CI/CD流水线 (静态文件部署) - 前端CI/CD流水线优化 - 自动化脚本: 部署、备份、监控 - 完整的部署文档和运维指南 ✅ 集成完成: - 所有API接口正常连接 - 认证系统完整集成 - 数据获取和状态管理 - 错误处理和用户反馈 - 响应式设计优化
128 lines
3.0 KiB
YAML
128 lines
3.0 KiB
YAML
version: '3.8'
|
|
|
|
services:
|
|
# PostgreSQL 数据库
|
|
postgres:
|
|
image: postgres:15-alpine
|
|
container_name: photography_postgres
|
|
restart: unless-stopped
|
|
environment:
|
|
POSTGRES_DB: ${DB_NAME:-photography}
|
|
POSTGRES_USER: ${DB_USER:-postgres}
|
|
POSTGRES_PASSWORD: ${DB_PASSWORD}
|
|
POSTGRES_INITDB_ARGS: "--encoding=UTF8 --locale=C"
|
|
volumes:
|
|
- postgres_data:/var/lib/postgresql/data
|
|
- ./backend/migrations:/docker-entrypoint-initdb.d
|
|
ports:
|
|
- "127.0.0.1:5432:5432"
|
|
networks:
|
|
- photography_network
|
|
healthcheck:
|
|
test: ["CMD-SHELL", "pg_isready -U ${DB_USER:-postgres} -d ${DB_NAME:-photography}"]
|
|
interval: 30s
|
|
timeout: 10s
|
|
retries: 5
|
|
|
|
# Redis 缓存
|
|
redis:
|
|
image: redis:7-alpine
|
|
container_name: photography_redis
|
|
restart: unless-stopped
|
|
command: redis-server --appendonly yes --requirepass ${REDIS_PASSWORD}
|
|
volumes:
|
|
- redis_data:/data
|
|
ports:
|
|
- "127.0.0.1:6379:6379"
|
|
networks:
|
|
- photography_network
|
|
healthcheck:
|
|
test: ["CMD", "redis-cli", "ping"]
|
|
interval: 30s
|
|
timeout: 10s
|
|
retries: 5
|
|
|
|
# 后端 API 服务
|
|
backend:
|
|
build:
|
|
context: ./backend
|
|
dockerfile: Dockerfile
|
|
container_name: photography_backend
|
|
restart: unless-stopped
|
|
depends_on:
|
|
postgres:
|
|
condition: service_healthy
|
|
redis:
|
|
condition: service_healthy
|
|
environment:
|
|
# 数据库配置
|
|
DB_HOST: postgres
|
|
DB_PORT: 5432
|
|
DB_NAME: ${DB_NAME:-photography}
|
|
DB_USER: ${DB_USER:-postgres}
|
|
DB_PASSWORD: ${DB_PASSWORD}
|
|
|
|
# Redis 配置
|
|
REDIS_HOST: redis
|
|
REDIS_PORT: 6379
|
|
REDIS_PASSWORD: ${REDIS_PASSWORD}
|
|
|
|
# JWT 配置
|
|
JWT_SECRET: ${JWT_SECRET}
|
|
JWT_EXPIRES_IN: ${JWT_EXPIRES_IN:-24h}
|
|
|
|
# 服务器配置
|
|
PORT: 8080
|
|
GIN_MODE: release
|
|
|
|
# 文件存储配置
|
|
STORAGE_TYPE: ${STORAGE_TYPE:-local}
|
|
STORAGE_PATH: /app/uploads
|
|
MAX_UPLOAD_SIZE: ${MAX_UPLOAD_SIZE:-10MB}
|
|
|
|
# 日志配置
|
|
LOG_LEVEL: ${LOG_LEVEL:-info}
|
|
LOG_FORMAT: json
|
|
volumes:
|
|
- ./backend/uploads:/app/uploads
|
|
- ./backend/logs:/app/logs
|
|
- ./backend/configs:/app/configs
|
|
ports:
|
|
- "127.0.0.1:8080:8080"
|
|
networks:
|
|
- photography_network
|
|
healthcheck:
|
|
test: ["CMD", "wget", "--no-verbose", "--tries=1", "--spider", "http://localhost:8080/health"]
|
|
interval: 30s
|
|
timeout: 10s
|
|
retries: 5
|
|
start_period: 60s
|
|
|
|
# 数据库备份服务
|
|
backup:
|
|
image: postgres:15-alpine
|
|
container_name: photography_backup
|
|
restart: "no"
|
|
depends_on:
|
|
- postgres
|
|
environment:
|
|
PGPASSWORD: ${DB_PASSWORD}
|
|
volumes:
|
|
- ./backups:/backups
|
|
- ./scripts/backup.sh:/backup.sh
|
|
networks:
|
|
- photography_network
|
|
entrypoint: ["/backup.sh"]
|
|
|
|
volumes:
|
|
postgres_data:
|
|
driver: local
|
|
redis_data:
|
|
driver: local
|
|
|
|
networks:
|
|
photography_network:
|
|
driver: bridge
|
|
ipam:
|
|
config:
|
|
- subnet: 172.20.0.0/16 |