From c222f96f245ef918f4e761485de663957cd2982a Mon Sep 17 00:00:00 2001 From: Cyberes Date: Sun, 15 Oct 2023 14:50:04 -0600 Subject: [PATCH] docker: clean up --- other/vllm/Docker/Dockerfile | 21 ++++++++++----------- other/vllm/Docker/README.md | 14 ++++++++++++++ other/vllm/Docker/build-docker.sh | 5 +++++ other/vllm/Docker/start-container.sh | 7 ------- other/vllm/Docker/supervisord.conf | 2 +- other/vllm/Docker/update-container.sh | 13 +++++++++++++ 6 files changed, 43 insertions(+), 19 deletions(-) create mode 100644 other/vllm/Docker/build-docker.sh create mode 100644 other/vllm/Docker/update-container.sh diff --git a/other/vllm/Docker/Dockerfile b/other/vllm/Docker/Dockerfile index 226ec11..6eeaf0c 100644 --- a/other/vllm/Docker/Dockerfile +++ b/other/vllm/Docker/Dockerfile @@ -18,6 +18,8 @@ RUN rm /tmp/rathole.zip RUN cp /tmp/rathole /app RUN python3 -m venv /venv +RUN /venv/bin/pip3 install --upgrade pip setuptools wheel +RUN /venv/bin/pip3 install -r requirements.txt # Install PyTorch before installing VLLM in an attempt to ensure we use the right # version for our CUDA install. (VLLM wants 2.0.1) @@ -30,12 +32,6 @@ WORKDIR /local-llm-server # ADD "https://www.random.org/cgi-bin/randbyte?nbytes=10&format=h" skipcache RUN /venv/bin/pip install git+https://github.com/vllm-project/vllm -# Uninstall PyTorch since VLLM may have installed a version that is incompatible with -# our CUDA version. -RUN /venv/bin/pip3 uninstall -y torch -RUN /venv/bin/pip3 install torch==2.0.1 --index-url https://download.pytorch.org/whl/cu118 - - FROM nvidia/cuda:11.8.0-base-ubuntu22.04 as runtime RUN apt-get update && apt-get install -y supervisor && rm -rf /var/lib/apt/lists/* @@ -43,19 +39,22 @@ RUN apt-get update && apt-get install -y supervisor && rm -rf /var/lib/apt/lists RUN useradd -ms /bin/bash apiserver RUN usermod -s /bin/bash root +# Required packages RUN apt-get update && \ - apt-get install -y python3 python3-pip wget aria2 git-lfs git openssh-server openssh-client nano tmux file && \ - rm -rf /var/lib/apt/lists/* - + apt-get install -y python3 python3-pip RUN pip3 install --upgrade pip setuptools wheel + +# Useful Python packages RUN pip3 install glances +# Useful tools +RUN apt-get install -y wget aria2 git-lfs git openssh-server openssh-client nano tmux file && \ + rm -rf /var/lib/apt/lists/* + # Enable root SSH login RUN sed -i 's/#PermitRootLogin prohibit-password/PermitRootLogin yes/' /etc/ssh/sshd_config - # Disable password SSH login RUN sed -i 's/#PasswordAuthentication yes/PasswordAuthentication no/' /etc/ssh/sshd_config - # Create the necessary directory for sshd RUN mkdir /var/run/sshd diff --git a/other/vllm/Docker/README.md b/other/vllm/Docker/README.md index 265f441..5c51728 100644 --- a/other/vllm/Docker/README.md +++ b/other/vllm/Docker/README.md @@ -33,3 +33,17 @@ You **must** have a GPU attached to your system when building the container (req 2. `sudo docker build .` If you want to build the latest VLLM, add `--no-cache` Don't forget about `--progress=plain` + +To run the container on your local machine: + +```bash +sudo docker run -it --shm-size 14g --gpus all -v /home/user/testing123/notebooks:/notebooks -v /home/user/testing123/storage:/storage -p 8888:8888 cyberes/vllm-paperspace:latest +``` + +You will need to create a directory to mount inside the container (for example: `/home/user/testing123/`). Within this should be the folder `models` that holds the model to load, `rathole-client.toml`, and `cmd.txt`. + +If you need to debug something you can start a shell inside the container: + +```bash +sudo docker run -it --shm-size 14g --gpus all -v /home/user/testing123/notebooks:/notebooks -v /home/user/testing123/storage:/storage -p 8888:8888 --entrypoint bash cyberes/vllm-paperspace:latest +``` diff --git a/other/vllm/Docker/build-docker.sh b/other/vllm/Docker/build-docker.sh new file mode 100644 index 0000000..3fe6734 --- /dev/null +++ b/other/vllm/Docker/build-docker.sh @@ -0,0 +1,5 @@ +#!/bin/bash + +# Build and push the container. + +git pull; git pull; sudo docker build . -t cyberes/vllm-paperspace && sudo docker push cyberes/vllm-paperspace:latest diff --git a/other/vllm/Docker/start-container.sh b/other/vllm/Docker/start-container.sh index f1667f6..c28d082 100644 --- a/other/vllm/Docker/start-container.sh +++ b/other/vllm/Docker/start-container.sh @@ -1,12 +1,5 @@ #!/bin/bash -# Update the container repository and make sure pip dependancies are up to date. -echo "UPDATING CONTAINER..." -cd /local-llm-server || exit -git fetch -git reset --hard origin/master -/venv/bin/pip install -r requirements.txt - # Create the required directories and files. echo "SETTING UP FILE SYSTEM..." mkdir -p /storage/vllm/ diff --git a/other/vllm/Docker/supervisord.conf b/other/vllm/Docker/supervisord.conf index 2289e80..2cf85f0 100644 --- a/other/vllm/Docker/supervisord.conf +++ b/other/vllm/Docker/supervisord.conf @@ -25,7 +25,7 @@ user=apiserver environment=HOME="/home/apiserver",USER="apiserver" [program:jupyter] -command=/jupyterlab/bin/jupyter lab --no-browser --allow-root --ip=0.0.0.0 --LabApp.trust_xheaders=True --LabApp.disable_check_xsrf=False --LabApp.allow_remote_access=True --LabApp.allow_origin='*' +command=/jupyterlab/bin/jupyter lab --no-browser --allow-root --ip 0.0.0.0 --port 8888 --LabApp.trust_xheaders=True --LabApp.disable_check_xsrf=False --LabApp.allow_remote_access=True --LabApp.allow_origin='*' environment=SHELL="/bin/bash" autostart=true autorestart=true diff --git a/other/vllm/Docker/update-container.sh b/other/vllm/Docker/update-container.sh new file mode 100644 index 0000000..7f8fbe4 --- /dev/null +++ b/other/vllm/Docker/update-container.sh @@ -0,0 +1,13 @@ +#!/bin/bash + +# Run this script to update the container. +# Will restart VLLM as well. + +cd /local-llm-server || exit + +git fetch +git reset --hard origin/master + +/venv/bin/pip install -r requirements.txt + +supervisorctl restart vllm