fix: Docker 部署启动失败 (#1261) - #1262
Merged
Merged
Conversation
🤖 自动审查报告
📁 修改的文件
🧠 AI 代码审查意见结论Ready to Merge 结构化审查结果必要性
关联性
类型
描述完整性
风险级别
必改项
建议项
详细审查
总结: 本次 PR 彻底解决了 Docker 部署中日志目录权限不足的问题,通过在代码中实现优雅降级,并同步更新了详尽的用户文档和变更日志,形成了完善的问题解决闭环。代码、测试和文档都做得非常到位,可以安全合并。
|
Contributor
There was a problem hiding this comment.
Pull request overview
该 PR 修复了 Docker 部署场景下 logs 挂载目录不可写导致 setup_logging() 初始化日志文件失败、进而使进程启动失败的问题;通过在主入口对文件日志初始化的 OSError 做降级处理,确保仍能以控制台日志继续启动,并在文档中补充非 root 运行时的宿主机目录权限要求。
Changes:
- 在
main.py增加运行时日志初始化包装_setup_runtime_logging():文件日志初始化遇到OSError(含PermissionError)时降级为控制台日志并输出可操作的权限修复提示。 - 新增单测覆盖“文件日志不可写不阻断启动”的行为,并断言降级提示文本包含关键修复指引。
- 更新完整指南(中英文)与
docs/CHANGELOG.md,补充官方镜像非 root(UID/GID 1000)运行时挂载目录权限说明与变更记录。
Reviewed changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| main.py | 增加运行时日志初始化降级逻辑,避免 Docker 因 logs 不可写而启动失败,并输出权限修复建议。 |
| tests/test_main_schedule_mode.py | 增加回归测试,验证 setup_logging() 抛出 PermissionError 时仍可继续启动并给出提示。 |
| docs/full-guide.md | 补充非 root 容器用户(1000:1000)运行下 data/logs/reports 挂载目录权限要求与示例命令。 |
| docs/full-guide_EN.md | 同步英文文档的权限说明与示例命令。 |
| docs/CHANGELOG.md | 按 [Unreleased] 扁平格式追加一条 Docker 日志降级修复记录。 |
ZhuLinsen
commented
May 11, 2026
11 tasks
Anyone878
pushed a commit
to Anyone878/daily_stock_analysis
that referenced
this pull request
May 17, 2026
EchoingFootsteps
pushed a commit
to EchoingFootsteps/daily_stock_analysis
that referenced
this pull request
Jul 4, 2026
bmwu
pushed a commit
to bmwu/daily_stock_analysis
that referenced
this pull request
Aug 24, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
PR Type
Background And Problem
+70 / -1。Scope Of Change
docs/CHANGELOG.mddocs/full-guide.mddocs/full-guide_EN.mdmain.pytests/test_main_schedule_mode.pyDocumentation And Changelog
docs/CHANGELOG.md,docs/full-guide.md,docs/full-guide_EN.md。Issue Link
Closes #1261
Verification Commands And Results
关键输出/结论 / Key output & conclusion:
Compatibility And Risk
docs/CHANGELOG.md,docs/full-guide.md,docs/full-guide_EN.md,main.py,tests/test_main_schedule_mode.py,请重点审查变更范围、验证覆盖与发布影响。Rollback Plan
git revert <merge-commit>回滚本 PR 提交,重点确认docs/CHANGELOG.md,docs/full-guide.md,docs/full-guide_EN.md,main.py恢复正常。Acceptance Criteria
Notes
Checklist
docs/CHANGELOG.md,并在 PR 描述中说明文档落点 / Relevant docs anddocs/CHANGELOG.mdare updated, and the documentation location is stated in this PR