From 2d456abaa56b6b7126fc6b8a0c509a153a0e0652 Mon Sep 17 00:00:00 2001 From: joecryptotoo <80373433+joecryptotoo@users.noreply.github.com> Date: Thu, 22 Jun 2023 10:08:37 -0700 Subject: [PATCH 1/6] Update docker-compose.yml --- docker-compose.yml | 31 ++++++++++++++++++++++++++----- 1 file changed, 26 insertions(+), 5 deletions(-) diff --git a/docker-compose.yml b/docker-compose.yml index dca53ef2b..6938457c4 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -1,14 +1,35 @@ version: '3.10' services: + db: + image: mysql:8.0.33 + environment: + MYSQL_DATABASE: 'db' + MYSQL_USER: 'user' + MYSQL_PASSWORD: 'password' + MYSQL_ROOT_PASSWORD: 'aa123456' + ports: + - 3306:3306 + volumes: + - my-db:/var/lib/mysql + restart: unless-stopped db-gpt: build: context: . dockerfile: Dockerfile - image: db-gpt:latest - container_name: db-gpt + container_name: db-gpt ports: - - 8000:8000 - - 3306:3306 + - 7860:7860 + expose: + - 7860 restart: unless-stopped - read-only: true + deploy: + resources: + reservations: + devices: + - driver: nvidia + device_ids: ['1', '0'] + capabilities: [gpu] + +volumes: + my-db: From b968727836e28d6b19cdde391739df4cd8dd26f9 Mon Sep 17 00:00:00 2001 From: joecryptotoo <80373433+joecryptotoo@users.noreply.github.com> Date: Thu, 22 Jun 2023 10:12:13 -0700 Subject: [PATCH 2/6] Update Dockerfile --- Dockerfile | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/Dockerfile b/Dockerfile index e049bc166..297e5d8cc 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,4 +1,4 @@ -FROM ubuntu:latest +FROM nvidia/cuda:11.8.0-devel-ubuntu22.04 RUN apt-get update && apt-get install -y \ git \ @@ -12,10 +12,8 @@ COPY . /app RUN pip install -r requirements.txt -EXPOSE 3306 +EXPOSE 7860 EXPOSE 8000 CMD ["python", "pilot/server/llmserver.py"] CMD ["python", "pilot/server/webserver.py"] - - From dc8f62f3f82e2eab935f4b8e5183d544ff7cb401 Mon Sep 17 00:00:00 2001 From: Joe Crypto Date: Thu, 22 Jun 2023 18:41:55 +0000 Subject: [PATCH 3/6] fixed docker compose --- .dockerignore | 1 + .gitignore | 4 ++-- Dockerfile => Dockerfile-llmserver | 10 ++++++---- Dockerfile-webserver | 21 +++++++++++++++++++++ docker-compose.yml | 23 ++++++++++++++++++++--- 5 files changed, 50 insertions(+), 9 deletions(-) create mode 100644 .dockerignore rename Dockerfile => Dockerfile-llmserver (51%) create mode 100644 Dockerfile-webserver diff --git a/.dockerignore b/.dockerignore new file mode 100644 index 000000000..2bcdfd92b --- /dev/null +++ b/.dockerignore @@ -0,0 +1 @@ +models/ diff --git a/.gitignore b/.gitignore index c4bbee8ba..359f7a03d 100644 --- a/.gitignore +++ b/.gitignore @@ -25,10 +25,10 @@ lib/ lib64/ parts/ sdist/ -models + var/ wheels/ -models/ +models/* pip-wheel-metadata/ share/python-wheels/ *.egg-info/ diff --git a/Dockerfile b/Dockerfile-llmserver similarity index 51% rename from Dockerfile rename to Dockerfile-llmserver index 297e5d8cc..c36567381 100644 --- a/Dockerfile +++ b/Dockerfile-llmserver @@ -10,10 +10,12 @@ WORKDIR /app COPY . /app -RUN pip install -r requirements.txt -EXPOSE 7860 +# upgrade pip +RUN pip3 install --upgrade pip + +RUN pip install --no-cache-dir -r requirements.txt + EXPOSE 8000 -CMD ["python", "pilot/server/llmserver.py"] -CMD ["python", "pilot/server/webserver.py"] +CMD ["python3", "pilot/server/llmserver.py"] diff --git a/Dockerfile-webserver b/Dockerfile-webserver new file mode 100644 index 000000000..c0f5a1f3e --- /dev/null +++ b/Dockerfile-webserver @@ -0,0 +1,21 @@ +FROM nvidia/cuda:11.8.0-devel-ubuntu22.04 + +RUN apt-get update && apt-get install -y \ + git \ + python3 \ + pip + + +WORKDIR /app + +COPY . /app + + +# upgrade pip +RUN pip3 install --upgrade pip + +RUN pip install --no-cache-dir -r requirements.txt + +EXPOSE 7860 + +CMD ["python3", "pilot/server/webserver.py"] diff --git a/docker-compose.yml b/docker-compose.yml index 6938457c4..4a35b5a5e 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -13,16 +13,31 @@ services: volumes: - my-db:/var/lib/mysql restart: unless-stopped - db-gpt: + webserver: build: context: . - dockerfile: Dockerfile - container_name: db-gpt + dockerfile: Dockerfile-webserver + environment: + - MODEL_SERVER=http://llmserver:8000 + - LOCAL_DB_HOST=db + env_file: + - .env ports: - 7860:7860 expose: - 7860 restart: unless-stopped + llmserver: + build: + context: . + dockerfile: Dockerfile-llmserver + volumes: + - ./models:/app/models + env_file: + - .env + ports: + - 8000:8000 + restart: unless-stopped deploy: resources: reservations: @@ -31,5 +46,7 @@ services: device_ids: ['1', '0'] capabilities: [gpu] + + volumes: my-db: From 06d639de52af4176a1b8766e5427643fb524ca2d Mon Sep 17 00:00:00 2001 From: Joe Crypto Date: Thu, 22 Jun 2023 19:46:49 +0000 Subject: [PATCH 4/6] install zh_core_web_sm --- Dockerfile-webserver | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Dockerfile-webserver b/Dockerfile-webserver index c0f5a1f3e..bd6aa73dd 100644 --- a/Dockerfile-webserver +++ b/Dockerfile-webserver @@ -16,6 +16,8 @@ RUN pip3 install --upgrade pip RUN pip install --no-cache-dir -r requirements.txt +RUN python3 -m spacy download zh_core_web_sm + EXPOSE 7860 CMD ["python3", "pilot/server/webserver.py"] From 46a2a34ae3bf2f55106299f4b0020d568a8212d3 Mon Sep 17 00:00:00 2001 From: Joe Crypto Date: Thu, 22 Jun 2023 19:47:14 +0000 Subject: [PATCH 5/6] override .env.template --- docker-compose.yml | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/docker-compose.yml b/docker-compose.yml index 4a35b5a5e..2cb7131e8 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -20,8 +20,12 @@ services: environment: - MODEL_SERVER=http://llmserver:8000 - LOCAL_DB_HOST=db + - WEB_SERVER_PORT=7860 + volumes: + - ./models:/app/models + - data:/app/pilot/data env_file: - - .env + - .env.template ports: - 7860:7860 expose: @@ -31,10 +35,12 @@ services: build: context: . dockerfile: Dockerfile-llmserver + environment: + - LOCAL_DB_HOST=db volumes: - ./models:/app/models env_file: - - .env + - .env.template ports: - 8000:8000 restart: unless-stopped @@ -43,10 +49,11 @@ services: reservations: devices: - driver: nvidia - device_ids: ['1', '0'] + device_ids: ['1'] capabilities: [gpu] volumes: my-db: + data: From 7283dcdd8fa44ad1c4b9d52c9b851c94da164ff7 Mon Sep 17 00:00:00 2001 From: Joe Crypto Date: Thu, 22 Jun 2023 19:49:44 +0000 Subject: [PATCH 6/6] added plugins volume --- docker-compose.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/docker-compose.yml b/docker-compose.yml index 2cb7131e8..b224e1ac3 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -23,6 +23,7 @@ services: - WEB_SERVER_PORT=7860 volumes: - ./models:/app/models + - ./plugins:/app/plugins - data:/app/pilot/data env_file: - .env.template