yisier / nps

基于NPS 0.29.10 版本二开而来,NPS接力项目。公益云NPS:https://natnps.com
GNU General Public License v3.0
2.09k stars 266 forks source link

Docker部署nps后,报错panic: open /conf/clients.json: no such file or directory #179

Closed qa137 closed 3 months ago

qa137 commented 3 months ago

NPS版本:v0.26.19 Docker版本:V4.29.0 (145265)

通过Docker部署nps,会出现以下异常信息:

docker run -d --restart=always --name nps --net=host -v /Users/admin/conf:/conf -v /etc/localtime:/etc/localtime:ro yisier1/nps 是否缺少文件??

2024-06-14 17:20:27 2024/06/14 17:20:27.195 [I] [connection.go:36] server start, the bridge type is tcp, the bridge port is 8025 2024-06-14 17:20:27 panic: open /conf/clients.json: no such file or directory 2024-06-14 17:20:27 2024-06-14 17:20:27 goroutine 30 [running]: 2024-06-14 17:20:27 ehang.io/nps/lib/file.loadSyncMapFromFile({0xc000437380?, 0x2?}, 0xc00009dd68) 2024-06-14 17:20:27 /go/src/ehang.io/nps/lib/file/file.go:163 +0x9e 2024-06-14 17:20:27 ehang.io/nps/lib/file.(JsonDb).LoadClientFromJsonFile(...) 2024-06-14 17:20:27 /go/src/ehang.io/nps/lib/file/file.go:61 2024-06-14 17:20:27 ehang.io/nps/lib/file.GetDb.func1() 2024-06-14 17:20:27 /go/src/ehang.io/nps/lib/file/db.go:29 +0x54 2024-06-14 17:20:27 sync.(Once).doSlow(0xab0073?, 0xc0004e1e40?) 2024-06-14 17:20:27 /usr/local/go/src/sync/once.go:74 +0xc2 2024-06-14 17:20:27 sync.(*Once).Do(...) 2024-06-14 17:20:27 /usr/local/go/src/sync/once.go:65 2024-06-14 17:20:27 ehang.io/nps/lib/file.GetDb() 2024-06-14 17:20:27 /go/src/ehang.io/nps/lib/file/db.go:27 +0x2c 2024-06-14 17:20:27 ehang.io/nps/server.InitFromCsv() 2024-06-14 17:20:27 /go/src/ehang.io/nps/server/server.go:45 +0x13c 2024-06-14 17:20:27 ehang.io/nps/server.NewMode(0xc0000b84d0, 0xc00016c000) 2024-06-14 17:20:27 /go/src/ehang.io/nps/server/server.go:140 +0x2cb 2024-06-14 17:20:27 ehang.io/nps/server.StartNewServer(0x1f59, 0xc00016c000, {0xc00012a0a6, 0x3}, 0x3c) 2024-06-14 17:20:27 /go/src/ehang.io/nps/server/server.go:103 +0x46b 2024-06-14 17:20:27 created by main.run in goroutine 21 2024-06-14 17:20:27 /go/src/ehang.io/nps/cmd/nps/nps.go:243 +0x253 2024-06-14 17:20:27 panic: open /conf/clients.json: no such file or directory

qa137 commented 3 months ago

感谢,已解决。目录挂载后,会覆盖原有conf目录下的文件。在挂载的目录添加缺失的文件即可