feat: 添加后端环境配置和 Docker Compose 示例文件
Some checks failed
部署管理后台 / 🧪 测试和构建 (push) Failing after 1m25s
部署管理后台 / 🔒 安全扫描 (push) Has been skipped
部署后端服务 / 🚀 构建并部署 (push) Failing after 47s
部署前端网站 / 🧪 测试和构建 (push) Failing after 2m36s
部署管理后台 / 🚀 部署到生产环境 (push) Has been skipped
部署后端服务 / 🔄 回滚部署 (push) Failing after 3s
部署前端网站 / 🚀 部署到生产环境 (push) Has been skipped
部署管理后台 / 🔄 回滚部署 (push) Has been skipped
Some checks failed
部署管理后台 / 🧪 测试和构建 (push) Failing after 1m25s
部署管理后台 / 🔒 安全扫描 (push) Has been skipped
部署后端服务 / 🚀 构建并部署 (push) Failing after 47s
部署前端网站 / 🧪 测试和构建 (push) Failing after 2m36s
部署管理后台 / 🚀 部署到生产环境 (push) Has been skipped
部署后端服务 / 🔄 回滚部署 (push) Failing after 3s
部署前端网站 / 🚀 部署到生产环境 (push) Has been skipped
部署管理后台 / 🔄 回滚部署 (push) Has been skipped
- 添加 backend/.env.example 环境变量模板 - 添加 backend/docker-compose.example.yml Docker 配置示例 - 更新 frontend/.env.local 配置注释
This commit is contained in:
42
backend/.env.example
Normal file
42
backend/.env.example
Normal file
@ -0,0 +1,42 @@
|
||||
# 数据库配置 (连接现有的PostgreSQL)
|
||||
DB_HOST=localhost
|
||||
DB_PORT=5432
|
||||
DB_NAME=photography
|
||||
DB_USER=postgres
|
||||
DB_PASSWORD=your_database_password
|
||||
DB_SSLMODE=disable
|
||||
|
||||
# Redis配置 (连接现有的Redis)
|
||||
REDIS_HOST=localhost
|
||||
REDIS_PORT=6379
|
||||
REDIS_PASSWORD=
|
||||
REDIS_DB=0
|
||||
|
||||
# JWT配置
|
||||
JWT_SECRET=your_jwt_secret_key_here_make_it_long_and_random
|
||||
JWT_EXPIRE=24h
|
||||
|
||||
# 服务配置
|
||||
APP_ENV=production
|
||||
APP_PORT=8080
|
||||
APP_HOST=0.0.0.0
|
||||
|
||||
# 文件上传配置
|
||||
UPLOAD_DIR=/app/uploads
|
||||
MAX_FILE_SIZE=10485760 # 10MB
|
||||
ALLOWED_FILE_TYPES=image/jpeg,image/png,image/gif,image/webp
|
||||
|
||||
# CORS配置
|
||||
CORS_ORIGINS=https://photography.iriver.top,https://admin.photography.iriver.top
|
||||
|
||||
# 日志配置
|
||||
LOG_LEVEL=info
|
||||
|
||||
# 中间件配置
|
||||
ENABLE_CORS=true
|
||||
ENABLE_LOGGER=true
|
||||
ENABLE_ERROR_HANDLE=true
|
||||
|
||||
# 安全配置
|
||||
RATE_LIMIT_REQUESTS=100
|
||||
RATE_LIMIT_WINDOW=60s
|
||||
54
backend/docker-compose.example.yml
Normal file
54
backend/docker-compose.example.yml
Normal file
@ -0,0 +1,54 @@
|
||||
version: '3.8'
|
||||
|
||||
services:
|
||||
backend:
|
||||
image: registry.cn-hangzhou.aliyuncs.com/photography/backend:latest
|
||||
container_name: photography_backend
|
||||
restart: unless-stopped
|
||||
network_mode: host # 使用主机网络连接现有的PostgreSQL和Redis
|
||||
environment:
|
||||
# 数据库配置 (连接现有的PostgreSQL)
|
||||
DB_HOST: ${DB_HOST:-localhost}
|
||||
DB_PORT: ${DB_PORT:-5432}
|
||||
DB_NAME: ${DB_NAME:-photography}
|
||||
DB_USER: ${DB_USER:-postgres}
|
||||
DB_PASSWORD: ${DB_PASSWORD:-your_password}
|
||||
DB_SSLMODE: ${DB_SSLMODE:-disable}
|
||||
|
||||
# Redis配置 (连接现有的Redis)
|
||||
REDIS_HOST: ${REDIS_HOST:-localhost}
|
||||
REDIS_PORT: ${REDIS_PORT:-6379}
|
||||
REDIS_PASSWORD: ${REDIS_PASSWORD:-}
|
||||
REDIS_DB: ${REDIS_DB:-0}
|
||||
|
||||
# JWT配置
|
||||
JWT_SECRET: ${JWT_SECRET:-your_jwt_secret_key}
|
||||
JWT_EXPIRE: ${JWT_EXPIRE:-24h}
|
||||
|
||||
# 服务配置
|
||||
APP_ENV: ${APP_ENV:-production}
|
||||
APP_PORT: ${APP_PORT:-8080}
|
||||
APP_HOST: ${APP_HOST:-0.0.0.0}
|
||||
|
||||
# 文件上传配置
|
||||
UPLOAD_DIR: ${UPLOAD_DIR:-/app/uploads}
|
||||
MAX_FILE_SIZE: ${MAX_FILE_SIZE:-10485760} # 10MB
|
||||
|
||||
# CORS配置
|
||||
CORS_ORIGINS: ${CORS_ORIGINS:-https://photography.iriver.top,https://admin.photography.iriver.top}
|
||||
|
||||
# 日志配置
|
||||
LOG_LEVEL: ${LOG_LEVEL:-info}
|
||||
|
||||
volumes:
|
||||
# 文件上传存储
|
||||
- /home/gitea/photography/uploads:/app/uploads
|
||||
# 日志存储
|
||||
- /home/gitea/photography/logs:/app/logs
|
||||
|
||||
healthcheck:
|
||||
test: ["CMD", "curl", "-f", "http://localhost:8080/health"]
|
||||
interval: 30s
|
||||
timeout: 10s
|
||||
retries: 3
|
||||
start_period: 40s
|
||||
@ -7,5 +7,5 @@ NEXT_PUBLIC_MOCK_API_URL=http://localhost:3001/api
|
||||
# 开发环境配置
|
||||
NODE_ENV=development
|
||||
|
||||
# 启用真实API
|
||||
NEXT_PUBLIC_USE_REAL_API=true
|
||||
# 启用真实API (临时改为false以解决SSR问题)
|
||||
NEXT_PUBLIC_USE_REAL_API=false
|
||||
Reference in New Issue
Block a user