Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
156 changes: 156 additions & 0 deletions assets/logos/dark/radial_circle.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
156 changes: 156 additions & 0 deletions assets/logos/light/radial_circle.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
18 changes: 9 additions & 9 deletions docs/hosting/deploy-quick-start.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ Reflex’s hosting service makes it easy to deploy your apps without worrying ab

### Prerequisites

1. Hosting service requires `reflex>=0.3.2`.
1. Hosting service requires `reflex>=0.6.5`.
2. This tutorial assumes you have successfully `reflex init` and `reflex run` your app.
3. Also make sure you have a `requirements.txt` file at the top level app directory that contains all your python dependencies!

Expand All @@ -43,7 +43,13 @@ reflex deploy

The command is by default interactive. It asks you a few questions for information required for the deployment.

**Name**: choose a name for the deployed app. This name will be part of the deployed app URL, i.e. `<app-name>.reflex.run`. The name should only contain domain name safe characters: no slashes, no underscores. Domain names are case insensitive. To avoid confusion, the name you choose here is also case insensitive. If you enter letters in upper cases, we automatically convert them to lower cases.
**Name**: choose a name for the deployed app. This name will be part of the deployed app URL, i.e. `<app-name>-randomword-randomword.reflex.run`.

The name should only contain domain name safe characters: no slashes, no underscores.

```md alert info
# Custom domains are available for paid plans.
```

**Regions**: enter the region code here or press `Enter` to accept the default. The default code `sjc` stands for San Jose, California in the US west coast. Check the list of supported regions at [reflex deployments regions](#reflex-deployments-regions).

Expand All @@ -52,13 +58,7 @@ The command is by default interactive. It asks you a few questions for informati
That’s it! You should receive some feedback on the progress of your deployment and in a few minutes your app should be up. 🎉

```md alert info
# Once your code is uploaded, the hosting service will start the deployment. After a complete upload, exiting from the command **does not** affect the deployment process. The command prints a message when you can safely close it without affecting the deployment.
```

The hosting service does not currently handle database or file upload operations. It is necessary to set up an external database use it within your app.

```md alert info
# If you want to deploy on a custom URL we recommend using https://redirect.pizza
# The hosting service does not currently handle database or file upload operations. Set up an external database and use it within your app.
```

## See it in Action
Expand Down
157 changes: 14 additions & 143 deletions docs/hosting/hosting-cli-commands.md
Original file line number Diff line number Diff line change
Expand Up @@ -56,25 +56,8 @@ To redeploy or update your app, navigate to the project directory and type `refl

All the `reflex` commands come with a help manual. The help manual lists additional command options that may be useful. You type `--help` to see the help manual. Some commands are organized under a `subcommands` series. Here is an example below. Note that the help manual may look different depending on the version of `reflex` or the `reflex-hosting-cli`.

```python eval
doccmdoutput(
command="reflex deployments --help",
output="""Usage: reflex deployments [OPTIONS] COMMAND [ARGS]...

Subcommands for managing the Deployments.

Options:
--help Show this message and exit.

Commands:
build-logs Get the build logs for a deployment.
delete Delete a hosted instance.
list List all the hosted deployments of the authenticated user.
logs Get the logs for a deployment.
regions List all the regions of the hosting service.
status Check the status of a deployment.
"""
)
``` bash
reflex deployments --help
```

### Authentication Commands
Expand All @@ -83,13 +66,8 @@ Commands:

When you type the `reflex login` command for the very first time, it opens the hosting service login page in your browser. We authenticate users through OAuth. At the moment the supported OAuth providers are Github and Gmail. You should be able to revoke such authorization on your Github and Google account settings page. We do not log into your Github or Gmail account. OAuth authorization provides us your email address and in case of Github your username handle. We use those to create an account for you. The email used in the original account creation is used to identify you as a user. If you have authenticated using different emails, those create separate accounts. To switch to another account, first log out using the `reflex logout` command. More details on the logout command are in [reflex logout](#reflex-logout) section.

```python eval
doccmdoutput(
command="reflex login",
output="""Opening https://control-plane.reflex.run ...
Successfully logged in.
""",
)
``` bash
reflex login
```

After authentication, the browser redirects to the original hosting service login page. It shows that you have logged in. Now you can return to the terminal where you type the login command. It should print a message such as `Successfully logged in`.
Expand All @@ -108,55 +86,8 @@ This is the command to deploy a reflex app from its top level app directory. Thi

A `requirements.txt` file is required. The deploy command checks the content of this file against the top level packages installed in your current Python environment. If the command detects new packages in your Python environment, or newer versions of the same packages, it prints the difference and asks if you would like to update your `requirements.txt`. Make sure you double check the suggested updates. This functionality is added in more recent versions of the hosting CLI package `reflex-hosting-cli>=0.1.3`.

```python eval
doccmdoutput(
command="reflex deploy",
output="""Info: The requirements.txt may need to be updated.
--- requirements.txt
+++ new_requirements.txt
@@ -1,3 +1,3 @@
-reflex>=0.2.0
-openai==0.28
+openai==0.28.0
+reflex==0.3.8

Would you like to update requirements.txt based on the changes above? [y/n]: y

Choose a name for your deployed app (https://<picked-name>.reflex.run)
Enter to use default. (webui-gray-sun): demo-chat
Region to deploy to. See regions: https://bit.ly/46Qr3mF
Enter to use default. (sjc): lax
Environment variables for your production App ...
* env-1 name (enter to skip): OPENAI_API_KEY
env-1 value: sk-*********************
* env-2 name (enter to skip):
Finished adding envs.
──────────────── Compiling production app and preparing for export. ────────────────
Zipping Backend: ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 100% 12/12 0:00:00
Uploading Backend code and sending request ...
Backend deployment will start shortly.
──────────────── Compiling production app and preparing for export. ────────────────
Compiling: ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 100% 9/9 0:00:00
Creating Production Build: ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 100% 9/9 0:00:07
Zipping Frontend: ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 100% 20/20 0:00:00
Uploading Frontend code and sending request ...
Frontend deployment will start shortly.
───────────────────────────── Deploying production app. ────────────────────────────
Deployment will start shortly: https://demo-chat.reflex.run
Closing this command now will not affect your deployment.
Waiting for server to report progress ...
2024-01-12 12:24:54.188271 PST | Updating frontend...
2024-01-12 12:24:55.074264 PST | Frontend updated!
2024-01-12 12:24:55.137679 PST | Deploy success (frontend)
2024-01-12 12:24:59.722384 PST | Updating backend...
2024-01-12 12:25:01.006386 PST | Building backend image...
2024-01-12 12:26:03.672379 PST | Deploying backend image...
2024-01-12 12:26:21.017946 PST | Backend updated!
2024-01-12 12:26:21.018003 PST | Deploy success (backend)
Waiting for the new deployment to come up
Your site [ demo-chat ] at ['lax'] is up: https://demo-chat.reflex.run
""",
)
``` bash
reflex deploy
```

The deploy command is by default interactive. To deploy without interaction, add `--no-interactive` and set the relevant command options as deployment settings. Type `reflex deploy --help` to see the help manual for explanations on each option. The deploy sequences are the same, whether the deploy command is interactive or not.
Expand All @@ -169,40 +100,16 @@ reflex deploy --no-interactive -k todo -r sjc -r sea --env OPENAI_API_KEY=YOU-KE

List all your deployments.

```python eval
doccmdoutput(
command="reflex deployments list",
output="""key regions app_name reflex_version cpus memory_mb url envs
---------------------------- ------- -------------------- ---------------- ------- ----------- ------------------------------------------ ---------
webui-navy-star ['sjc'] webui 0.3.7 1 1024 https://webui-navy-star.reflex.run ['OPENAI_API_KEY']
chatroom-teal-ocean ['ewr'] chatroom 0.3.2 1 1024 https://chatroom-teal-ocean.reflex.run []
sales-navy-moon ['phx'] sales 0.3.4 1 1024 https://sales-navy-moon.reflex.run []
simple-background-tasks ['yul'] lorem_stream 0.3.7 1 1024 https://simple-background-tasks.reflex.run []
snakegame ['sjc'] snakegame 0.3.3 1 1024 https://snakegame.reflex.run []
basic-crud-navy-apple ['dfw'] basic_crud 0.3.8 1 1024 https://basic-crud-navy-apple.reflex.run []
""",
)
``` bash
reflex deployments list
```

#### reflex deployments status `app-name`

Get the status of a specific app, including backend and frontend.

```python eval
doccmdoutput(
command="reflex deployments status clock-gray-piano",
output="""Getting status for [ clock-gray-piano ] ...

backend_url reachable updated_at
----------------------------------------- ----------- ------------
https://rxh-prod-clock-gray-piano.fly.dev False N/A


frontend_url reachable updated_at
----------------------------------------- ----------- -----------------------
https://clock-gray-piano.reflex.run True 2023-10-13 15:23:07 PDT
""",
)
``` bash
reflex deployments status clock-gray-piano
```

#### reflex deployments logs `app-name`
Expand All @@ -213,52 +120,16 @@ The returned logs are the messages printed to console. If you have `print` state

We have added more options to this command including `from` and `to` timestamps and the limit on how many lines of logs to fetch. Accepted timestamp formats include the ISO 8601 format, unix epoch and relative timestamp. A relative timestamp is some time units ago from `now`. The units are `d (day), h (hour), m (minute), s (second)`. For example, `--from 3d --to 4h` queries from 3 days ago up to 4 hours ago. For the exact syntax in the version of CLI you use, refer to the help manual.

```python eval
doccmdoutput(
command="reflex deployments logs todo",
output="""Note: there is a few seconds delay for logs to be available.
2023-10-13 22:18:39.696028 | rxh-dev-todo | info | Pulling container image registry.fly.io/rxh-dev-todo:depot-1697235471
2023-10-13 22:18:41.462929 | rxh-dev-todo | info | Pulling container image registry.fly.io/rxh-dev-todo@sha256:60b7b531e99e037f2fb496b3e05893ee28f93a454ee618bda89a531a547c4002
2023-10-13 22:18:45.963840 | rxh-dev-todo | info | Successfully prepared image registry.fly.io/rxh-dev-todo@sha256:60b7b531e99e037f2fb496b3e05893ee28f93a454ee618bda89a531a547c4002 (4.500906837s)
2023-10-13 22:18:46.134860 | rxh-dev-todo | info | Successfully prepared image registry.fly.io/rxh-dev-todo:depot-1697235471 (6.438815793s)
2023-10-13 22:18:46.210583 | rxh-dev-todo | info | Configuring firecracker
2023-10-13 22:18:46.434645 | rxh-dev-todo | info | [ 0.042971] Spectre V2 : WARNING: Unprivileged eBPF is enabled with eIBRS on, data leaks possible via Spectre v2 BHB attacks!
2023-10-13 22:18:46.477693 | rxh-dev-todo | info | [ 0.054250] PCI: Fatal: No config space access function found
2023-10-13 22:18:46.664016 | rxh-dev-todo | info | Configuring firecracker
""",
)
``` bash
reflex deployments logs todo
```

#### reflex deployments build-logs `app-name`

Get the logs of the hosting service deploying the app.

```python eval
doccmdoutput(
command="reflex deployments build-logs webcam-demo",
output="""Note: there is a few seconds delay for logs to be available.
2024-01-08 11:02:46.109785 PST | fly-controller-prod | #8 extracting sha256:bd9ddc54bea929a22b334e73e026d4136e5b73f5cc29942896c72e4ece69b13d 0.0s done | None | None
2024-01-08 11:02:46.109811 PST | fly-controller-prod | #8 DONE 5.3s | None | None
2024-01-08 11:02:46.109834 PST | fly-controller-prod | | None | None
2024-01-08 11:02:46.109859 PST | fly-controller-prod | #8 [1/4] FROM public.ecr.aws/p3v4g4o2/reflex-hosting-base:v0.1.8-py3.11@sha256:9e8569507f349d78d41a86e1eb29a15ebc9dece487816875bbc874f69dcf7ecf | None | None
...
...
2024-01-08 11:02:50.913748 PST | fly-controller-prod | #11 [4/4] RUN . /home/reflexuser/venv/bin/activate && pip install --no-color --no-cache-dir -q -r /home/reflexuser/app/requirements.txt reflex==0.3.4 | None | None
...
...
2024-01-08 11:03:07.430922 PST | fly-controller-prod | #12 pushing layer sha256:d9212ef47485c9f363f105a05657936394354038a5ae5ce03c6025f7f8d2d425 3.5s done | None | None
2024-01-08 11:03:07.881471 PST | fly-controller-prod | #12 pushing layer sha256:ee46d14ae1959b0cacda828e5c4c1debe32c9c4c5139fb670cde66975a70c019 3.9s done | None | None
...
2024-01-08 11:03:13.943166 PST | fly-controller-prod | Built backend image | None | None
2024-01-08 11:03:13.943174 PST | fly-controller-prod | Deploying backend image... | None | None
2024-01-08 11:03:13.943311 PST | fly-controller-prod | Running sys_run | None | None
...
2024-01-08 11:03:31.005887 PST | fly-controller-prod | Checking for valid image digest to be deployed to machines... | None | None
2024-01-08 11:03:31.005893 PST | fly-controller-prod | Running sys_run | None | None
2024-01-08 11:03:32.411762 PST | fly-controller-prod | Backend updated! | None | None
2024-01-08 11:03:32.481276 PST | fly-controller-prod | Deploy success (backend) | None | None
""",
)
``` bash
reflex deployments build-logs webcam-demo
```

The hosting service prints log messages when preparing and deploying your app. These log messages are called build logs. Build logs are useful in troubleshooting deploy failures. For example, if there is a package `numpz==1.26.3` (supposed to be `numpy`) in the `requirements.txt`, hosting service will be unable to install it. That package does not exist. We expect to find a few lines in the build logs indicating that the `pip install` command fails.
Expand Down
4 changes: 2 additions & 2 deletions pcweb/components/docpage/navbar/navbar.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@

from pcweb.pages.docs import getting_started, hosting
from pcweb.pages.faq import faq
from pcweb.pages.pricing import pricing
from pcweb.pages.pricing.pricing import pricing
from pcweb.pages.errors import errors
from pcweb.pages.docs.library import library
from pcweb.pages.blog import blogs
Expand Down Expand Up @@ -324,7 +324,7 @@ def new_component_section() -> rx.Component:
),
),
nav_menu.item(
link_item("Pricing", pricing.path, "pricing"),
link_item("Pricing", "/pricing", "pricing"),
),
class_name="desktop-only flex flex-row items-center gap-0 lg:gap-7 m-0 h-full list-none",
),
Expand Down
1 change: 1 addition & 0 deletions pcweb/constants.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
GALLERY_FORM_URL = "https://docs.google.com/forms/d/e/1FAIpQLSfB30hXB09CZ_H0Zi684w1y1zQSScyT3Qhd1mOUrAAIq9dj3Q/viewform?usp=sf_link"
NPMJS_URL = "https://www.npmjs.com/"
SPLINE_URL = "https://github.com/splinetool/react-spline"
HOSTING_URL = "https://cloud.staging.reflexcorp.run"

# Install urls.
BUN_URL = "https://bun.sh"
Expand Down
4 changes: 2 additions & 2 deletions pcweb/pages/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,15 @@
from .docs import doc_routes
from .faq import faq
from .index import index
from .pricing import pricing
from .page404 import page404
from .errors import errors
from .gallery import gallery
from .customers.landing import customers
from .customers.data.customers import customers_routes
from .gallery.apps import gallery_apps_routes
from .hosting_countdown.hosting_countdown import hosting_countdown

from .pricing.pricing import pricing
from .sales import sales
routes = [
*[r for r in locals().values() if isinstance(r, Route) and r.add_as_page],
*blog_routes,
Expand Down
Loading
Loading