详见我的上一篇文章: 清华开源语言大模型ChatGLM3部署实战
详见我的上一篇文章: 清华开源语言大模型ChatGLM3联通one-api实现快速部署
# 安装 Docker
curl -fsSL https://get.docker.com | bash -s docker --mirror Aliyun
systemctl enable --now docker
# 安装 docker-compose
curl -L https://github.com/docker/compose/releases/download/2.20.3/docker-compose-`uname -s`-`uname -m` -o /usr/local/bin/docker-compose
chmod +x /usr/local/bin/docker-compose
# 验证安装
docker -v
docker-compose -v
mkdir fastgpt
cd fastgpt
curl -O https://raw.githubusercontent.com/labring/FastGPT/main/files/deploy/fastgpt/docker-compose.yml
curl -O https://raw.githubusercontent.com/labring/FastGPT/main/projects/app/data/config.json
# 非 host 版本, 不使用本机代理
version: '3.3'
services:
pg:
image: ankane/pgvector:v0.5.0 # git
# image: registry.cn-hangzhou.aliyuncs.com/fastgpt/pgvector:v0.5.0 # 阿里云
container_name: fastgpt-pg
restart: always
ports: # 生产环境建议不要暴露
- 5432:5432
networks:
- fastgpt
environment:
# 这里的配置只有首次运行生效。修改后,重启镜像是不会生效的。需要把持久化数据删除再重启,才有效果
- POSTGRES_USER=username
- POSTGRES_PASSWORD=password
- POSTGRES_DB=postgres
volumes:
- ./pg/data:/var/lib/postgresql/data
mongo:
image: mongo:5.0.18
# image: registry.cn-hangzhou.aliyuncs.com/fastgpt/mongo:5.0.18 # 阿里云
container_name: fastgpt-mongo
restart: always
ports: # 生产环境建议不要暴露
- 27017:27017
networks:
- fastgpt
environment:
# 这里的配置只有首次运行生效。修改后,重启镜像是不会生效的。需要把持久化数据删除再重启,才有效果
- MONGO_INITDB_ROOT_USERNAME=username
- MONGO_INITDB_ROOT_PASSWORD=password
volumes:
- ./mongo/data:/data/db
fastgpt:
container_name: fastgpt-fastgpt
image: ghcr.io/labring/fastgpt:latest # git
# image: registry.cn-hangzhou.aliyuncs.com/fastgpt/fastgpt:latest # 阿里云
ports:
- 3000:3000
networks:
- fastgpt
depends_on:
- mongo
- pg
restart: always
environment:
# root 密码,用户名为: root
- DEFAULT_ROOT_PSW=1234
# 中转地址,如果是用官方号,不需要管,https://api.openai.com/v1
- OPENAI_BASE_URL=http://192.168.225.97:3001/v1
- CHAT_API_KEY=sk-rYmgZkdQg0a3IMGB6452E94bFd574d6fB7A452C7D9C1B96c
- DB_MAX_LINK=5 # database max link
- TOKEN_KEY=any
- ROOT_KEY=root_key
- FILE_TOKEN_KEY=filetoken
# mongo 配置,不需要改. 如果连不上,可能需要去掉 ?authSource=admin
- MONGODB_URI=mongodb://username:password@mongo:27017/fastgpt?authSource=admin
# pg配置. 不需要改
- PG_URL=postgresql://username:password@pg:5432/postgres
volumes:
- ./config.json:/app/data/config.json
networks:
fastgpt:
# host 版本, 不推荐。
# version: '3.3'
# services:
# pg:
# image: ankane/pgvector:v0.5.0 # dockerhub
# # image: registry.cn-hangzhou.aliyuncs.com/fastgpt/pgvector:v0.5.0 # 阿里云
# container_name: pg
# restart: always
# ports: # 生产环境建议不要暴露
# - 5432:5432
# environment:
# # 这里的配置只有首次运行生效。修改后,重启镜像是不会生效的。需要把持久化数据删除再重启,才有效果
# - POSTGRES_USER=username
# - POSTGRES_PASSWORD=password
# - POSTGRES_DB=postgres
# volumes:
# - ./pg/data:/var/lib/postgresql/data
# mongo:
# image: mongo:5.0.18
# # image: registry.cn-hangzhou.aliyuncs.com/fastgpt/mongo:5.0.18 # 阿里云
# container_name: mongo
# restart: always
# ports: # 生产环境建议不要暴露
# - 27017:27017
# environment:
# # 这里的配置只有首次运行生效。修改后,重启镜像是不会生效的。需要把持久化数据删除再重启,才有效果
# - MONGO_INITDB_ROOT_USERNAME=username
# - MONGO_INITDB_ROOT_PASSWORD=password
# volumes:
# - ./mongo/data:/data/db
# - ./mongo/logs:/var/log/mongodb
# fastgpt:
# # image: ghcr.io/labring/fastgpt:latest # github
# image: registry.cn-hangzhou.aliyuncs.com/fastgpt/fastgpt:latest # 阿里云
# network_mode: host
# restart: always
# container_name: fastgpt
# environment:
# # root 密码,用户名为: root
# - DEFAULT_ROOT_PSW=1234
# # 中转地址,如果是用官方号,不需要管
# - OPENAI_BASE_URL=https://api.openai.com/v1
# - CHAT_API_KEY=sk-xxxx
# - DB_MAX_LINK=5 # database max link
# # token加密凭证(随便填,作为登录凭证)
# - TOKEN_KEY=any
# # root key, 最高权限,可以内部接口互相调用
# - ROOT_KEY=root_key
# # mongo 配置,不需要改
# - MONGODB_URI=mongodb://username:[email protected]:27017/fastgpt?authSource=admin
# # pg配置. 不需要改
# - PG_URL=postgresql://username:[email protected]:5432/postgres
{
"SystemParams": {
"pluginBaseUrl": "",
"openapiPrefix": "openapi",
"vectorMaxProcess": 15,
"qaMaxProcess": 15,
"pgIvfflatProbe": 10
},
"ChatModels": [
{
"model": "ChatGLM3",
"name": "ChatGLM3",
"price": 0,
"maxToken": 4000,
"quoteMaxToken": 2000,
"maxTemperature": 1.2,
"censor": false,
"defaultSystemChatPrompt": ""
}
],
"QAModels": [
{
"model": "ChatGLM3",
"name": "ChatGLM3",
"maxToken": 8000,
"price": 0
}
],
"CQModels": [
{
"model": "ChatGLM3",
"name": "ChatGLM3",
"maxToken": 8000,
"price": 0,
"functionCall": true,
"functionPrompt": ""
}
],
"ExtractModels": [
{
"model": "ChatGLM3",
"name": "ChatGLM3",
"maxToken": 8000,
"price": 0,
"functionCall": true,
"functionPrompt": ""
}
],
"QGModels": [
{
"model": "ChatGLM3",
"name": "ChatGLM3",
"maxToken": 4000,
"price": 0
}
],
"VectorModels": [
{
"model": "m3e-base",
"name": "m3e-base",
"price": 0.2,
"defaultToken": 700,
"maxToken": 3000
},
{
"model": "m3e-base",
"name": "m3e-base",
"price": 0.1,
"defaultToken": 500,
"maxToken": 1800
}
]
}
# 在 docker-compose.yml 同级目录下执行
docker-compose pull
docker-compose up -d