GoTest/config/prod.yaml
Table 7e5572344b fix: 修复 MySQL 容器在 rootless Docker 环境下无法正常停止的问题
主要改动:
- 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 服务
2025-11-29 06:18:17 +08:00

42 lines
761 B
YAML
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

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: 50
maxOpenConns: 500
redis:
host: redis # Docker环境使用服务名本地环境使用localhost
port: 6379
password: ""
db: 2
poolSize: 50
jwt:
secret: prod-jwt-secret-key-must-be-changed
expireHours: 8
rateLimit:
enabled: true
requests: 500
window: 60 # seconds
cors:
allowOrigins: ["https://api.example.com"]
allowMethods: ["GET", "POST", "PUT", "DELETE"]
allowHeaders: ["Content-Type", "Authorization"]
log:
level: warn
format: json
output: file