Skip to content

Commit

Permalink
feat: add dockerfile & chart of fschat-server
Browse files Browse the repository at this point in the history
  • Loading branch information
Lanture1064 committed Jul 21, 2023
1 parent 706ee8a commit 9119d0f
Show file tree
Hide file tree
Showing 7 changed files with 126 additions and 1 deletion.
2 changes: 1 addition & 1 deletion charts/llms/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -21,4 +21,4 @@ version: 0.1.0
# incremented each time you make changes to the application. Versions are not expected to
# follow Semantic Versioning. They should reflect the version the application is using.
# It is recommended to use it with quotes.
appVersion: "0.0.0"
appVersion: "0.1.0"
26 changes: 26 additions & 0 deletions charts/llms/templates/deployment.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
apiVersion: apps/v1
kind: Deployment
metadata:
name: fschat
spec:
replicas: 1
selector:
matchLabels:
app: fschat
template:
metadata:
labels:
app: fschat
spec:
containers:
- name: fschat-controller
image: fastchat:latest
command: ["python3.9", "-m", "fastchat.serve.controller"]
ports:
- containerPort: 21001

- name: fschat-api
image: fastchat:latest
command: ["python3.9", "-m", "fastchat.serve.openai_api_server"]
ports:
- containerPort: 8000
23 changes: 23 additions & 0 deletions charts/llms/templates/ingress.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
name: fschat-ingress
spec:
rules:
- host: fschat.server.com
http:
paths:
- path: /controller
pathType: Prefix
backend:
service:
name: fschat-service
port:
number: 21001
- path: /openai
pathType: Prefix
backend:
service:
name: fschat-service
port:
number: 8000
19 changes: 19 additions & 0 deletions charts/llms/templates/pod.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
apiVersion: v1
kind: Pod
metadata:
name: fschat
labels:
app: fschat
spec:
containers:
- name: fschat-controller
image: fastchat:latest
command: ["python3.9", "-m", "fastchat.serve.controller"]
ports:
- containerPort: 21001

- name: fschat-api-server
image: fastchat:latest
command: ["python3.9", "-m", "fastchat.serve.openai_api_server"]
ports:
- containerPort: 8000
15 changes: 15 additions & 0 deletions charts/llms/templates/service.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
apiVersion: v1
kind: Service
metadata:
name: fschat-service
spec:
type: NodePort
selector:
app: fschat
ports:
- name: controller
port: 21001
targetPort: 21001
- name: api-server
port: 8000
targetPort: 8000
6 changes: 6 additions & 0 deletions llms/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
FROM ubuntu:20.04

RUN apt-get update -y && apt-get install -y python3 python3-pip libgl1 libglib2.0-0 curl
RUN curl https://bootstrap.pypa.io/get-pip.py -o get-pip.py
RUN python3 get-pip.py
RUN pip3 install supervisor -i https://pypi.mirrors.ustc.edu.cn/simple/
36 changes: 36 additions & 0 deletions llms/docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
version: "3.9"

services:
fastchat-controller:
build:
context: .
dockerfile: Dockerfile
image: fastchat:latest
ports:
- "21001:21001"
entrypoint: ["python3.9", "-m", "fastchat.serve.controller", "--host", "0.0.0.0", "--port", "21001"]
# fastchat-model-worker:
# build:
# context: .
# dockerfile: Dockerfile
# volumes:
# - huggingface:/root/.cache/huggingface
# image: fastchat:latest
# deploy:
# resources:
# reservations:
# devices:
# - driver: nvidia
# count: 1
# capabilities: [gpu]
# entrypoint: ["python3.9", "-m", "fastchat.serve.model_worker", "--model-names", "${FASTCHAT_WORKER_MODEL_NAMES:-vicuna-7b-v1.3}", "--model-path", "${FASTCHAT_WORKER_MODEL_PATH:-lmsys/vicuna-7b-v1.3}", "--worker-address", "http://fastchat-model-worker:21002", "--controller-address", "http://fastchat-controller:21001", "--host", "0.0.0.0", "--port", "21002"]
fastchat-api-server:
build:
context: .
dockerfile: Dockerfile
image: fastchat:latest
ports:
- "8000:8000"
entrypoint: ["python3.9", "-m", "fastchat.serve.openai_api_server", "--controller-address", "http://fastchat-controller:21001", "--host", "0.0.0.0", "--port", "8000"]
volumes:
huggingface: # /root/.cache/huggingface 或未来构建的 git 服务

0 comments on commit 9119d0f

Please sign in to comment.