Skip to content

chore(docker): consolidate volume mounts to /home/neko, remove separa… - #2557

Open
WUHINS wants to merge 1 commit into
Project-N-E-K-O:mainfrom
WUHINS:main
Open

chore(docker): consolidate volume mounts to /home/neko, remove separa…#2557
WUHINS wants to merge 1 commit into
Project-N-E-K-O:mainfrom
WUHINS:main

Conversation

@WUHINS

@WUHINS WUHINS commented Jul 29, 2026

Copy link
Copy Markdown
Member

改动概述 / 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

  • 本地 diff 验证:6 个文件合计 +10/-19 行,语义正确
  • CI 将验证 Docker build 是否通过

Summary by CodeRabbit

  • 文档
    • 更新 Docker 部署说明,统一使用 neko-home 持久化配置、数据及证书。
    • 同步更新中、日文部署文档,并保留日志挂载说明。
  • 改进
    • Docker 容器现在统一管理用户目录权限,简化部署配置。

@coderabbitai

coderabbitai Bot commented Jul 29, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

Walkthrough

本次变更统一 Docker 持久化目录挂载方式:使用宿主机 neko-home 对应容器 /home/neko,入口脚本同步调整权限处理,并更新 README 与多语言部署文档中的示例喵。

Changes

Docker 家目录挂载

Layer / File(s) Summary
挂载与权限处理
docker/docker-compose.yml, docker/entrypoint.sh
Compose 将 ./neko-home 整体挂载到 /home/neko,入口脚本递归将该目录归属调整为 neko 用户喵。
部署示例与目录说明
README.MD, docs/deployment/docker.md, docs/ja/deployment/docker.md, docs/zh-CN/deployment/docker.md
部署文档将旧的 N.E.K.Ossl 挂载示例替换为 neko-home,并保留日志目录挂载说明喵。

Estimated code review effort: 2 (Simple) | ~10 minutes

Possibly related PRs

Suggested labels: enhancement

Poem

neko-home 承载新家喵
数据证书一起住下喵
权限整理不落下喵
日志仍在老地方喵
Docker 启航,喵呜出发喵

🚥 Pre-merge checks | ✅ 4
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed 标题与变更一致,准确概括了统一 Docker volume mounts 并移除多余目录创建的主要改动喵。
Description check ✅ Passed 描述包含 Summary、回归报告、不拆分理由和测试,且各项与模板要求基本一致喵。
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@coderabbitai coderabbitai Bot added the enhancement New feature or request label Jul 29, 2026

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

📥 Commits

Reviewing files that changed from the base of the PR and between 35073e4 and d54ce21.

📒 Files selected for processing (6)
  • README.MD
  • docker/docker-compose.yml
  • docker/entrypoint.sh
  • docs/deployment/docker.md
  • docs/ja/deployment/docker.md
  • docs/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 branch main instead of the default branch

Comment thread docker/docker-compose.yml
Comment on lines +52 to +53
# 1. neko 用户主目录(持久化数据、SSL 证书、OpenFang 配置等
- ./neko-home:/home/neko

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🗄️ 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 会导致旧数据不可见。

Comment thread docker/entrypoint.sh
Comment on lines +1183 to +1184
# 确保 home 目录对 neko 用户可写(Docker volume 可能以 root 创建)
chown -R neko:neko /home/neko

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🗄️ 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.

Comment thread README.MD
Comment on lines +162 to 163
-v "${NEKO_BASE_PATH}/neko-home:/home/neko" \
-v "${NEKO_BASE_PATH}/logs:/app/logs" \

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

📐 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/ 路径。

Comment thread README.MD
Comment on lines +172 to 173
├── neko-home/ # 用户主目录(配置、数据、SSL、OpenFang agent)
├── logs/ # 应用日志

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

📐 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.

Comment thread docker/docker-compose.yml
# 1. 持久化配置目录(XDG_DATA_HOME 规范路径
- ./N.E.K.O:/home/neko/.local/share/N.E.K.O
# 1. neko 用户主目录(持久化数据、SSL 证书、OpenFang 配置等
- ./neko-home:/home/neko

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 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-apps

greptile-apps Bot commented Jul 29, 2026

Copy link
Copy Markdown
Contributor

Greptile Summary

Consolidates Docker persistence into a single home-directory mount喵

  • Replaces the separate application-data and TLS mounts with ./neko-home:/home/neko喵
  • Broadens startup ownership correction to the mounted home directory喵
  • Updates the English, Japanese, and Chinese deployment documentation for the consolidated layout喵

Confidence Score: 3/5

This 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喵

Important Files Changed

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
Loading

Comments Outside Diff (1)

  1. README.MD, line 185 (link)

    P2 Certificate path remains obsolete喵

    The consolidated home mount stores /home/neko/ssl under ./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

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 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".

Comment thread docker/docker-compose.yml
# 1. 持久化配置目录(XDG_DATA_HOME 规范路径
- ./N.E.K.O:/home/neko/.local/share/N.E.K.O
# 1. neko 用户主目录(持久化数据、SSL 证书、OpenFang 配置等
- ./neko-home:/home/neko

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge 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 👍 / 👎.

Comment thread docker/entrypoint.sh
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

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge 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 👍 / 👎.

Comment thread README.MD
- "48912:443" # HTTPS 访问端口
volumes:
- ./N.E.K.O:/root/Documents/N.E.K.O
- ./neko-home:/home/neko

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge 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 👍 / 👎.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant