perf: docs

This commit is contained in:
archer 2023-04-14 16:53:05 +08:00
parent 6ff5db7b41
commit 36dad6df33
No known key found for this signature in database
GPG Key ID: 166CA6BF2383B2BB
3 changed files with 44 additions and 25 deletions

View File

@ -37,6 +37,7 @@ docker push imageName:tag
# 安装docker # 安装docker
curl -sSL https://get.daocloud.io/docker | sh curl -sSL https://get.daocloud.io/docker | sh
sudo systemctl start docker sudo systemctl start docker
# 安装 docker-compose
``` ```
#### 软件教程: clash 代理 #### 软件教程: clash 代理
@ -136,33 +137,42 @@ appendfilename "appendonly.aof"
appendfsync everysec appendfsync everysec
``` ```
**nginx.conf** **nginx.conf**
``` ```conf
user nginx; user nginx;
worker_processes auto; worker_processes auto;
error_log /var/log/nginx/error.log; worker_rlimit_nofile 51200;
pid /run/nginx.pid;
events { events {
worker_connections 1024; worker_connections 1024;
} }
http { http {
include /etc/nginx/mime.types; access_log off;
default_type application/octet-stream; server_names_hash_bucket_size 512;
include /etc/nginx/conf.d/*.conf; client_header_buffer_size 32k;
large_client_header_buffers 4 32k;
client_max_body_size 50M;
gzip on;
gzip_min_length 1k;
gzip_buffers 4 8k;
gzip_http_version 1.1;
gzip_comp_level 6;
gzip_vary on;
gzip_types text/plain application/x-javascript text/css application/javascript application/json application/xml;
gzip_disable "MSIE [1-6]\.";
open_file_cache max=1000 inactive=1d;
open_file_cache_valid 30s;
open_file_cache_min_uses 8;
open_file_cache_errors off;
server { server {
listen 80; listen 443 ssl;
server_name test.com; server_name fastgpt.ahapocket.cn;
ssl_certificate /ssl/fastgpt.pem;
gzip on; ssl_certificate_key /ssl/fastgpt.key;
gzip_min_length 1k; ssl_session_timeout 5m;
gzip_buffers 4 8k;
gzip_http_version 1.1;
gzip_comp_level 6;
gzip_vary on;
gzip_types text/plain application/x-javascript text/css application/javascript application/json application/xml;
gzip_disable "MSIE [1-6]\.";
location / { location / {
proxy_pass http://localhost:3000; proxy_pass http://localhost:3000;
@ -171,12 +181,22 @@ http {
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
} }
} }
server {
listen 80;
server_name fastgpt.ahapocket.cn;
rewrite ^(.*) https://$server_name$1 permanent;
}
} }
``` ```
#### 运行脚本 #### 运行脚本
**redis创建索引** **redis 初始化**
```bash ```bash
# 进入容器
docker exec -it 容器ID bash
redis-cli -p 6379
auth psw1234
# 添加索引
FT.CREATE idx:model:data:hash ON HASH PREFIX 1 model:data: SCHEMA modelId TAG userId TAG status TAG q TEXT text TEXT vector VECTOR FLAT 6 DIM 1536 DISTANCE_METRIC COSINE TYPE FLOAT32 FT.CREATE idx:model:data:hash ON HASH PREFIX 1 model:data: SCHEMA modelId TAG userId TAG status TAG q TEXT text TEXT vector VECTOR FLAT 6 DIM 1536 DISTANCE_METRIC COSINE TYPE FLOAT32
``` ```
**run.sh 运行文件** **run.sh 运行文件**

View File

@ -83,23 +83,23 @@ export default async function handler(req: NextApiRequest, res: NextApiResponse)
: :
. .
1. query phone. 1. query phone.
2. ,501,原因为:手机号格式错误. 2. ,不正确则返回错误原因:手机号格式错误.
3. phone ,6,内容为:你正在注册laf,验证码为:code. 3. phone ,6,内容为:你正在注册laf,验证码为:code.
4. ,"codes", {phone, code}. 4. ,"codes", {phone, code}.
,. ,.
1. body phone code. 1. body phone code.
2. ,501,原因为:手机号格式错误. 2. ,不正确则返回错误原因:手机号格式错误.
2. ,"codes", phone, code body参数的记录,500,原因为:验证码不正确. 2. ,"codes", phone, code body参数的记录,没有的话返回错误原因:验证码不正确.
4. ,"users" ,{phone, code, createTime}. 4. ,"users" ,{phone, code, createTime}.
5. , code . 5. , code .
6. 返回新建用户的Id: return {userId} 6. 返回新建用户的Id: return {userId}
blogId,blogText,tags,. blogId,blogText,tags,.
1. body blogId,blogText tags. 1. body blogId,blogText tags.
2. blogId ,500,原因为:博客ID不能为空. 2. blogId ,为空则返回错误原因:博客ID不能为空.
3. blogText ,500,原因为:博客内容不能为空. 3. blogText ,为空则返回错误原因:博客内容不能为空.
4. tags ,500,原因为:标签必须为数组. 4. tags ,不是则返回错误原因:标签必须为数组.
5. , updateTime. 5. , updateTime.
6. ,"blogs", blogId {blogText, tags, updateTime}. 6. ,"blogs", blogId {blogText, tags, updateTime}.
7. "更新博客记录成功"` 7. "更新博客记录成功"`

View File

@ -29,7 +29,6 @@ export const connectRedis = async () => {
await global.redisClient.connect(); await global.redisClient.connect();
// 1 - 测试库0 - 正式
await global.redisClient.SELECT(0); await global.redisClient.SELECT(0);
return global.redisClient; return global.redisClient;