Skip to content

Commit

Permalink
Merge branch 'main' into shiny
Browse files Browse the repository at this point in the history
  • Loading branch information
neelasha23 authored Feb 2, 2024
2 parents 6181319 + 0da6eaa commit 5d75bba
Show file tree
Hide file tree
Showing 42 changed files with 3,958 additions and 6 deletions.
4 changes: 3 additions & 1 deletion doc/_toc.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ parts:
- file: user-guide/github
- file: user-guide/env-vars
- file: user-guide/custom-domains
- file: user-guide/managing-apps

- caption: Sharing notebooks
chapters:
Expand All @@ -28,9 +29,10 @@ parts:
- file: apps/panel
- file: apps/chainlit
- file: apps/gradio
- file: apps/docker
- file: apps/shiny-core
- file: apps/shiny-express
- file: apps/dash
- file: apps/docker
- file: apps/chalk-it

- caption: App examples
Expand Down
43 changes: 43 additions & 0 deletions doc/apps/dash.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
# Dash

To deploy a [Dash](https://dash.plotly.com/) application to Ploomber Cloud you need:

- A `Dockerfile`
- A Dash project

## `Dockerfile`

Use this [template](https://github.com/ploomber/doc/blob/main/examples/dash/simple-app/Dockerfile) `Dockerfile`:

```Dockerfile
FROM python:3.11

COPY app.py app.py
COPY requirements.txt requirements.txt
RUN pip install -r requirements.txt

ENTRYPOINT ["gunicorn", "app:server", "run", "--bind", "0.0.0.0:80"]
```

## Testing locally

To test your app, you can use `docker` locally:

```sh
# build the docker image
docker build . -t dash-app

# run it
docker run -p 5000:80 dash-app
```

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


## Deploy

Once you have all your files, create a zip file.

To deploy a Dash app from the deployment menu, select the Docker option and follow the instructions:

![](../static/docker.png)
4 changes: 2 additions & 2 deletions doc/apps/streamlit.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Streamlit

Ploomber Cloud supports [Streamlit](https://streamlit.io/). For information on how to develop Panel apps, [please check the documentation](https://docs.streamlit.io/).
Ploomber Cloud supports [Streamlit](https://streamlit.io/). For information on how to develop Streamlit apps, [please check the documentation](https://docs.streamlit.io/).

To deploy a Streamlit app you need at least two files:

Expand All @@ -26,4 +26,4 @@ numpy

To deploy a Streamlit app from the deployment menu, follow these instructions:

![](../static/streamlit.png)
![](../static/streamlit.png)
Binary file added doc/static/custom-domains/custom-names.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added doc/static/manage-apps/add-label-from-status.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added doc/static/manage-apps/labels.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added doc/static/manage-apps/see-labels-main.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added doc/static/manage-apps/see-labels-status.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
25 changes: 24 additions & 1 deletion doc/user-guide/cli.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ Then, set your API key ([learn how to get it](../quickstart/apikey.md)):
ploomber-cloud key YOURKEY
```

(init)=
## Initialize a new app

If you want to create a new app, run the `init` command:
Expand Down Expand Up @@ -64,4 +65,26 @@ Then, execute:

```sh
ploomber-cloud deploy
```
```

## Defining environment variables

If your project uses environment variables, you can define them in an `.env` file.

In your main project directory, create an `.env` file. Open it in your code editor, and enter your environment variables. It should look like this:

```
MY_ENV_VAR_1=value_1
MY_ENV_VAR_2=value_2
```

Now make sure your project has been [initialized](#init), and deploy it:

```sh
ploomber-cloud deploy
```

The command-line interface will automatically read and encrypt your environment variables and include them in the deployment.
For security reasons, your `.env` file is replaced with an empty file at runtime. Ploomber only stores your encrypted environment variables.

To learn how to read your environment variables from within your application, see [Reading variables.](./env-vars.md)
21 changes: 20 additions & 1 deletion doc/user-guide/custom-domains.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,28 @@
# Custom domains
# Custom domains and subdomains

When you publish your application for the first time, your web address (i.e., URL) is in the following format: `project-id.plooberapp.io`

Ploomber offers options to customize the [subdomain](#custom-subdomain) or the [full domain](#custom-domain).

If you already own a domain, you can easily bring it to your Ploomber account by updating your DNS records, or by changing its nameservers.

(custom-subdomain)=
## Adding a custom subdomain

```{note}
Custom project names are a [paid feature.](../pricing/overview.md)
```

If you would like a custom subdomain, like `my-custom-app.ploomberapp.io`, you can add a custom name during application setup:

![](../static/custom-domains/custom-names.png)

Customizing the project name only changes the `x` portion in `x.ploomberapp.io`.

If you would like a fully customized domain, see [Adding a custom domain](#custom-domain).


(custom-domain)=
## Adding a custom domain

### Before you begin
Expand Down
5 changes: 5 additions & 0 deletions doc/user-guide/env-vars.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,11 @@ To add more, click on the button to the right:

![](../static/env-vars/env-vars-plus.png)


```{tip}
You can also define environment variables using the [command-line interface.](./cli.md)
```

## Reading variables

To read the variables, use the following Python code:
Expand Down
17 changes: 17 additions & 0 deletions doc/user-guide/managing-apps.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# Managing applications

## Labels

Labels can help you organize and identify your apps. You can add them during creation:

![](../static/manage-apps/labels.png)

Or add them from the application status page:

![](../static/manage-apps/add-label-from-status.png)

You may add as many labels as you want. Once you've added some labels, they will show up on the status page and the main Applications page:

![](../static/manage-apps/see-labels-status.png)

![](../static/manage-apps/see-labels-main.png)
6 changes: 6 additions & 0 deletions examples/dash/clinical-analytics/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
FROM python:3.11

COPY . .
RUN pip install -r requirements.txt

ENTRYPOINT ["gunicorn", "app:server", "run", "--bind", "0.0.0.0:80"]
3 changes: 3 additions & 0 deletions examples/dash/clinical-analytics/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# clinical analytics

Based on [this example.](https://github.com/plotly/dash-sample-apps/tree/main/apps/dash-clinical-analytics)
Loading

0 comments on commit 5d75bba

Please sign in to comment.