Nriver / trilium-translation

Translation for Trilium Notes. Trilium Notes 中文适配, 体验优化
GNU Affero General Public License v3.0
2.51k stars 287 forks source link

Trilium docker 是不是不支持 映射到宿主机通过NFS挂载的目录 #47

Closed GerGitHub closed 1 year ago

GerGitHub commented 1 year ago

如果宿主机的目录是通过NFS挂载的共享目录,trilium过几分钟就会报错,需要刷新浏览器重新登录;

弹窗: Error when calling PUT notes/UtLliiX8PHN2: error - Unauthorized

log: [session-file-store] will retry, error on last attempt: Error: ENOENT: no such file or directory, open '/root/trilium-data/sessions/cN8YbZR35_-nZDktfLwVuCje8odMMXnz.json' PUT /api/notes/UtLliiX8PHN2 rejected with 401 Logged in session not found JS Error: Error when calling PUT notes/UtLliiX8PHN2: error - Unauthorized

Stack: Error at Object.N [as logError] (http://192.168.1.111:8080/app-dist/desktop.js:2:97436) at Object.throwError (http://192.168.1.111:8080/app-dist/desktop.js:2:82914) at c (http://192.168.1.111:8080/app-dist/desktop.js:2:79764) at async Object.error (http://192.168.1.111:8080/app-dist/desktop.js:2:80072)

如果直接挂宿主机系统自带目录就不会出现这些问题

Nriver commented 1 year ago

可能nfs挂载设置的权限不对吧

GerGitHub commented 1 year ago

开机挂载 fstab 192.1168.1.100:/notebook /opt/notebook nfs hard,rw,nolock,bg,tcp 0 0

mount 命令直接挂载试过,通docker创建nfs挂载卷也试过,权限也就上面几行,都会出问题

Nriver commented 1 year ago

ls -al 看看文件所有者是不是变了

GerGitHub commented 1 year ago

docker 建了2个容器,一个直接映射主机系统下自建目录, 一个通NFS挂载的目录 刚看了一下,ls -al 主机系统自建目录 drwxr-xr-x 5 1000 1000 4096 Feb 25 12:39 notebook1 NFS挂载的目录 drwxr-xr-x 6 root root 4096 Feb 25 12:10 notebook2

GerGitHub commented 1 year ago

这个怎么解决 主机用户 root ID 是0, trilium映射后的用户ID 是1000

hxchtiewei commented 1 year ago

docker 创建时加参数 puid=0,pgid=0