|
1 | 1 | ```python exec |
2 | 2 | import reflex as rx |
3 | 3 | from reflex_image_zoom import image_zoom |
| 4 | +from pcweb.pages.docs import hosting |
4 | 5 | from pcweb.pages import docs |
5 | 6 | from pcweb.styles.styles import get_code_style, cell_style |
6 | 7 |
|
@@ -59,78 +60,13 @@ vmtypes = [ |
59 | 60 |
|
60 | 61 | ``` |
61 | 62 |
|
| 63 | +# App |
62 | 64 |
|
63 | | -# Reflex Cloud - Additional Concepts |
| 65 | +In Reflex Cloud an "app" (or "application" or "website") refers to a web application built using the Reflex framework, which can be deployed and managed within the Cloud platform. |
64 | 66 |
|
65 | | -To go back, i.e. from an app to a project or from a project to your list of projects you just click the `REFLEX logo` in the top left corner of the page. |
| 67 | +You can deploy an app using the `reflex deploy` command. |
66 | 68 |
|
67 | | -```md alert info |
68 | | -# All flag values are saved between runs |
69 | | -All your flag values, i.e. environment variables or regions or tokens, are saved between runs. This means that if you run a command and you pass a flag value, the next time you run the same command the flag value will be the same as the last time you ran it. This means you should only set the flag values again if you want to change them. |
70 | | -``` |
71 | | - |
72 | | -## Environment Variables |
73 | | - |
74 | | - |
75 | | -Below is an example of how to use an environment variable file. You can pass the `--envfile` flag with the path to the env file. For example: |
76 | | - |
77 | | -```bash |
78 | | -reflex deploy --project f88b1574-f101-####-####-5f########## --envfile .env |
79 | | -``` |
80 | | - |
81 | | -In this example the path to the file is `.env`. |
82 | | - |
83 | | - |
84 | | -If you prefer to pass the environment variables manually below is deployment command example: |
85 | | - |
86 | | -```bash |
87 | | -reflex deploy --project f88b1574-f101-####-####-5f########## --env OPENAI_API_KEY=sk-proj-vD4i9t6U############################ |
88 | | -``` |
89 | | - |
90 | | -They are passed after the `--env` flag as key value pairs. |
91 | | - |
92 | | -To pass multiple environment variables, you can repeat the `--env` tag. i.e. `reflex deploy --project f88b1574-f101-####-####-5f########## --env KEY1=VALUE1 --env KEY2=VALUE`. The `--envfile` flag will override any envs set manually. |
93 | | - |
94 | | - |
95 | | -```md alert info |
96 | | -# More information on Environment Variables |
97 | | -Environment variables are encrypted and safely stored. We recommend that backend API keys or secrets are entered as `envs`. Make sure to enter the `envs` without any quotation marks. We do not show the values of them in any CLI commands, only their names (or keys). |
98 | | - |
99 | | -You access the values of `envs` by referencing `os.environ` with their names as keys in your app's backend. For example, if you set an env `ASYNC_DB_URL`, you are able to access it by `os.environ["ASYNC_DB_URL"]`. Some Python libraries automatically look for certain environment variables. For example, `OPENAI_API_KEY` for the `openai` python client. The `boto3` client credentials can be configured by setting `AWS_ACCESS_KEY_ID`,`AWS_SECRET_ACCESS_KEY`. This information is typically available in the documentation of the Python packages you use. |
100 | | -``` |
101 | | - |
102 | | -## Adding Team Members |
103 | | - |
104 | | -If you are a User you have the ability to create, deploy and delete apps, but you do not have the power to add or delete users from that project. You must be an Admin for that. |
105 | | - |
106 | | -As an Admin you will see the an `Add user` button in the top right of the screen, as shown in the image below. Clicking on this will allow you to add a user to the project. You will need to enter the email address of the user you wish to add. |
107 | | - |
108 | | -```python eval |
109 | | -image_zoom(rx.image(src="/hosting_adding_team_members.png", alt="Adding team members to Reflex Cloud")) |
110 | | -``` |
111 | | - |
112 | | -```python eval |
113 | | -rx.box(height="20px") |
114 | | -``` |
115 | | - |
116 | | -```md alert warning |
117 | | -# Currently a User must already have logged in once before they can be added to a project. |
118 | | -At this time a User must be logged in to be added to a project. In future there will be automatic email invites sent to add new users who have never logged in before. |
119 | | -``` |
120 | | - |
121 | | - |
122 | | - |
123 | | - |
124 | | - |
125 | | -## Tokens |
126 | | - |
127 | | -A token gives someone else all the permissions you have as a User or an Admin. They can run any Reflex Cloud command from the CLI as if they are you using the `--token` flag. A good use case would be for GitHub actions (you store this token in the secrets). |
128 | | - |
129 | | -Tokens are found on the Project List page. If you cannot find it click the Reflex Logo in the top left side of the page until it appears as in the image below. |
130 | | - |
131 | | -```python eval |
132 | | -image_zoom(rx.image(src="/hosting_tokens.png", alt="Adding tokens to Reflex Cloud")) |
133 | | -``` |
| 69 | +There are many actions you can take in the Cloud UI to manage your app. Below are some of the most common actions you may want to take. |
134 | 70 |
|
135 | 71 |
|
136 | 72 | ## VMTypes |
@@ -176,6 +112,7 @@ rx.table.root( |
176 | 112 | ) |
177 | 113 | ``` |
178 | 114 |
|
| 115 | + |
179 | 116 | ## Regions |
180 | 117 |
|
181 | 118 | Below is an example of how to deploy your app in several regions: |
@@ -206,4 +143,85 @@ rx.table.root( |
206 | 143 | ), |
207 | 144 | variant="surface", |
208 | 145 | ) |
209 | | -``` |
| 146 | +``` |
| 147 | + |
| 148 | + |
| 149 | +## View Logs |
| 150 | + |
| 151 | +To view the app logs follow the arrow in the image below and press on the `Logs` dropdown. |
| 152 | + |
| 153 | +```python eval |
| 154 | +image_zoom(rx.image(src="/view_logs.webp", padding_bottom="20px")) |
| 155 | +``` |
| 156 | + |
| 157 | +```md alert info |
| 158 | +# CLI Command to view logs |
| 159 | +`reflex cloud apps logs [OPTIONS] [APP_ID]` |
| 160 | +``` |
| 161 | + |
| 162 | +## View Deployment Logs and Deployment History |
| 163 | + |
| 164 | +To view the deployment history follow the arrow in the image below and press on the `Deployments`. |
| 165 | + |
| 166 | +```python eval |
| 167 | +image_zoom(rx.image(src="/view_deployment_logs.webp")) |
| 168 | +``` |
| 169 | + |
| 170 | +This brings you to the page below where you can see the deployment history of your app. Click on deployment you wish to explore further. |
| 171 | + |
| 172 | +```python eval |
| 173 | +image_zoom(rx.image(src="/view_deployment_logs_2.webp", padding_bottom="20px")) |
| 174 | +``` |
| 175 | + |
| 176 | +```md alert info |
| 177 | +# CLI Command to view deployment history |
| 178 | +`reflex cloud apps history [OPTIONS] [APP_ID]` |
| 179 | +``` |
| 180 | + |
| 181 | +This brings you to the page below where you can view the deployment logs of your app by clicking the `Build logs` dropdown. |
| 182 | + |
| 183 | +```python eval |
| 184 | +image_zoom(rx.image(src="/view_deployment_logs_3.webp")) |
| 185 | +``` |
| 186 | + |
| 187 | + |
| 188 | +## Stopping an App |
| 189 | + |
| 190 | +To stop an app follow the arrow in the image below and press on the `Stop app` button. Pausing an app will stop it from running and will not be accessible to users until you resume it. In addition, this will stop you being billed for your app. |
| 191 | + |
| 192 | +```python eval |
| 193 | +image_zoom(rx.image(src="/stopping_app.webp", padding_bottom="20px")) |
| 194 | +``` |
| 195 | + |
| 196 | +```md alert info |
| 197 | +# CLI Command to stop an app |
| 198 | +`reflex cloud apps stop [OPTIONS] [APP_ID]` |
| 199 | +``` |
| 200 | + |
| 201 | +## Deleting an App |
| 202 | + |
| 203 | +To delete an app click on the `Settings` tab in the Cloud UI on the app page. |
| 204 | + |
| 205 | +```python eval |
| 206 | +image_zoom(rx.image(src="/environment_variables.webp")) |
| 207 | +``` |
| 208 | + |
| 209 | +Then click on the `Danger` tab as shown below. |
| 210 | + |
| 211 | +```python eval |
| 212 | +image_zoom(rx.image(src="/deleting_app.webp")) |
| 213 | +``` |
| 214 | + |
| 215 | +Here there is a `Delete app` button. Pressing this button will delete the app and all of its data. This action is irreversible. |
| 216 | + |
| 217 | +```md alert info |
| 218 | +# CLI Command to delete an app |
| 219 | +`reflex cloud apps delete [OPTIONS] [APP_ID]` |
| 220 | +``` |
| 221 | + |
| 222 | + |
| 223 | +## Other app settings |
| 224 | + |
| 225 | +Clicking on the `Settings` tab in the Cloud UI on the app page also allows a user to change the `app name`, change the `app description` and check the `app id`. |
| 226 | + |
| 227 | +The other app settings also allows users to edit and add secrets (environment variables) to the app. For more information on secrets, see the [Secrets (Environment Variables)]({hosting.secrets_environment_vars.path}) page. |
0 commit comments