Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

docker部署报错 #26

Open
Longxin789 opened this issue Jun 11, 2023 · 19 comments
Open

docker部署报错 #26

Longxin789 opened this issue Jun 11, 2023 · 19 comments

Comments

@Longxin789
Copy link

[poe-openai-proxy-external-1]容器日志
Traceback (most recent call last):
File "/app/api.py", line 30, in
config = toml.load(config_path)
File "/usr/local/lib/python3.9/site-packages/toml/decoder.py", line 133, in load
with io.open(_getpath(f), encoding='utf-8') as ffile:
IsADirectoryError: [Errno 21] Is a directory: '/app/../config.toml'
Traceback (most recent call last):
File "/app/api.py", line 30, in
config = toml.load(config_path)
File "/usr/local/lib/python3.9/site-packages/toml/decoder.py", line 133, in load
with io.open(_getpath(f), encoding='utf-8') as ffile:
IsADirectoryError: [Errno 21] Is a directory: '/app/../config.toml'
[poe-openai-proxy-api-1]容器日志
panic: read config.toml: is a directory

goroutine 1 [running]:
github.com/juzeon/poe-openai-proxy/conf.Setup()
/app/conf/conf.go:45 +0x5be
main.main()
/app/main.go:12 +0x1d
panic: read config.toml: is a directory

goroutine 1 [running]:
github.com/juzeon/poe-openai-proxy/conf.Setup()
/app/conf/conf.go:45 +0x5be
main.main()
/app/main.go:12 +0x1d
panic: read config.toml: is a directory

goroutine 1 [running]:
github.com/juzeon/poe-openai-proxy/conf.Setup()
/app/conf/conf.go:45 +0x5be
main.main()
/app/main.go:12 +0x1d
通过你的教程创建好配置文件后,通过命令部署docker,显示是成功的。下面是命令里面的显示:
✔ Network poe-openai-proxy_default Created 0.3s
✔ Container poe-openai-proxy-external-1 Started 2.7s
✔ Container poe-openai-proxy-api-1 Started 3.2s
但是通过宝塔查看容器发现是停止状态,并且端口未进行使用,无法启动,提示启动失败,查看日志就是上面的信息,帮忙看看是什么问题!!

@juzeon
Copy link
Owner

juzeon commented Jun 11, 2023

panic: read config.toml: is a directory

请检查一下是否正确配置了config.toml文件,应该和main.go放在相同目录下。

@Longxin789
Copy link
Author

是在同一目录下,然后配置里面我只将http://localhost:5100改成了http://external:5100,其他均为默认

@Longxin789
Copy link
Author

另外我发现主目录里面会自动创建一个config.toml文件夹,就算删除启动命令也会重新创建

@Longxin789
Copy link
Author

@juzeon

@juzeon
Copy link
Owner

juzeon commented Jun 12, 2023

先更新下docker版本?

如果还不行,可以试试改一下Dockerfile,把整个目录挂载进去,而不是只有config.toml这一个文件。

@Longxin789
Copy link
Author

直接按照教程来的,docker是最新的,这个挂载他不就是一个目录吗

@juzeon
Copy link
Owner

juzeon commented Jun 13, 2023

尝试参考一下这里是否有解决方案:https://stackoverflow.com/questions/34134343/single-file-volume-mounted-as-directory-in-docker

@Longxin789
Copy link
Author

不行,老客疼,搭建其他chatweb都可以的

@Longxin789
Copy link
Author

终于成功启动了,但是api返回{
"error": true,
"message": "Failed to fetch"
}
是什么原因 @juzeon

@Longxin789
Copy link
Author

这是现在的日志
INFO: registering client: ok
[GIN-debug] [WARNING] Creating an Engine instance with the Logger and Recovery middleware already attached.

[GIN-debug] [WARNING] Running in "debug" mode. Switch to "release" mode in production.

  • using env: export GIN_MODE=release
  • using code: gin.SetMode(gin.ReleaseMode)

[GIN-debug] GET /models --> github.com/juzeon/poe-openai-proxy/router.Setup.func1 (3 handlers)
[GIN-debug] GET /v1/models --> github.com/juzeon/poe-openai-proxy/router.Setup.func1 (3 handlers)
[GIN-debug] POST /chat/completions --> github.com/juzeon/poe-openai-proxy/router.Setup.func2 (3 handlers)
[GIN-debug] POST /v1/chat/completions --> github.com/juzeon/poe-openai-proxy/router.Setup.func2 (3 handlers)
[GIN-debug] OPTIONS /chat/completions --> github.com/juzeon/poe-openai-proxy/router.Setup.func3 (3 handlers)
[GIN-debug] OPTIONS /v1/chat/completions --> github.com/juzeon/poe-openai-proxy/router.Setup.func3 (3 handlers)
[GIN-debug] [WARNING] You trusted all proxies, this is NOT safe. We recommend you to set a value.
Please check https://pkg.go.dev/github.com/gin-gonic/gin#readme-don-t-trust-all-proxies for details.
[GIN-debug] Listening and serving HTTP on :3700
[GIN] 2023/06/14 - 11:16:01 | 404 | 500ns | 18.136.166.78 | GET "/v1/chat/completions"
[GIN] 2023/06/14 - 11:16:03 | 404 | 700ns | 18.136.166.78 | GET "/v1/chat/completions"

@Longxin789
Copy link
Author

  • Serving Flask app 'api'
  • Debug mode: off
    INFO:werkzeug:�[31m�[1mWARNING: This is a development server. Do not use it in a production deployment. Use a production WSGI server instead.�[0m
  • Running on all addresses (0.0.0.0)
  • Running on http://127.0.0.1:5100
  • Running on http://172.19.0.2:5100
    INFO:werkzeug:�[33mPress CTRL+C to quit�[0m
    INFO:werkzeug:172.19.0.3 - - [14/Jun/2023 11:15:20] "POST /add_token HTTP/1.1" 200 -

@juzeon
Copy link
Owner

juzeon commented Jun 14, 2023

[GIN] 2023/06/14 - 11:16:01 | 404 | 500ns | 18.136.166.78 | GET "/v1/chat/completions"
[GIN] 2023/06/14 - 11:16:03 | 404 | 700ns | 18.136.166.78 | GET "/v1/chat/completions"

看日志请求成GET了。不支持GET,需要使用POST。

@Longxin789
Copy link
Author

get是我直接访问的网页,而调用接口,那里没有记录

@Longxin789
Copy link
Author

@juzeon 比如我在这个网站调用api。https://bettergpt.chat/ 我api地址填的是http://IP:3700/v1/chat/completions 密钥空白 然后就是返回Failed to fetch 日志没有记录

@juzeon
Copy link
Owner

juzeon commented Jun 14, 2023

F12 Network看看网络请求记录,检查一下是否调用了正确的接口。如有错误,检查一下错误是什么。

@Longxin789
Copy link
Author

可以了,感谢大佬

@Longxin789
Copy link
Author

@juzeon 如何使用多个token

@Longxin789
Copy link
Author

查看了以往的记录,知道怎么使用了,感谢

@yyx20202020
Copy link

可以了,感谢大佬

您好,我跟你一样的问题,显示Failed to fetch,一直没解决;请问你怎么解决的啊

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants