Skip to content

Commit 9ec9aa0

Browse files
tgberkeleyTom GotsmanKastier1
authored
Add more cloud docs scaling (#1188)
* adding additional images for scaling * add new commands to the cli ref * update scale docs * add config command to cli ref * cloud config docs * Update docs/hosting/app.md Co-authored-by: Simon Young <[email protected]> --------- Co-authored-by: Tom Gotsman <[email protected]> Co-authored-by: Simon Young <[email protected]>
1 parent 68dede0 commit 9ec9aa0

File tree

7 files changed

+62
-59
lines changed

7 files changed

+62
-59
lines changed

assets/regions_1.webp

29.9 KB
Loading

assets/regions_2.webp

27.7 KB
Loading

assets/scaling_regions.webp

27.3 KB
Loading

assets/scaling_vms.webp

36.4 KB
Loading

docs/hosting/app.md

Lines changed: 54 additions & 57 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ from pcweb.styles.styles import get_code_style, cell_style
99
regions = {
1010
"ams": "Amsterdam, Netherlands",
1111
"arn": "Stockholm, Sweden",
12-
"alt": "Atlanta, Georgia (US)",
12+
"atl": "Atlanta, Georgia (US)",
1313
"bog": "Bogotá, Colombia",
1414
"bom": "Mumbai, India",
1515
"bos": "Boston, Massachusetts (US)",
@@ -44,19 +44,6 @@ regions = {
4444
"yyz": "Toronto, Canada"
4545
}
4646

47-
vmtypes = [
48-
{"id": "c1m.5", "name": "Single CPU Small", "cpu_cores": 1, "ram_gb": 0.512},
49-
{"id": "c1m1", "name": "Single CPU Medium", "cpu_cores": 1, "ram_gb": 1.024},
50-
{"id": "c1m2", "name": "Single CPU Large", "cpu_cores": 1, "ram_gb": 2.048},
51-
{"id": "c2m.5", "name": "Double CPU Micro", "cpu_cores": 2, "ram_gb": 0.512},
52-
{"id": "c2m1", "name": "Double CPU Small", "cpu_cores": 2, "ram_gb": 1.024},
53-
{"id": "c2m2", "name": "Double CPU Medium", "cpu_cores": 2, "ram_gb": 2.048},
54-
{"id": "c2m4", "name": "Double CPU Large", "cpu_cores": 2, "ram_gb": 4.096},
55-
{"id": "c4m1", "name": "Quad CPU Micro", "cpu_cores": 4, "ram_gb": 1.024},
56-
{"id": "c4m2", "name": "Quad CPU Small", "cpu_cores": 4, "ram_gb": 2.048},
57-
{"id": "c4m4", "name": "Quad CPU Medium", "cpu_cores": 4, "ram_gb": 4.096},
58-
{"id": "c4m8", "name": "Quad CPU Large", "cpu_cores": 4, "ram_gb": 8.192}
59-
]
6047

6148
```
6249

@@ -71,6 +58,18 @@ There are many actions you can take in the Cloud UI to manage your app. Below ar
7158

7259
## VMTypes
7360

61+
62+
To scale your app you can choose different VMTypes. VMTypes are different configurations of CPU and RAM.
63+
64+
To scale your VM in the Cloud UI, click on the `Settings` tab in the Cloud UI on the app page, and then click on the `Scale` tab as shown below. Clicking on the `Change VM` button will allow you to scale your app.
65+
66+
67+
```python eval
68+
image_zoom(rx.image(src="/scaling_vms.webp", padding_bottom="20px"))
69+
```
70+
71+
### VMTypes in the CLI
72+
7473
To get all the possible VMTypes you can run the following command:
7574

7675
```bash
@@ -83,37 +82,31 @@ To set which VMType to use when deploying your app you can pass the `--vmtype` f
8382
reflex deploy --project f88b1574-f101-####-####-5f########## --vmtype c2m4
8483
```
8584

86-
This will deploy your app with the `c2m4` VMType, giving your app 2 cpu cores and 4 gb of ram.
85+
This will deploy your app with the `c2m4` VMType, giving your app 2 CPU cores and 4 GB of RAM.
86+
8787

88-
Below is a table of all the possible VMTypes:
88+
89+
## Regions
90+
91+
To scale your app you can choose different regions. Regions are different locations around the world where your app can be deployed.
92+
93+
To scale your app to multiple regions in the Cloud UI, click on the `Settings` tab in the Cloud UI on the app page, and then click on the `Regions` tab as shown below. Clicking on the `Add new region` button will allow you to scale your app to multiple regions.
8994

9095
```python eval
91-
rx.table.root(
92-
rx.table.header(
93-
rx.table.row(
94-
rx.table.column_header_cell("id"),
95-
rx.table.column_header_cell("name"),
96-
rx.table.column_header_cell("cpu (cores)"),
97-
rx.table.column_header_cell("ram (gb)"),
98-
),
99-
),
100-
rx.table.body(
101-
*[
102-
rx.table.row(
103-
rx.table.cell(rx.code(vmtype["id"], style=get_code_style("violet"))),
104-
rx.table.cell(vmtype["name"], style=cell_style),
105-
rx.table.cell(vmtype["cpu_cores"], style=cell_style),
106-
rx.table.cell(vmtype["ram_gb"], style=cell_style),
107-
)
108-
for vmtype in vmtypes
109-
]
110-
),
111-
variant="surface",
96+
image_zoom(rx.image(src="/scaling_regions.webp", padding_bottom="20px"))
97+
```
98+
99+
The images below show all the regions that can be deployed in.
100+
101+
```python eval
102+
rx.hstack(
103+
image_zoom(rx.image(src="/regions_1.webp", padding_bottom="20px")),
104+
image_zoom(rx.image(src="/regions_2.webp", padding_bottom="20px")),
112105
)
113106
```
114107

115108

116-
## Regions
109+
### Selecting Regions to Deploy in the CLI
117110

118111
Below is an example of how to deploy your app in several regions:
119112

@@ -124,28 +117,32 @@ reflex deploy --project f88b1574-f101-####-####-5f########## --region sjc --regi
124117
By default all apps are deloyed in `sjc` if no other regions are given. If you wish to deploy in another region or several regions you can pass the `--region` flag (`-r` also works) with the region code. Check out all the regions that we can deploy to below:
125118

126119

127-
```python eval
128-
rx.table.root(
129-
rx.table.header(
130-
rx.table.row(
131-
rx.table.column_header_cell("Region Code"),
132-
rx.table.column_header_cell("Region"),
133-
),
134-
),
135-
rx.table.body(
136-
*[
137-
rx.table.row(
138-
rx.table.cell(rx.code(region_code, style=get_code_style("violet"))),
139-
rx.table.cell(region_name, style=cell_style),
140-
)
141-
for region_code, region_name in regions.items()
142-
]
143-
),
144-
variant="surface",
145-
)
120+
## Config File
121+
122+
To create a `config.yml` file for your app run the command below:
123+
124+
```bash
125+
reflex cloud config
126+
```
127+
128+
This will create a yaml file similar to the one below where you can edit the app configuration:
129+
130+
```yaml
131+
name: medo
132+
description: ''
133+
regions:
134+
sjc: 1
135+
lhr: 2
136+
vmtype: c1m1
137+
hostname: null
138+
envfile: .env
139+
project: null
140+
packages:
141+
- procps
146142
```
147143
148144
145+
149146
## View Logs
150147
151148
To view the app logs follow the arrow in the image below and press on the `Logs` dropdown.

docs/hosting/deploy-quick-start.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,11 @@ That’s it! You should receive some feedback on the progress of your deployment
7070
If you go back to the Cloud UI you should be able to see your deployed app and other useful app information.
7171

7272

73+
```md alert info
74+
# Setup a Cloud Config File
75+
To create a `config.yml` file for your app to set your app configuration check out the [Cloud Config Docs]({docs.hosting.app.path}#config-file).
76+
```
77+
7378
```md alert info
7479
# Moving around the Cloud UI
7580
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.

pcweb/pages/docs/cloud_cliref.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ def process_command(prefix, path_to_file, dict_prefix=""):
5050
)
5151
else:
5252
output = get_command_help_output(path_to_file=path_to_file)
53-
53+
5454
# Construct the regular expression pattern
5555
escaped_prefix = re.escape(prefix)
5656
pattern = rf"## `{escaped_prefix} (.*?)`\n(.*?)(?=\n## `{escaped_prefix}|\Z)"
@@ -85,12 +85,13 @@ def process_command(prefix, path_to_file, dict_prefix=""):
8585
categories = {
8686
"login": ["login", "logout"],
8787
"deploy": ["deploy"],
88-
"apps": ["apps status", "apps start", "apps stop", "apps scale", "apps delete", "apps logs", "apps history"],
88+
"apps": ["apps scale", "apps status", "apps start", "apps stop", "apps delete", "apps logs", "apps history", "apps build-logs", "apps list"],
8989
"projects": ["project list", "project create", "project select", "project invite",
9090
"project get-select", "project usage", "project role-permissions", "project users"],
9191
"secrets": ["secrets list", "secrets delete", "secrets update"],
9292
"vmtypes": ["vmtypes"],
9393
"regions": ["regions"],
94+
"config": ["config"]
9495
}
9596

9697
# Dictionary to store the combined documentation for each category

0 commit comments

Comments
 (0)