Use `flyte serve` for fast iteration or `flyte deploy` for production deployments.
Serve and deploy apps
Flyte provides two main ways to deploy apps: serve (for development) and deploy (for production). This section covers both methods and their differences.
Serve vs deploy
flyte serve
Serving is designed for development and iteration:
- Dynamic parameter modification: You can override app parameters when serving
- Quick iteration: Faster feedback loop for development
- Interactive: Better suited for testing and experimentation
flyte deploy
Deployment is designed for production use:
- Immutable: Apps are deployed with fixed configurations
- Production-ready: Optimized for stability and reproducibility
Using Python SDK
app_env = flyte.app.AppEnvironment(
name="my-app",
image=flyte.app.Image.from_debian_base().with_pip_packages("streamlit==1.41.1"),
args=["streamlit", "hello", "--server.port", "8080"],
port=8080,
resources=flyte.Resources(cpu="1", memory="1Gi"),
)
if __name__ == "__main__":
flyte.init_from_config()
app = flyte.serve(app_env)
print(f"Served at: {app.url}")
app_env = flyte.app.AppEnvironment(
name="my-app",
image=flyte.app.Image.from_debian_base().with_pip_packages("streamlit==1.41.1"),
args=["streamlit", "hello", "--server.port", "8080"],
port=8080,
resources=flyte.Resources(cpu="1", memory="1Gi"),
)
if __name__ == "__main__":
flyte.init_from_config()
deployments = flyte.deploy(app_env)
# Access deployed app URL from the deployment
for deployed_env in deployments[0].envs.values():
print(f"Deployed: {deployed_env.deployed_app.url}")
Using the CLI
flyte serve path/to/app.py app_envflyte deploy path/to/app.py app_envNext steps
- How app serving works: Understanding the serve process and configuration options
- How app deployment works: Understanding the deploy process and configuration options
- Activating and deactivating apps: Managing app lifecycle
- Basic project: Build a RAG embedding pipeline and semantic search app with Streamlit
- Prefetching models: Download and shard HuggingFace models for vLLM and SGLang
How app serving worksWhat flyte.serve does, and why its faster feedback loop suits development.How app custom domains workPoint a custom domain at an app.How app deployment worksWhat flyte.deploy does, and why versioned immutable deployments are the production path.Activating and deactivating appsTurn a deployed app on and off, and what activation means for each deploy method.Prefetching modelsDownload and shard a HuggingFace model before an inference app starts.