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:
GitHub
runpod-worker-comfyui/start.sh at main · ashleykleynhans/runpod-wor...
RunPod Serverless Worker for the ComfyUI Stable Diffusion API - ashleykleynhans/runpod-worker-comfyui
Jump to solution
28 Replies
digigoblin
digigoblin7mo ago
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.
Sassy Pantsy
Sassy PantsyOP7mo ago
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?
digigoblin
digigoblin7mo ago
Are you using a venv?
Sassy Pantsy
Sassy PantsyOP7mo ago
I ma am* so my commands need to be to first start the venv?
digigoblin
digigoblin7mo ago
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
digigoblin
digigoblin7mo ago
GitHub
runpod-worker-comfyui/start.sh at main · ashleykleynhans/runpod-wor...
RunPod Serverless Worker for the ComfyUI Stable Diffusion API - ashleykleynhans/runpod-worker-comfyui
Sassy Pantsy
Sassy PantsyOP7mo ago
ok yeah I see it now Ok thanks man!!! I'll rebuild my container and let you know how it goes
Sassy Pantsy
Sassy PantsyOP7mo ago
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?
nerdylive
nerdylive7mo ago
Let me see your entrypoint script? your worker keeps restarting?
Sassy Pantsy
Sassy PantsyOP7mo ago
sure yeah, worker's restarting as well
nerdylive
nerdylive7mo ago
I guess there's no process on the main thread so it keeps exiting Where is that?
Sassy Pantsy
Sassy PantsyOP7mo ago
GitHub
GitHub - AoutoCooper/ComfyUI-serverless-image
Contribute to AoutoCooper/ComfyUI-serverless-image development by creating an account on GitHub.
Sassy Pantsy
Sassy PantsyOP7mo ago
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
digigoblin
digigoblin7mo ago
Whose repo is this? Your own?
Sassy Pantsy
Sassy PantsyOP7mo ago
yeah
nerdylive
nerdylive7mo ago
I see an error there seems like ti's not executing anything from the sh script
digigoblin
digigoblin7mo ago
Any reason why you don't just use one that is known to work?
nerdylive
nerdylive7mo ago
No file reference, last line
digigoblin
digigoblin7mo ago
GitHub
GitHub - ashleykleynhans/runpod-worker-comfyui: RunPod Serverless W...
RunPod Serverless Worker for the ComfyUI Stable Diffusion API - ashleykleynhans/runpod-worker-comfyui
nerdylive
nerdylive7mo ago
Yeah why not use the working one
Sassy Pantsy
Sassy PantsyOP7mo ago
wait what hahaha no way dude I never saw this one
digigoblin
digigoblin7mo ago
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
Sassy Pantsy
Sassy PantsyOP7mo ago
oh my god i've looked so much online thank you so much
nerdylive
nerdylive7mo ago
Hahha then try that
Sassy Pantsy
Sassy PantsyOP7mo ago
I will! at least i learned some docker 🙂 thanks man, I'll test it out and get back to you
digigoblin
digigoblin7mo ago
Yeah thats an awesome take away
Sassy Pantsy
Sassy PantsyOP7mo ago
It works. Thanks for the help man, you have no idea how much time you've saved me
digigoblin
digigoblin7mo ago
Grand
Want results from more Discord servers?
Add your server