Setting Up Custom Servers
A basic FastAPI server running as a custom server on Cerebrium:cerebrium.toml by adding a custom runtime section:
entrypoint: The command that starts your serverport: The port your server listens onhealthcheck_endpoint: The endpoint used to confirm instance health. If unspecified, defaults to a TCP ping on the configured port. If the health check registers a non-200 response, Cerebrium considers the instance unhealthy and restarts it if it does not recover in time.readycheck_endpoint: The endpoint used to confirm if the instance is ready to receive. If unspecified, defaults to a TCP ping on the configured port. If the ready check registers a non-200 response, Cerebrium does not route requests to the instance.
For ASGI applications like FastAPI, include the appropriate server package
(like
uvicorn) in your dependencies. After deployment, your endpoints become
available at
https://api.cerebrium.ai/v4/p-xxxxxxxx/[app-name]/your/endpoint.Request Headers
Custom web servers receive the Cerebrium run ID in theX-Request-Id header on every request. This corresponds to the internal run_id and is useful for tracking and debugging.