[Deployment] Setup fly.io deployment method and update docs (#1028)

Co-authored-by: sidmohanty11 <sidmohanty11@gmail.com>
This commit is contained in:
Deshraj Yadav
2023-12-19 14:36:44 +05:30
committed by GitHub
parent cd2c40a9c4
commit 3cd50c4cd9
18 changed files with 621 additions and 97 deletions

View File

@@ -0,0 +1,95 @@
---
title: 'Fly.io'
description: 'Deploy your RAG application to fly.io platform'
---
Embedchain has a nice and simple abstraction on top of the [Fly.io](https://fly.io/) tools to let developers deploy RAG application to fly.io platform seamlessly.
Follow the instructions given below to deploy your first application quickly:
## Step-1: Install flyctl command line
<CodeGroup>
```bash OSX
brew install flyctl
```
```bash Linux
curl -L https://fly.io/install.sh | sh
```
```bash Windows
pwsh -Command "iwr https://fly.io/install.ps1 -useb | iex"
```
</CodeGroup>
Once you have installed the fly.io cli tool, signup/login to their platform using the following command:
<CodeGroup>
```bash Sign up
fly auth signup
```
```bash Sign in
fly auth login
```
</CodeGroup>
In case you run into issues, refer to official [fly.io docs](https://fly.io/docs/hands-on/install-flyctl/).
## Step-2: Create RAG app
We provide a command line utility called `ec` that inherits the template for `fly.io` platform and help you deploy the app. Follow the instructions to create a fly.io app using the template provided:
```bash Create application
mkdir my-rag-app
ec create --template=fly.io
```
This will generate a directory structure like this:
```bash
├── Dockerfile
├── app.py
├── fly.toml
├── .env
├── .env.example
└── requirements.txt
```
Feel free to edit the files as required.
- `Dockerfile`: Defines the steps to setup the application
- `app.py`: Contains FastAPI app code
- `fly.toml`: fly.io config file
- `.env`: Contains environment variables for production
- `.env.example`: Contains dummy environment variables (can ignore this file)
- `requirements.txt`: Contains python dependencies for your FastAPI application
## Step-3: Test app locally
You can run the app locally by simply doing:
```bash Run locally
pip install -r requirements.txt
ec dev
```
## Step-4: Deploy to fly.io
You can deploy to fly.io using the following command:
```bash Deploy app
ec deploy
```
Once this step finished, it will provide you with the deployment endpoint where you can access the app live. It will look something like this:
You can also check the logs, monitor app status etc on their dashboard by running command `fly dashboard`.
<img src="/images/fly_io.png" />
## Seeking help?
If you run into issues with deployment, please feel free to reach out to us via any of the following methods:
<Snippet file="get-help.mdx" />

View File

@@ -1,11 +1,18 @@
---
title: '🚀 Deployment'
description: 'Deploy your embedchain RAG application to production'
title: 'Overview'
description: 'Deploy your RAG application to production'
---
After successfully setting up and testing your Embedchain application locally, the next step is to deploy it to a hosting service to make it accessible to a wider audience. This section offers various options for hosting your app on the [Embedchain platform](https://app.embedchain.ai) or through [self-hosting options](#self-hosting).
After successfully setting up and testing your RAG app locally, the next step is to deploy it to a hosting service to make it accessible to a wider audience. Embedchain provides integration with different cloud providers so that you can seamlessly deploy your RAG applications to production without having to worry about going through the cloud provider instructions. Embedchain does all the heavy lifting for you.
## Option 1: Deploy on Embedchain Platform
<CardGroup cols={4}>
<Card title="Fly.io" href="/deployment/fly_io"></Card>
<Card title="Modal.com" href="#"></Card>
<Card title="Embedchain Platform" href="#option-1-deploy-on-embedchain-platform"></Card>
<Card title="Self-hosting" href="#option-2-self-hosting"></Card>
</CardGroup>
## Deploy on Embedchain Platform
Embedchain enables developers to deploy their LLM-powered apps in production using the [Embedchain platform](https://app.embedchain.ai). The platform offers free access to context on your data through its REST API. Once the pipeline is deployed, you can update your data sources anytime after deployment.
@@ -33,17 +40,17 @@ app.deploy()
# ✅ Data of type: web_page, value: https://www.forbes.com/profile/elon-musk added successfully.
```
## Option 2: Self-hosting
## Self-hosting
You can also deploy Embedchain as a self-hosted service using the dockerized REST API service that we provide. Please follow the [guide here](/examples/rest-api) on how to use the REST API service. Here are some tutorials on how to deploy a containerized application to different platforms like AWS, GCP, Azure etc:
- [Fly.io](/deployment/fly_io)
- [Render.com](https://render.com/docs/deploy-an-image)
- [Huggingface Spaces](https://huggingface.co/new-space)
- [AWS EKS](https://docs.aws.amazon.com/eks/latest/userguide/sample-deployment.html)
- [AWS ECS](https://docs.aws.amazon.com/codecatalyst/latest/userguide/deploy-tut-ecs.html)
- [Google GKE](https://cloud.google.com/kubernetes-engine/docs/tutorials/hello-app)
- [Azure App Service](https://learn.microsoft.com/en-us/training/modules/deploy-run-container-app-service/)
- [Fly.io](https://fly.io/docs/languages-and-frameworks/python/)
- [Render.com](https://render.com/docs/deploy-an-image)
- [Huggingface Spaces](https://huggingface.co/new-space)
## Seeking help?

BIN
docs/images/fly_io.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 214 KiB

View File

@@ -72,7 +72,6 @@
"pages": [
"get-started/introduction",
"get-started/quickstart",
"get-started/deployment",
{
"group": "🔗 Integrations",
"pages": [
@@ -84,6 +83,13 @@
"get-started/faq"
]
},
{
"group": "Deployment",
"pages": [
"get-started/deployment",
"deployment/fly_io"
]
},
{
"group": "Use cases",
"pages": [