Add backend-only deployment option
This commit is contained in:
@@ -25,6 +25,7 @@ class DeploymentConfig:
|
||||
backend_port: str = "8080"
|
||||
user_frontend_port: str = "8082"
|
||||
admin_frontend_port: str = "8081"
|
||||
backend_only: bool = False
|
||||
output_dir: Path | None = None
|
||||
tool_paths: Mapping[str, str | Path] | None = None
|
||||
tool_search_roots: Iterable[Path] | None = None
|
||||
@@ -86,7 +87,7 @@ def build_deployment_plan(scan: ScanResult, config: DeploymentConfig) -> list[De
|
||||
description = "构建 SSM WAR 应用" if backend_is_ssm else "打包 Spring Boot 应用"
|
||||
steps.append(DeploymentStep("构建后端", command, backend_dir, description, kind="backend_build"))
|
||||
|
||||
frontends = scan.detected_frontends
|
||||
frontends = [] if config.backend_only else scan.detected_frontends
|
||||
for frontend in frontends:
|
||||
display_name = frontend.metadata.get("display_name", frontend.path.name)
|
||||
npm_command = _tool_command(config, "npm", _default_npm_command())
|
||||
|
||||
@@ -58,6 +58,7 @@ class DeployWorkbench(tk.Tk):
|
||||
self.mysql_user = tk.StringVar(value="root")
|
||||
self.mysql_password = tk.StringVar(value=MYSQL_ROOT_PASSWORD)
|
||||
self.mysql_database = tk.StringVar()
|
||||
self.backend_only = tk.BooleanVar(value=False)
|
||||
self.output_dir = tk.StringVar()
|
||||
self.jdk_version = tk.StringVar(value="8")
|
||||
self.jdk_reason = tk.StringVar(value="默认推荐 JDK 8,扫描项目后会自动调整。")
|
||||
@@ -181,6 +182,11 @@ class DeployWorkbench(tk.Tk):
|
||||
self.mysql_user_widget = self._add_field(right, "MySQL 用户", self.mysql_user)
|
||||
self.mysql_password_widget = self._add_field(right, "MySQL 密码", self.mysql_password, show="*")
|
||||
self.database_widget = self._add_field(right, "数据库名", self.mysql_database)
|
||||
ttk.Checkbutton(
|
||||
right,
|
||||
text="只部署后端(保留 SQL 导入)",
|
||||
variable=self.backend_only,
|
||||
).pack(anchor=tk.W, pady=(14, 0))
|
||||
ttk.Label(
|
||||
right,
|
||||
text="服务端口使用默认值:8080 / 8082 / 8081",
|
||||
@@ -517,7 +523,11 @@ class DeployWorkbench(tk.Tk):
|
||||
plan = self._current_plan()
|
||||
if not plan:
|
||||
return
|
||||
if not messagebox.askyesno("确认执行", "将开始自动执行本地部署:构建前后端、复制前端产物、导入 SQL,并启动后端、用户端和管理端服务。请确认继续。"):
|
||||
if self.backend_only.get():
|
||||
confirmation = "将只构建并启动后端,同时导入项目 SQL;不会安装、构建或启动任何前端。请确认继续。"
|
||||
else:
|
||||
confirmation = "将开始自动执行本地部署:构建前后端、导入 SQL,并启动后端、用户端和管理端服务。请确认继续。"
|
||||
if not messagebox.askyesno("确认执行", confirmation):
|
||||
return
|
||||
self._set_deployment_running(True)
|
||||
worker = threading.Thread(target=self._run_deployment_worker, args=(plan,), daemon=True)
|
||||
@@ -538,6 +548,7 @@ class DeployWorkbench(tk.Tk):
|
||||
backend_port="8080",
|
||||
user_frontend_port="8082",
|
||||
admin_frontend_port="8081",
|
||||
backend_only=self.backend_only.get(),
|
||||
output_dir=None,
|
||||
tool_paths=load_tool_paths(),
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user