How can I connect my network volume to a serverless endpoint?
Hi all,
I know that the serverless endpoints can have access to network volumes, but I can't seem to actually make it work. I'm also a first timer when it comes to docker\serverless so i may be doing some very trivial things wrong.
I connected my servereless endpoint to my network volume when setting it up in the UI, but when the endpoint tries to access files - I used 'pwd' on the files' location when the storage was connected to a pod, and placed it as an environment variable - I get "no file\directory", so to be clear, for instance, the serverless endpoint calls python3 /workspace/ComfyUI/main.py and fails because it doesn't exist, even though it does.
Do I need to prefix this in some manner? Call runpod-volume/workspace/ComfyUI/main.py? Create a directory called runpod-volume in my network volume and place everything there? can I even start the comfyui process from within the network volume? I do it like this because that's how I use it on my regular pods, and I use many custom nodes and don't want to have to re-download them on every request.
I'd appreciate anyone's help, the examples and tutorials online are very abstract and specific to a1111...
Thanks!
Solution:Jump to solution
GitHub
runpod-worker-comfyui/start.sh at main · ashleykleynhans/runpod-wor...
RunPod Serverless Worker for the ComfyUI Stable Diffusion API - ashleykleynhans/runpod-worker-comfyui
28 Replies
Network volumes are mounted to /runpod-volume in serverless not /workspace as I mentioned to you in the other thread.
So obviously it will fail because /workspace does not exist, because its /runpod-volume not /workspace
You can work around it by symlinking /runpod-volume to /workspace in your container start script.
"runpod-volume/workspace/ComfyUI/main.py" ❌
/runpod-volume/ComfyUI/main.py ✅
You don't create any directory called /runpod-volume
It is automatically mounted as /runpod-volume in serverless
/workspace
on pods is /runpod-volume
in serverless
I already explained this in the other thread.Sorry, it's also my first time on discord so I don't really know how to navigate this UI (actually can't even find that thread, tbh), anyway -- you're right! I simply changed that in the env variable and now everything works fine.
my only issue is that it crashes due to missing modules - which by itself is a simple error to solve, but I thought the modules are already installed?
I mean i use this same network volume on other pods, and I don't need to re-install any python modules, even when creating a new pod (after shutting the other one down). Is there something I'm missing here?
Are you using a venv?
I ma
am*
so my commands need to be to first start the venv?
venv paths are hard-coded so if you created it in /workspace, it won't work as /runpod-volume
Then it will default to system python instead of venv and modules will not be found
You can work around this by symlinking /runpod-volume to /workspace and then starting your app from /workspace in serverless
Solution
GitHub
runpod-worker-comfyui/start.sh at main · ashleykleynhans/runpod-wor...
RunPod Serverless Worker for the ComfyUI Stable Diffusion API - ashleykleynhans/runpod-worker-comfyui
ok yeah I see it now
Ok thanks man!!! I'll rebuild my container and let you know how it goes
Hi just want to update that I've remapped the paths according to what you said (took some trial and error but at the end we got it) and now my trouble isn't with files and direcories not being found, is that the start.sh script (which is the container's entry point) is being called over and over again, practically on set intervals. When I look at the logs I see that comfy ui thankfully starts printing out logs, but is getting stuck on a prestartup time for a custom_node (the comfyui manager if it matters). Do you have any idea why it runs in this recursive manner?
Let me see your entrypoint script?
your worker keeps restarting?
sure
yeah, worker's restarting as well
I guess there's no process on the main thread so it keeps exiting
Where is that?
GitHub
GitHub - AoutoCooper/ComfyUI-serverless-image
Contribute to AoutoCooper/ComfyUI-serverless-image development by creating an account on GitHub.
that's the repo with the dockerfile, start.sh and main.py
whoops sorry i seem to have uploaded the wrong start.sh script, updated it now
Whose repo is this? Your own?
yeah
I see an error there seems like ti's not executing anything from the sh script
Any reason why you don't just use one that is known to work?
No file reference, last line
I use this and it works fine:
https://github.com/ashleykleynhans/runpod-worker-comfyui
GitHub
GitHub - ashleykleynhans/runpod-worker-comfyui: RunPod Serverless W...
RunPod Serverless Worker for the ComfyUI Stable Diffusion API - ashleykleynhans/runpod-worker-comfyui
Yeah why not use the working one
wait what
hahaha no way dude I never saw this one
No point in reinventing the wheel when there is already a repo to do it
Especially since you seem to be struggling to get it working
oh my god i've looked so much online
thank you so much
Hahha then try that
I will! at least i learned some docker 🙂
thanks man, I'll test it out and get back to you
Yeah thats an awesome take away
It works. Thanks for the help man, you have no idea how much time you've saved me
Grand