Introduction to a Service

A Truefoundry Service represents a continuously running application that typically provides a set of APIs for interaction. Services can be dynamically scaled based on incoming traffic or resource demands.

Services are perfect for scenarios where real-time responses are essential, such as:

  • Hosting Real-time Model Inference (e.g., Flask, FastAPI)
  • Fueling Dynamic Website Backends
  • Creating Model Demos (e.g., Streamlit, Gradio)

Important Considerations for Service Deployment

When deploying a service, you'll typically expose APIs on specific ports. These considerations are essential when deploying a service:

  1. Dockerize the code to be deployed
  2. Specify the ports for service exposure - Define Ports and Domains.
  3. [Optional] Map domains to the ports to enable communication with other applications - Define Ports and Domains.
  4. Define the resources requirements for your service - Define Resources
  5. [Optional] Define environment variables and secrets to inject into the code - Environment Variables and Secrets.
  6. [Optional] Set up an autoscaling policy for production workloads - Autoscaling.
  7. [Best Practice] Define Liveness/Readiness Probes - Liveness/Readiness Probe.
  8. [Best Practice] Establish a rollout strategy - Rollout Strategy.
  9. [Optional] Mount files or volumes to your service - Mounting Volumes and Files.
  10. Configure Monitoring Dashboards
  11. Set up Alerting
  12. Update, Rollback, and Promote your Service
  13. Set up CI/CD for your Service
  14. Access data from S3 or other clouds

Deploy Your First Service

To deploy your first service, choose one of the following guides based on the location of your service code: