Closed Shapaper233 closed 4 months ago
要解决使用 Docker Compose 脚本运行 NekoImageGallery API 项目时与 ntqq 插件的连接问题,您需要确保服务之间可以相互通信。当前配置将服务绑定到 127.0.0.1
,这会限制它们只能在本地主机上访问,可能会导致容器之间的连接问题。
您应该更改端口绑定,以允许服务通过 Docker 网络进行通信。以下是更新后的 docker-compose.yml
:
services:
qdrant-database:
image: qdrant/qdrant:latest
ports:
- "6333:6333"
- "6334:6334"
volumes:
- "./qdrant_data:/qdrant/storage:z"
neko-image-gallery:
# Uncomment this section to build image from source code
# build:
# context: .
# dockerfile: Dockerfile
image: edgeneko/neko-image-gallery:latest
ports:
- "8000:8000"
volumes:
- "./static:/opt/NekoImageGallery/static"
environment:
- APP_QDRANT__HOST=qdrant-database
- APP_QDRANT__PORT=6333
- APP_QDRANT__GRPC_PORT=6334
- APP_QDRANT__PREFER_GRPC=True
depends_on:
- qdrant-database
deploy:
resources:
reservations:
devices:
- driver: nvidia
count: 1
capabilities:
- gpu
networks:
default:
name: neko-image-gallery
通过移除 127.0.0.1
,服务将能够通过 Docker 网络进行通信,从而解决连接问题[1]。
To continue the conversation, mention @dosu.
开启访问后确实可以访问了但是弹出这个
要解决 "Server Disconnected" 问题,您可以尝试以下步骤:
检查服务器日志:确保服务器正在运行,并检查 uvicorn
生成的日志以查找任何错误或警告。
uvicorn.run("app.webapp:app", host=args.host, port=args.port, root_path=args.root_path)
验证配置:使用 --show-config
选项打印当前配置,确保所有设置正确。
python main.py --show-config
数据库初始化:如果问题与数据库相关,可以使用 --init-database
选项初始化 qdrant 数据库。
python main.py --init-database
数据库迁移:如果有任何待处理的迁移,使用 --migrate-db
选项将数据库迁移到指定版本。
python main.py --migrate-db <version>
检查网络配置:确保服务器绑定到正确的主机和端口。默认主机是 0.0.0.0
,默认端口是 8000
。如果需要,可以指定这些选项。
python main.py --host <host> --port <port>
反向代理配置:如果服务器部署在反向代理后面,确保 root_path
设置正确。
python main.py --root-path <root_path>
通过这些步骤和检查相关日志和配置,您应该能够识别并解决 "Server Disconnected" 问题[1]。
To continue the conversation, mention @dosu.
试试直接使用浏览器访问api地址? 如果后端没有问题的话应该会有类似如下的输出:
有没有可能是因为没有图片的缘故? 话说qq插件支持上传表情吗 如何才能上传呢
参考https://github.com/hv0905/NekoImageGallery/issues/29#issuecomment-2130878080 如果你是docker部署的话,建议使用NekoImageGallery.App上传
有没有可能是因为没有图片的缘故? 话说qq插件支持上传表情吗 如何才能上传呢
qq插件目前还不支持上传图片,最近比较忙,会找时间写的😂
我使用docker-compose脚本运行了这个项目 没有做其他操作 用ntqq插件连接不上: