From 680681e21574cce64317e80bd5fddf54075fbc3b Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=E4=BD=95=E7=AB=A5=E5=B4=87?= <1261960504@qq.com>
Date: Wed, 22 Mar 2023 09:31:07 +0000
Subject: [PATCH 1/6] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E6=96=87=E4=BB=B6?=
=?UTF-8?q?=E4=B8=8A=E4=BC=A0=E9=99=90=E5=88=B6?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.changeset/many-humans-work.md | 8 ++++++++
.gitignore | 1 +
apps/gateway/src/env.ts | 2 +-
apps/portal-web/config.js | 4 ++++
.../src/pageComponents/filemanager/UploadModal.tsx | 4 ++++
apps/portal-web/src/utils/config.ts | 3 ++-
deploy/local/config-example.py | 2 ++
deploy/local/generate.py | 5 +++++
deploy/vagrant/scow/scow-deployment/config.py | 2 ++
docs/docs/refs/env/gateway.md | 2 +-
10 files changed, 30 insertions(+), 3 deletions(-)
create mode 100644 .changeset/many-humans-work.md
diff --git a/.changeset/many-humans-work.md b/.changeset/many-humans-work.md
new file mode 100644
index 0000000000..6703e910e6
--- /dev/null
+++ b/.changeset/many-humans-work.md
@@ -0,0 +1,8 @@
+---
+"@scow/portal-web": patch
+"@scow/demo-vagrant": patch
+"@scow/gateway": patch
+"@scow/deploy-compose": patch
+---
+
+上传文件、请求最大体积限制可配置
diff --git a/.gitignore b/.gitignore
index 5b512b517a..5f6abbd581 100644
--- a/.gitignore
+++ b/.gitignore
@@ -11,3 +11,4 @@ out
dist
version.json
.pnpm-store
+.DS_Store
diff --git a/apps/gateway/src/env.ts b/apps/gateway/src/env.ts
index 6414f5571c..c8c919490b 100644
--- a/apps/gateway/src/env.ts
+++ b/apps/gateway/src/env.ts
@@ -14,7 +14,7 @@ import { envConfig, str } from "@scow/lib-config";
export const config = envConfig({
RESOLVER: str({ desc: "DNS地址", default: "127.0.0.11" }),
- CLIENT_MAX_BODY_SIZE: str({ desc: "请求文件大小限制", default: "1g" }),
+ // CLIENT_MAX_BODY_SIZE: str({ desc: "请求文件大小限制", default: "1g" }),
BASE_PATH: str({ desc: "base path", default: "" }),
diff --git a/apps/portal-web/config.js b/apps/portal-web/config.js
index f6c1c5d3e9..d3ed8046fe 100644
--- a/apps/portal-web/config.js
+++ b/apps/portal-web/config.js
@@ -50,6 +50,8 @@ const specs = {
MIS_URL: str({ desc: "如果部署了管理系统,管理系统的URL。如果和本系统域名相同,可以只写完整的路径。将会覆盖配置文件。空字符串等价于未部署管理系统", default: "" }),
NOVNC_CLIENT_URL: str({ desc: "novnc客户端的URL。如果和本系统域名相同,可以只写完整路径", default: "/vnc" }),
+
+ CLIENT_MAX_BODY_SIZE: str({ desc: "限制整个系统上传(请求)文件的大小,可接受的格式为nginx的client_max_body_size可接受的值", default: "1g" }),
};
const mockEnv = process.env.NEXT_PUBLIC_USE_MOCK === "1";
@@ -143,6 +145,8 @@ const buildRuntimeConfig = async (phase, basePath) => {
PASSWORD_PATTERN_MESSAGE: commonConfig.passwordPattern?.errorMessage,
BASE_PATH: basePath,
+
+ CLIENT_MAX_BODY_SIZE: config.CLIENT_MAX_BODY_SIZE,
}
if (!building && !testenv) {
diff --git a/apps/portal-web/src/pageComponents/filemanager/UploadModal.tsx b/apps/portal-web/src/pageComponents/filemanager/UploadModal.tsx
index 2099868429..c9df39dfb8 100644
--- a/apps/portal-web/src/pageComponents/filemanager/UploadModal.tsx
+++ b/apps/portal-web/src/pageComponents/filemanager/UploadModal.tsx
@@ -15,6 +15,7 @@ import { App, Button, Modal, Upload } from "antd";
import { join } from "path";
import { api } from "src/apis";
import { urlToUpload } from "src/pageComponents/filemanager/api";
+import { publicConfig } from "src/utils/config";
interface Props {
open: boolean;
@@ -44,6 +45,9 @@ export const UploadModal: React.FC = ({ open, onClose, path, reload, clus
文件将会上传到:{path}。同名文件将会被覆盖。
+
+ 单个上传文件体积最大为:{publicConfig.CLIENT_MAX_BODY_SIZE}。
+
Date: Thu, 23 Mar 2023 03:49:52 +0000
Subject: [PATCH 2/6] =?UTF-8?q?fix=20=E5=8E=BB=E6=8E=89=E6=B3=A8=E9=87=8A?=
=?UTF-8?q?=E7=9A=84=E4=BB=A3=E7=A0=81?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
apps/gateway/src/env.ts | 1 -
1 file changed, 1 deletion(-)
diff --git a/apps/gateway/src/env.ts b/apps/gateway/src/env.ts
index c8c919490b..4a7a9413ff 100644
--- a/apps/gateway/src/env.ts
+++ b/apps/gateway/src/env.ts
@@ -14,7 +14,6 @@ import { envConfig, str } from "@scow/lib-config";
export const config = envConfig({
RESOLVER: str({ desc: "DNS地址", default: "127.0.0.11" }),
- // CLIENT_MAX_BODY_SIZE: str({ desc: "请求文件大小限制", default: "1g" }),
BASE_PATH: str({ desc: "base path", default: "" }),
From ea314b41aa91d709c53c260528d2f74fc6ecf054 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=E4=BD=95=E7=AB=A5=E5=B4=87?= <1261960504@qq.com>
Date: Thu, 23 Mar 2023 06:04:08 +0000
Subject: [PATCH 3/6] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E6=8F=8F=E8=BF=B0?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
apps/gateway/src/env.ts | 2 ++
apps/portal-web/config.js | 2 +-
2 files changed, 3 insertions(+), 1 deletion(-)
diff --git a/apps/gateway/src/env.ts b/apps/gateway/src/env.ts
index 4a7a9413ff..e5bd93b2ab 100644
--- a/apps/gateway/src/env.ts
+++ b/apps/gateway/src/env.ts
@@ -15,6 +15,8 @@ import { envConfig, str } from "@scow/lib-config";
export const config = envConfig({
RESOLVER: str({ desc: "DNS地址", default: "127.0.0.11" }),
+ CLIENT_MAX_BODY_SIZE: str({ desc: "请求文件大小限制", default: "1G" }),
+
BASE_PATH: str({ desc: "base path", default: "" }),
PORTAL_PATH: str({ desc: "门户系统路径", default: "/" }),
diff --git a/apps/portal-web/config.js b/apps/portal-web/config.js
index d3ed8046fe..e314f909bf 100644
--- a/apps/portal-web/config.js
+++ b/apps/portal-web/config.js
@@ -51,7 +51,7 @@ const specs = {
NOVNC_CLIENT_URL: str({ desc: "novnc客户端的URL。如果和本系统域名相同,可以只写完整路径", default: "/vnc" }),
- CLIENT_MAX_BODY_SIZE: str({ desc: "限制整个系统上传(请求)文件的大小,可接受的格式为nginx的client_max_body_size可接受的值", default: "1g" }),
+ CLIENT_MAX_BODY_SIZE: str({ desc: "限制整个系统上传(请求)文件的大小,可接受的格式为nginx的client_max_body_size可接受的值", default: "1G" }),
};
const mockEnv = process.env.NEXT_PUBLIC_USE_MOCK === "1";
From 88d51152d3ce327ad3d950f44215c6c75fdc559e Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=E4=BD=95=E7=AB=A5=E5=B4=87?= <1261960504@qq.com>
Date: Thu, 23 Mar 2023 06:55:43 +0000
Subject: [PATCH 4/6] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E9=85=8D=E7=BD=AE?=
=?UTF-8?q?=E6=96=87=E4=BB=B6?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
deploy/local/generate.py | 2 +-
deploy/vagrant/scow/scow-deployment/config.py | 10 ++++++++--
2 files changed, 9 insertions(+), 3 deletions(-)
diff --git a/deploy/local/generate.py b/deploy/local/generate.py
index fefc859703..948cec875b 100644
--- a/deploy/local/generate.py
+++ b/deploy/local/generate.py
@@ -55,7 +55,7 @@ def check_path_format(name, value):
LOG_PRETTY = json.dumps(get_cfg(["LOG", "PRETTY"], False))
# 设置上传(请求)文件大小限制
-CLIENT_MAX_BODY_SIZE = get_cfg(["COMMON", "UPLOAD_FILE_SIZE_LIMIT"], "1G")
+CLIENT_MAX_BODY_SIZE = get_cfg(["GATEWAY", "UPLOAD_FILE_SIZE_LIMIT"], "1G")
# easy migration from IMAGE_BASE to IMAGE
SCOW_IMAGE = get_cfg(["COMMON", "IMAGE"])
diff --git a/deploy/vagrant/scow/scow-deployment/config.py b/deploy/vagrant/scow/scow-deployment/config.py
index 1cf54e8323..a734cdd2b8 100644
--- a/deploy/vagrant/scow/scow-deployment/config.py
+++ b/deploy/vagrant/scow/scow-deployment/config.py
@@ -4,19 +4,25 @@
#
# COMMON.PORT: 整个系统的入口端口
# COMMON.BASE_PATH: 整个系统的部署根路径。以/开头,不要以/结尾,如果是根路径写"/"
-# COMMON.UPLOAD_FILE_SIZE_LIMIT:限制整个系统上传(请求)文件的大小,可接受的格式为nginx的client_max_body_size可接受的值,默认为1G
# COMMON.IMAGE: 镜像仓库地址,据实际情况填写
# COMMON.IMAGE_TAG: 镜像tag,据实际情况填写
# 如果您的镜像是本地构建的,IMAGE_BASE和IMAGE_TAG必须和构建时.env.build中的值保持一致。
COMMON = {
"PORT": 80,
"BASE_PATH": "/",
- "UPLOAD_FILE_SIZE_LIMIT": "1G",
# "IMAGE": "mirrors.pku.edu.cn/pkuhpc/scow/scow",
"IMAGE": "ghcr.io/pkuhpc/scow/scow",
"IMAGE_TAG": "master",
}
+
+# ------- 网关配置 -------
+#
+# GATEWAY.UPLOAD_FILE_SIZE_LIMIT:限制整个系统上传(请求)文件的大小,可接受的格式为nginx的client_max_body_size可接受的值,默认为1G
+GATEWAY = {
+ "UPLOAD_FILE_SIZE_LIMIT": "1G",
+}
+
#
# ------- 门户系统 -------
#
From 9091a44de9542f596bb63cb61374fb0b2e739357 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=E4=BD=95=E7=AB=A5=E5=B4=87?= <1261960504@qq.com>
Date: Thu, 23 Mar 2023 06:58:39 +0000
Subject: [PATCH 5/6] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E9=85=8D=E7=BD=AE?=
=?UTF-8?q?=E6=96=87=E4=BB=B6?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
deploy/local/config-example.py | 9 +++++++--
1 file changed, 7 insertions(+), 2 deletions(-)
diff --git a/deploy/local/config-example.py b/deploy/local/config-example.py
index a95f226918..e8cf06f264 100644
--- a/deploy/local/config-example.py
+++ b/deploy/local/config-example.py
@@ -14,18 +14,23 @@
#
# COMMON.PORT: 整个系统的入口端口
# COMMON.BASE_PATH: 整个系统的部署根路径。以/开头,不要以/结尾,如果是根路径写"/"
-# COMMON.UPLOAD_FILE_SIZE_LIMIT:限制整个系统上传(请求)文件的大小,可接受的格式为nginx的client_max_body_size可接受的值,默认为1G
# COMMON.IMAGE: 镜像地址,据实际情况填写
# COMMON.IMAGE_TAG: 镜像tag,据实际情况填写
# 如果您的镜像是本地构建的,IMAGE和IMAGE_TAG必须和构建时的镜像名和tag保持一致。
COMMON = {
"PORT": 80,
"BASE_PATH": "/",
- "UPLOAD_FILE_SIZE_LIMIT": "1G",
"IMAGE": "ghcr.io/pkuhpc/scow/scow",
"IMAGE_TAG": "master",
}
+# ------- 网关配置 -------
+#
+# GATEWAY.UPLOAD_FILE_SIZE_LIMIT:限制整个系统上传(请求)文件的大小,可接受的格式为nginx的client_max_body_size可接受的值,默认为1G
+GATEWAY = {
+ "UPLOAD_FILE_SIZE_LIMIT": "1G",
+}
+
# ------- 日志配置 -------
#
# LOG.LEVEL: 日志等级,可选trace, debug, info, warn, error。默认info
From c4f7b4d1bb2045b704ae287531773536397ba5b9 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=E4=BD=95=E7=AB=A5=E5=B4=87?= <1261960504@qq.com>
Date: Fri, 24 Mar 2023 01:32:43 +0000
Subject: [PATCH 6/6] =?UTF-8?q?=E6=B3=A8=E9=87=8A=E9=BB=98=E8=AE=A4?=
=?UTF-8?q?=E7=9A=84=E9=85=8D=E7=BD=AE=EF=BC=8C=E5=BE=AE=E8=B0=83=E6=96=87?=
=?UTF-8?q?=E5=AD=97?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.changeset/many-humans-work.md | 8 ++++----
.../src/pageComponents/filemanager/UploadModal.tsx | 2 +-
deploy/local/config-example.py | 6 +++---
deploy/vagrant/scow/scow-deployment/config.py | 6 +++---
4 files changed, 11 insertions(+), 11 deletions(-)
diff --git a/.changeset/many-humans-work.md b/.changeset/many-humans-work.md
index 6703e910e6..f0ba19d0b5 100644
--- a/.changeset/many-humans-work.md
+++ b/.changeset/many-humans-work.md
@@ -1,8 +1,8 @@
---
-"@scow/portal-web": patch
-"@scow/demo-vagrant": patch
-"@scow/gateway": patch
-"@scow/deploy-compose": patch
+"@scow/portal-web": minor
+"@scow/demo-vagrant": minor
+"@scow/gateway": minor
+"@scow/deploy-compose": minor
---
上传文件、请求最大体积限制可配置
diff --git a/apps/portal-web/src/pageComponents/filemanager/UploadModal.tsx b/apps/portal-web/src/pageComponents/filemanager/UploadModal.tsx
index c9df39dfb8..6191143519 100644
--- a/apps/portal-web/src/pageComponents/filemanager/UploadModal.tsx
+++ b/apps/portal-web/src/pageComponents/filemanager/UploadModal.tsx
@@ -46,7 +46,7 @@ export const UploadModal: React.FC = ({ open, onClose, path, reload, clus
文件将会上传到:{path}。同名文件将会被覆盖。
- 单个上传文件体积最大为:{publicConfig.CLIENT_MAX_BODY_SIZE}。
+ 单个上传文件大小最大为:{publicConfig.CLIENT_MAX_BODY_SIZE}。