R
RunPod9mo ago
iNF3Rnus

What port do requests get sent on?

I want to do something a little custom, I don't want to use the serverless package, I want to use my own code, i.e. a flask app running on gunicorn for my container... I need to have a flexible container that's decoupled from RunPod. Is this possible? (Presumably it is?) I'd imagine I'd need to specify the endpoints for /run, /runsync, in my flask app etc. right? And then for the port mapping between the host and the container, how is that handled? Do I define the env var RUNPOD_REALTIME_PORT in the template and then the host then uses that for the hosts port, which is then the internal port used by the gunicorn server?
Final Q, then how is shutdown handled? Does a response code equate to the host then shutting down the container? Much appreciated, this service is absolutely sick nasty
1 Reply
ashleyk
ashleyk9mo ago
I need to have a flexible container that's decoupled from RunPod. Is this possible? (Presumably it is?)
No, its not possible, you need to use the RunPod SDK.
I'd imagine I'd need to specify the endpoints for /run, /runsync, in my flask app etc. right?
Wrong.
And then for the port mapping between the host and the container, how is that handled?
There is no mapping and no concept of ports in serverless.
Final Q, then how is shutdown handled? Does a response code equate to the host then shutting down the container?
This is irrelevant, its handled by the SDK, you have to use the SDK. yOU either return a dict for output or a str for error.
I want to use my own code, i.e. a flask app running on gunicorn for my container.
You don't use flask, gunicorn etc in Serverless, RunPod already provide the API layer for you. You simply have a handler function that does all the processing and call the runpod.serverless.start() in your code. You don't expose APIs in serverless, its already an API.
Want results from more Discord servers?
Add your server