Add backend-only deployment option

This commit is contained in:
王鹏
2026-10-09 09:40:30 +08:00
parent 414218c0bd
commit eb5a276f44
5 changed files with 67 additions and 3 deletions

View File

@@ -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(),
)