主要改动: - Docker Compose 配置优化: * 为所有环境的 MySQL 服务添加 stop_grace_period: 60s(增加优雅关闭时间) * 添加 stop_signal: SIGTERM(使用 SIGTERM 信号优雅停止) * 添加 init: true(使用 init 进程管理子进程,避免僵尸进程) - Makefile 改进: * 所有 docker-down-* 命令添加自动重试机制 * 自动检测权限错误并重启 rootless Docker 服务 * 显示完整的 Docker Compose 进度信息(包括容器状态变化) - README.md 更新: * 添加 Docker 权限问题的详细解决方案 * 包括 rootless Docker 的特殊处理方法和自动重试机制说明 问题原因: MySQL 容器在 rootless Docker 环境下停止时遇到权限问题,需要更长的优雅关闭时间来处理 InnoDB 数据文件。 解决方案: 1. 增加 stop_grace_period 到 60 秒,给 MySQL 足够时间优雅关闭 2. 使用 init 进程管理子进程,避免权限问题 3. 在 Makefile 中添加自动检测和重试机制,无需手动重启 Docker 服务
42 lines
806 B
YAML
42 lines
806 B
YAML
server:
|
||
port: 1234
|
||
mode: release
|
||
|
||
database:
|
||
host: mysql # Docker环境使用服务名,本地环境使用localhost
|
||
port: 3306
|
||
username: root
|
||
password: sasasasa
|
||
dbname: yinli
|
||
charset: utf8mb4
|
||
parseTime: true
|
||
loc: Local
|
||
maxIdleConns: 20
|
||
maxOpenConns: 200
|
||
|
||
redis:
|
||
host: redis # Docker环境使用服务名,本地环境使用localhost
|
||
port: 6379
|
||
password: ""
|
||
db: 1
|
||
poolSize: 20
|
||
|
||
jwt:
|
||
secret: stage-jwt-secret-key-change-in-production
|
||
expireHours: 12
|
||
|
||
rateLimit:
|
||
enabled: true
|
||
requests: 200
|
||
window: 60 # seconds
|
||
|
||
cors:
|
||
allowOrigins: ["http://localhost:3000", "https://stage.example.com"]
|
||
allowMethods: ["GET", "POST", "PUT", "DELETE", "OPTIONS"]
|
||
allowHeaders: ["Content-Type", "Authorization"]
|
||
|
||
log:
|
||
level: info
|
||
format: json
|
||
output: file
|