Skip to content

Commit

Permalink
instructions
Browse files Browse the repository at this point in the history
  • Loading branch information
bryannho committed May 22, 2024
1 parent b8ad0e6 commit 9f19969
Show file tree
Hide file tree
Showing 2 changed files with 52 additions and 22 deletions.
74 changes: 52 additions & 22 deletions doc/apps/chainlit.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,46 +18,76 @@ Ploomber Cloud is a great platform to host your Chainlit apps, even [Chainlit re

To deploy a Chainlit application in Ploomber Cloud you need:

- A [Ploomber Cloud](https://platform.ploomber.io/register?utm_source=chainlit&utm_medium=documentation) account
- A `Dockerfile`
- Your code
- A [Ploomber Cloud](https://platform.ploomber.io/register?utm_source=flask&utm_medium=documentation) account
- Your application file (`app.py`)
- A dependencies file (`requirements.txt`)

## `Dockerfile`
## Testing locally

To test your app, you can use this command:

```sh
pip install -r requirements.txt
chainlit run app.py --host=0.0.0.0 --port=80 --headless
```

Now, open [http://0.0.0.0:5000/](http://0.0.0.0:5000/) to see your app.

## Deploy

`````{tab-set}
````{tab-item} Web
__Deploy from the menu__
Once you have all your files, create a zip file.
To deploy a Chainlit app from the deployment menu, follow these instructions:
You need to provide a `Dockerfile`, you can use this [template](https://github.com/ploomber/doc/blob/main/examples/chainlit/basic-app/Dockerfile) to get started. The template contains the minimal steps needed for a deployment but you need to modify so it installs any required dependencies and copies your code into the Docker image.
![](../static/chainlit.png)
````
```Dockerfile
FROM python:3.11
````{tab-item} Command-line
__Try an example__
COPY app.py app.py
RUN pip install chainlit
To download and deploy an example Chainlit application start by installing Ploomber Cloud and setting your API key:
# do not change the arguments
ENTRYPOINT ["chainlit", "run", "app.py", "--host=0.0.0.0", "--port=80", "--headless"]
```sh
pip install ploomber-cloud
ploomber-cloud key YOUR-KEY
```
## Testing locally
```{tip}
If you don't have an API key yet, follow the [instructions here.](../quickstart/apikey.md)
```
To test your app, you can use `docker` locally:
Now, download an example. It will prompt you for a location to download the app. To download in the current directory, just press enter.
```sh
# build the docker image
docker build . -t chainlit
ploomber-cloud examples chainlit/basic-app
```
# run it
docker run -p 5000:80 chainlit
```{note}
A full list of Chainlit example apps is available [here.](https://github.com/ploomber/doc/tree/main/examples/chainlit)
```
Now, open [http://0.0.0.0:5000/](http://0.0.0.0:5000/) to see your app.
You should see a confirmation with instructions on deploying your app. Now, navigate to your application:
```sh
cd location-you-entered/basic-app
```
## Deploy
__Deploy from the CLI__
Once you have all your files, create a zip file.
Initialize and deploy your app with:
To deploy a Chainlit app from the deployment menu, follow these instructions:
```sh
ploomber-cloud init
ploomber-cloud deploy --watch
```
![](../static/docker.png)
````
`````


```{tip}
Expand Down
Binary file added doc/static/chainlit.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 9f19969

Please sign in to comment.