chore(docker): consolidate volume mounts to /home/neko, remove separa… - #2557
chore(docker): consolidate volume mounts to /home/neko, remove separa…#2557WUHINS wants to merge 1 commit into
Conversation
Walkthrough本次变更统一 Docker 持久化目录挂载方式:使用宿主机 ChangesDocker 家目录挂载
Estimated code review effort: 2 (Simple) | ~10 minutes Possibly related PRs
Suggested labels: Poem
🚥 Pre-merge checks | ✅ 4✅ Passed checks (4 passed)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 4
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@docker/docker-compose.yml`:
- Around line 52-53: 在部署文档中补充旧部署的一次性迁移步骤:先停止容器,将旧的 ./N.E.K.O 和 ./ssl
内容按容器内实际路径迁移到新的 ./neko-home 对应目录,确认配置、角色、记忆及证书均已复制完成后,再启动容器;同时说明空的 neko-home
会导致旧数据不可见。
In `@docker/entrypoint.sh`:
- Around line 1183-1184: Replace the unconditional recursive chown of /home/neko
in the entrypoint initialization with a non-destructive ownership strategy: use
fixed container UID/GID compatible with the host, or only create and initialize
missing required directories without recursively changing the persistent tree.
Preserve write access for the neko user while avoiding ownership changes to
existing configuration, certificate, and data files.
In `@README.MD`:
- Around line 172-173: Update the later SSL certificate path references in
README.MD to use ./neko-home/ssl/ consistently with the directory structure
shown near the neko-home entry, including guidance for locating or configuring
custom certificates.
- Around line 162-163: 更新 README.MD 中 Docker Run 示例对应的目录树,确保挂载路径与命令一致,使用
${NEKO_BASE_PATH}/neko-home 和 ${NEKO_BASE_PATH}/logs;不要保留仅表示当前目录的 neko-home/ 或
logs/ 路径。
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository UI
Review profile: CHILL
Plan: Pro Plus
Run ID: b80fe4d5-e2d8-4061-8a76-2aa0f236b29e
📒 Files selected for processing (6)
README.MDdocker/docker-compose.ymldocker/entrypoint.shdocs/deployment/docker.mddocs/ja/deployment/docker.mddocs/zh-CN/deployment/docker.md
🔗 Linked repositories identified
CodeRabbit considers these linked repositories for cross-repo context during reviews:
Project-N-E-K-O/N.E.K.O.-PC(manual) → reviewed against branchmaininstead of the default branch
| # 1. neko 用户主目录(持久化数据、SSL 证书、OpenFang 配置等) | ||
| - ./neko-home:/home/neko |
There was a problem hiding this comment.
🗄️ Data Integrity & Integration | 🟠 Major | 🏗️ Heavy lift
为旧部署补充一次性迁移步骤喵
升级后旧的 ./N.E.K.O 和 ./ssl 不再挂载,新的 ./neko-home 若为空,容器将看不到原有配置、角色、记忆和证书,表现为数据“丢失”喵。请在部署文档中明确停止容器、按实际容器路径迁移旧目录内容到 neko-home 的步骤,并说明迁移完成后再启动容器喵。
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
In `@docker/docker-compose.yml` around lines 52 - 53,
在部署文档中补充旧部署的一次性迁移步骤:先停止容器,将旧的 ./N.E.K.O 和 ./ssl 内容按容器内实际路径迁移到新的 ./neko-home
对应目录,确认配置、角色、记忆及证书均已复制完成后,再启动容器;同时说明空的 neko-home 会导致旧数据不可见。
| # 确保 home 目录对 neko 用户可写(Docker volume 可能以 root 创建) | ||
| chown -R neko:neko /home/neko |
There was a problem hiding this comment.
🗄️ Data Integrity & Integration | 🟠 Major | 🏗️ Heavy lift
不要无条件递归修改整个宿主机挂载目录的所有权喵
/home/neko 对应宿主机的 ./neko-home,因此 chown -R neko:neko 会改变宿主机上全部配置、证书和数据文件的 owner/group;若容器 UID/GID 与宿主用户不同,宿主侧可能无法正常管理这些文件喵。每次重启还会扫描整个持久化目录,数据较大时会显著拖慢启动喵。建议固定容器用户 UID/GID,或仅初始化缺失目录并避免对整个持久化树递归 chown 喵。
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
In `@docker/entrypoint.sh` around lines 1183 - 1184, Replace the unconditional
recursive chown of /home/neko in the entrypoint initialization with a
non-destructive ownership strategy: use fixed container UID/GID compatible with
the host, or only create and initialize missing required directories without
recursively changing the persistent tree. Preserve write access for the neko
user while avoiding ownership changes to existing configuration, certificate,
and data files.
| -v "${NEKO_BASE_PATH}/neko-home:/home/neko" \ | ||
| -v "${NEKO_BASE_PATH}/logs:/app/logs" \ |
There was a problem hiding this comment.
📐 Maintainability & Code Quality | 🟡 Minor | ⚡ Quick win
修正 Docker Run 示例的目录树路径喵
命令实际挂载的是 ${NEKO_BASE_PATH}/neko-home 和 ${NEKO_BASE_PATH}/logs,但下面的目录结构写成了当前目录下的 neko-home/ 与 logs/,用户容易在错误位置创建目录喵。请统一改为 ${NEKO_BASE_PATH}/neko-home、${NEKO_BASE_PATH}/logs,或将 NEKO_BASE_PATH 改为当前目录喵。
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
In `@README.MD` around lines 162 - 163, 更新 README.MD 中 Docker Run
示例对应的目录树,确保挂载路径与命令一致,使用 ${NEKO_BASE_PATH}/neko-home 和
${NEKO_BASE_PATH}/logs;不要保留仅表示当前目录的 neko-home/ 或 logs/ 路径。
| ├── neko-home/ # 用户主目录(配置、数据、SSL、OpenFang agent) | ||
| ├── logs/ # 应用日志 |
There was a problem hiding this comment.
📐 Maintainability & Code Quality | 🟡 Minor | ⚡ Quick win
同步更新后续 SSL 证书路径喵
新的目录结构将 SSL 内容归入 neko-home/,但后文仍写成证书保存在 ./ssl/,这会误导用户查找证书或配置自定义证书喵。请将相关说明统一为新挂载下的实际路径,例如 ./neko-home/ssl/ 喵。
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
In `@README.MD` around lines 172 - 173, Update the later SSL certificate path
references in README.MD to use ./neko-home/ssl/ consistently with the directory
structure shown near the neko-home entry, including guidance for locating or
configuring custom certificates.
| # 1. 持久化配置目录(XDG_DATA_HOME 规范路径) | ||
| - ./N.E.K.O:/home/neko/.local/share/N.E.K.O | ||
| # 1. neko 用户主目录(持久化数据、SSL 证书、OpenFang 配置等) | ||
| - ./neko-home:/home/neko |
There was a problem hiding this comment.
Upgrade disconnects persisted state喵
When an existing Docker installation upgrades with data in ./N.E.K.O and certificates in ./ssl, the new ./neko-home mount leaves both directories unmounted, causing the application to initialize fresh user state and replace custom certificates with a generated self-signed certificate喵
Greptile SummaryConsolidates Docker persistence into a single home-directory mount喵
Confidence Score: 3/5This PR should not merge until existing Docker installations retain or explicitly migrate their persisted application data and certificates喵 Switching directly to ./neko-home disconnects the prior ./N.E.K.O and ./ssl directories, causing upgraded deployments to initialize fresh state and certificates; the README also points users to the obsolete certificate path喵 Files Needing Attention: docker/docker-compose.yml and README.MD喵
|
| Filename | Overview |
|---|---|
| docker/docker-compose.yml | Consolidates persistent mounts but leaves existing installations' data and certificates outside the newly mounted host directory喵 |
| docker/entrypoint.sh | Applies ownership to the consolidated home and regenerates certificates when none are present at the new location喵 |
| README.MD | Updates deployment examples but retains a stale ./ssl certificate path喵 |
| docs/deployment/docker.md | Documents the consolidated persistent home mount consistently喵 |
| docs/ja/deployment/docker.md | Updates the Japanese deployment guide to the consolidated mount layout喵 |
| docs/zh-CN/deployment/docker.md | Updates the Chinese deployment guide to the consolidated mount layout喵 |
Flowchart
%%{init: {'theme': 'neutral'}}%%
flowchart LR
OldData["./N.E.K.O"] -. no longer mounted .-> Data["/home/neko/.local/share/N.E.K.O"]
OldSSL["./ssl"] -. no longer mounted .-> SSL["/home/neko/ssl"]
NewHome["./neko-home"] --> Home["/home/neko"]
Home --> Data
Home --> SSL
Comments Outside Diff (1)
-
README.MD, line 185 (link)Certificate path remains obsolete喵
The consolidated home mount stores
/home/neko/sslunder./neko-home/ssl, but this section still directs users to./ssl, so users inspect or modify a directory the container no longer uses喵Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!
Reviews (1): Last reviewed commit: "chore(docker): consolidate volume mounts..." | Re-trigger Greptile
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: d54ce21e43
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| # 1. 持久化配置目录(XDG_DATA_HOME 规范路径) | ||
| - ./N.E.K.O:/home/neko/.local/share/N.E.K.O | ||
| # 1. neko 用户主目录(持久化数据、SSL 证书、OpenFang 配置等) | ||
| - ./neko-home:/home/neko |
There was a problem hiding this comment.
Preserve existing Docker data when changing mounts
When existing Docker users update this maintained compose file in place, this mount switches the persisted host path from the previous ./N.E.K.O and ./ssl directories to a brand-new ./neko-home; the Linux runtime still resolves app data under ~/.local/share/N.E.K.O, so the container starts with an empty profile at ./neko-home/.local/share/N.E.K.O and ignores the user's existing configs, characters, memories, and certificates. Please add a compatibility/migration path or clear upgrade instructions before replacing the old mounts.
Useful? React with 👍 / 👎.
| mkdir -p /home/neko/.local/share/N.E.K.O | ||
| chown -R neko:neko /home/neko/.local/share/N.E.K.O | ||
| # 确保 home 目录对 neko 用户可写(Docker volume 可能以 root 创建) | ||
| chown -R neko:neko /home/neko |
There was a problem hiding this comment.
Keep TLS key ownership out of the app user
With the default SSL setup, setup_nginx_proxy creates or validates /home/neko/ssl/N.E.K.O.key as root and generated keys are chmodded to 600, but this new recursive chown immediately transfers the whole SSL directory to the unprivileged neko user before the Python services and user plugin host are launched as that user. For deployments that provide a real certificate, any app/plugin code running as neko can now read or replace the TLS private key; keep the chown scoped to writable data/OpenFang paths or restore root ownership on /home/neko/ssl.
Useful? React with 👍 / 👎.
| - "48912:443" # HTTPS 访问端口 | ||
| volumes: | ||
| - ./N.E.K.O:/root/Documents/N.E.K.O | ||
| - ./neko-home:/home/neko |
There was a problem hiding this comment.
Update SSL certificate paths for the new home mount
After this example stops mounting ./ssl, the README's SSL section still tells users to create and copy certificates into ./ssl/N.E.K.O.{crt,key} and to delete ssl/N.E.K.O.* for regeneration. Users following the updated compose snippet will have /home/neko/ssl backed by ./neko-home/ssl instead, so their custom certs in ./ssl are ignored and the container silently keeps/generates a different certificate; update the certificate instructions to use ./neko-home/ssl.
Useful? React with 👍 / 👎.
改动概述 / Summary
合并 Docker volume mount,将分散的
./N.E.K.O(→/home/neko/.local/share/N.E.K.O)和./ssl(→/home/neko/ssl)替换为统一的./neko-home:/home/neko,同时移除 entrypoint.sh 中多余的mkdir -p /home/neko/.local/share/N.E.K.O。回归报告 / Regression Report
不适用 — 未触碰
app/、main_logic/、memory/。不拆分理由 / Why Not Split
不适用 — 改动计入上限的文件数 = 6(≤ 20)。
测试 / Testing
Summary by CodeRabbit
neko-home持久化配置、数据及证书。