Skip to content

Commit 8e54d19

Browse files
committed
update docs
1 parent cc93048 commit 8e54d19

File tree

6 files changed

+89
-17
lines changed

6 files changed

+89
-17
lines changed

docs/.vuepress/sidebar.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,11 @@ export const mySidebar: SidebarMulti = {
1919
prefix: 'reference/',
2020
items: [
2121
{text: '登录', link: 'login'},
22+
{text: 'OAuth 2.0', link: 'oauth2'},
23+
{text: '跨域', link: 'cors'},
2224
{text: '权限', link: 'permission'},
25+
{text: '事务', link: 'transaction'},
26+
{text: '代码生成', link: 'code-generation'},
2327
]
2428
},
2529
{

docs/guide/deploy/Docker.md

Lines changed: 29 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -167,8 +167,8 @@ createTime: 2024/09/12 20:40:22
167167
networks:
168168
- fba_network
169169
170-
# 后端专用,这与 fba_ui 冲突,如果你选择使用 fba_ui, // [!code focus:47] // [!code --:15]
171-
# 你应该停止使用 fba_nginx 容器,而使用 fba_ui 容器
170+
# 后端专用,这与 fba_ui 冲突,如果你选择使用 fba_ui, // [!code focus:51] // [!code --:15]
171+
# 你应该注释或删除 fba_nginx 容器脚本,并使用 fba_ui 容器
172172
fba_nginx:
173173
image: nginx
174174
ports:
@@ -183,7 +183,7 @@ createTime: 2024/09/12 20:40:22
183183
networks:
184184
- fba_network
185185
186-
# 如果服务器内存小于 4GB,CPU 小于四个内核 // [!code ++:31]
186+
# 如果服务器内存小于 4GB,CPU 小于四个内核 // [!code ++:34]
187187
# 建议进入 fba_ui 项目单独构建这个容器(参考下方前端部署教程)
188188
# 如果你不选择单独构建,务必在执行下面步骤前根据前端部署教程更新前端配置文件
189189
# 如果你选择单独构建,务必注释或删除此容器脚本
@@ -205,10 +205,13 @@ createTime: 2024/09/12 20:40:22
205205
- daemon off;
206206
volumes:
207207
# nginx https conf
208-
# 通过 docker 进行部署时,需要打开此配置项并
209-
# 确保 docker ssl 文件路径配置与 nginx conf 中的 ssl 文件路径配置一致
210-
# local_ssl_pem_path:服务器存放 ssl pem 文件的路径
211-
# local_ssl_key_path: 服务器存放 ssl key 文件的路径
208+
# 通过 docker 进行部署时,需要打开此配置项并确保<挂载到容器内的证书文件路径>配置
209+
# 与 nginx conf 中的 ssl 证书文件路径配置一致,如果你直接将 ssl 证书文件 cp
210+
# 到了 docker 容器内,则无需挂载证书文件,直接将它们注释或删除即可
211+
# local_ssl_pem_path:你在服务器存放 ssl pem 证书文件的路径,自行修改
212+
# local_ssl_key_path: 你在服务器存放 ssl key 证书文件的路径,自行修改
213+
# /etc/ssl/xxx.pem:挂载到容器内 ssl pem 证书文件的路径,自行修改
214+
# /etc/ssl/xxx.key:挂载到容器内 ssl key 证书文件的路径,自行修改
212215
- local_ssl_pem_path:/etc/ssl/xxx.pem
213216
- local_ssl_key_path:/etc/ssl/xxx.key
214217
- fba_static:/www/fba_server/backend/static
@@ -272,7 +275,7 @@ createTime: 2024/09/12 20:40:22
272275

273276
### 前端
274277

275-
::: warning
278+
::: caution
276279
我们提供此前端部署教程的目的是为你提供前端 Docker 部署解决方案,请记住我们的声明,此前端项目仅作为效果演示,而不是用于生产!
277280
:::
278281

@@ -325,14 +328,16 @@ createTime: 2024/09/12 20:40:22
325328
server_name 127.0.0.1;
326329
327330
listen 443 ssl; // [!code focus:10] // [!code ++:10]
328-
# docker ssl 文件路径配置应该与 docker-compose 中的保持一致
331+
# docker ssl 证书文件路径配置应该与 docker-compose 中的保持一致
332+
# /etc/ssl/xxx.pem:挂载到容器内 ssl pem 证书文件的路径,自行修改
333+
# /etc/ssl/xxx.key:挂载到容器内 ssl key 证书文件的路径,自行修改
329334
ssl_certificate /etc/ssl/xxx.pem;
330335
ssl_certificate_key /etc/ssl/xxx.key;
331336
ssl_ciphers ECDHE-RSA-AES128-GCM-SHA256:ECDHE:ECDH:AES:HIGH:!NULL:!aNULL:!MD5:!ADH:!RC4;
332337
ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
333338
ssl_prefer_server_ciphers on;
334339
335-
# xxx.com 应该与 env 中的配置保持一致
340+
# xxx.com 应该与 .env.production 中的配置保持一致
336341
server_name xxx.com;
337342
338343
client_max_body_size 10m;
@@ -362,7 +367,7 @@ createTime: 2024/09/12 20:40:22
362367
363368
server { // [!code focus:6] // [!code ++:6]
364369
listen 80;
365-
# xxx.com 应该与 env 中的配置保持一致
370+
# xxx.com 应该与 .env.production 中的配置保持一致
366371
server_name xxx.com;
367372
rewrite ^(.*)$ https://$host$1 permanent;
368373
}
@@ -372,6 +377,10 @@ createTime: 2024/09/12 20:40:22
372377

373378
4. 更新脚本文件
374379

380+
::: warning
381+
如果已通过后端 docker-compose 构建前端项目,此步骤和后面的剩余步骤直接跳过即可
382+
:::
383+
375384
::: details
376385
```yaml
377386
networks:
@@ -398,11 +407,14 @@ createTime: 2024/09/12 20:40:22
398407
- -g
399408
- daemon off;
400409
volumes:
401-
# nginx https conf
402-
# 通过 docker 进行部署时,需要打开此配置项并
403-
# 确保 docker ssl 文件路径配置与 nginx conf 中的 ssl 文件路径配置一致
404-
# local_ssl_pem_path:服务器存放 ssl pem 文件的路径
405-
# local_ssl_key_path: 服务器存放 ssl key 文件的路径
410+
# nginx https conf
411+
# 通过 docker 进行部署时,需要打开此配置项并确保<挂载到容器内的证书文件路径>配置
412+
# 与 nginx conf 中的 ssl 证书文件路径配置一致,如果你直接将 ssl 证书文件 cp
413+
# 到了 docker 容器内,则无需挂载证书文件,直接将它们注释或删除即可
414+
# local_ssl_pem_path:你在服务器存放 ssl pem 证书文件的路径,自行修改
415+
# local_ssl_key_path: 你在服务器存放 ssl key 证书文件的路径,自行修改
416+
# /etc/ssl/xxx.pem:挂载到容器内 ssl pem 证书文件的路径,自行修改
417+
# /etc/ssl/xxx.key:挂载到容器内 ssl key 证书文件的路径,自行修改
406418
- local_ssl_pem_path:/etc/ssl/xxx.pem
407419
- local_ssl_key_path:/etc/ssl/xxx.key
408420
- fba_static:/www/fba_server/backend/static
@@ -413,7 +425,7 @@ createTime: 2024/09/12 20:40:22
413425

414426
5. 构建并启动容器
415427

416-
创建网络(如果已构建后端可忽略)
428+
创建网络
417429

418430
```shell
419431
docker network create fba_network
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
---
2+
title: 代码生成
3+
createTime: 2024/09/22 16:02:06
4+
---
5+
6+
## TODO

docs/guide/reference/cors.md

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
---
2+
title: 跨域
3+
createTime: 2024/09/22 16:08:05
4+
---
5+
6+
当进行前后端项目联调或服务器部署时,你通常会遇到跨域问题,不过没关系,你只需修改后端配置,就可以轻松解决 CORS 相关问题
7+
8+
## 本地
9+
10+
进入 `core/conf.py` 文件,修改 `CORS_ALLOWED_ORIGINS` 配置即可
11+
12+
```py
13+
CORS_ALLOWED_ORIGINS: list[str] = [
14+
'http://localhost:5173', # 前端访问地址,末尾不要带 '/'
15+
]
16+
```
17+
18+
## 服务器
19+
20+
进入 `core/conf.py` 文件,修改 `CORS_ALLOWED_ORIGINS` 配置即可
21+
22+
1. 非 https 部署
23+
24+
```py
25+
# [!code word:http]
26+
CORS_ALLOWED_ORIGINS: list[str] = [
27+
'http://服务器ip:端口号', # 前端访问地址,末尾不要带 '/'
28+
]
29+
```
30+
31+
2. https 部署
32+
33+
```py
34+
# [!code word:https]
35+
CORS_ALLOWED_ORIGINS: list[str] = [
36+
'https://域名', # 前端访问地址,末尾不要带 '/'
37+
]
38+
```

docs/guide/reference/oauth2.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
---
2+
title: OAuth 2.0
3+
createTime: 2024/09/22 16:11:18
4+
---
5+
6+
## TODO

docs/guide/reference/transaction.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
---
2+
title: 事务
3+
createTime: 2024/09/22 16:01:47
4+
---
5+
6+
## TODO

0 commit comments

Comments
 (0)