Skip to content

Commit

Permalink
ipadpt nodes and startup
Browse files Browse the repository at this point in the history
  • Loading branch information
RageshAntonyHM committed Dec 24, 2023
1 parent 9483126 commit 527ba7b
Show file tree
Hide file tree
Showing 3 changed files with 53 additions and 3 deletions.
15 changes: 12 additions & 3 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -88,24 +88,33 @@ RUN cd ComfyUI/custom_nodes && git clone https://github.com/Gourieff/comfyui-rea

RUN cd ComfyUI/custom_nodes && git clone https://github.com/ltdrdata/ComfyUI-Impact-Pack.git && cd ComfyUI-Impact-Pack && python install.py

RUN pip uninstall opencv-python opencv-python-headless --yes
RUN pip install opencv-python

RUN cd ComfyUI/custom_nodes && git clone https://github.com/cubiq/ComfyUI_IPAdapter_plus.git

RUN cd ComfyUI/custom_nodes && git clone https://github.com/cubiq/ComfyUI_essentials.git

RUN cd ComfyUI/custom_nodes && git clone https://github.com/mav-rik/facerestore_cf.git && cd facerestore_cf && chmod 777 install.sh && sh install.sh

RUN pip uninstall opencv-python opencv-python-headless opencv-contrib-python --yes
RUN pip install opencv-python==4.7.0.72 gitpython segment_anything

RUN echo "GIT packs installed"

#download models

RUN cd ComfyUI/models && mkdir ipadapter && cd ipadapter && wget https://huggingface.co/h94/IP-Adapter/resolve/main/models/ip-adapter-plus_sd15.safetensors
RUN cd ComfyUI/models/ipadapter && wget https://huggingface.co/h94/IP-Adapter/resolve/main/models/ip-adapter-full-face_sd15.safetensors
RUN cd ComfyUI/models/clip_vision && wget https://huggingface.co/h94/IP-Adapter/resolve/main/models/image_encoder/model.safetensors -O CLIP-ViT-H-14-laion2B-s32B-b79K.safetensors
RUN cd ComfyUI/models/ipadapter && wget https://huggingface.co/h94/IP-Adapter-FaceID/resolve/main/ip-adapter-faceid_sd15.bin


# NGINX Proxy
#COPY --from=proxy nginx.conf /etc/nginx/nginx.conf
#COPY --from=proxy readme.html /usr/share/nginx/html/readme.html

COPY container-template/proxy/nginx.conf /etc/nginx/nginx.conf
COPY container-template/proxy/readme.html /usr/share/nginx/html/readme.html


RUN echo "ngnix installed "

# Copy the README.md
Expand Down
40 changes: 40 additions & 0 deletions post_start.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
#!/bin/bash

if [[ -z "${RUNPOD_PROJECT_ID}" ]]; then
echo "RUNPOD_PROJECT_ID environment variable is not set. Exiting."
exit 0
fi

check_interval=60
countdown_time=${POD_INACTIVITY_TIMEOUT:-300}

# Function to monitor the number of active SSH connections
monitor_ssh() {
echo "Monitoring SSH connections every $check_interval seconds, with a countdown of $countdown_time seconds."
countdown=$countdown_time

while true; do
sleep $check_interval

connections=$(ss -tn | grep ':22' | grep -v 'LISTEN' | wc -l)

if [[ "$connections" -eq 0 ]]; then
((countdown-=$check_interval))
echo "No SSH connections found. Countdown: $countdown seconds remaining."

if [[ "$countdown" -le 0 ]]; then
echo "Countdown reached zero. Removing pod: $RUNPOD_POD_ID"
runpodctl remove pod $RUNPOD_POD_ID
exit 0
fi
else
if [[ "$countdown" -ne $countdown_time ]]; then
echo "SSH connection detected. Countdown aborted."
fi
countdown=$countdown_time
fi
done
}

monitor_ssh &
filebrowser -a 0.0.0.0 -p 4040 -r / &
1 change: 1 addition & 0 deletions pre_start.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,5 @@ rsync -au --remove-source-files /ComfyUI/ /workspace/ComfyUI/
ln -s /comfy-models/* /workspace/ComfyUI/models/checkpoints/

cd /workspace/ComfyUI
git pull
python main.py --listen --port 3000 &

0 comments on commit 527ba7b

Please sign in to comment.