mirror of
https://github.com/tnb-labs/panel.git
synced 2026-09-01 14:55:12 +08:00
7da411b2f3
* Initial plan * feat: add migration backend service, routes and Wire injection Co-authored-by: devhaozi <115467771+devhaozi@users.noreply.github.com> * feat: add migration frontend - API, WebSocket, MigrationView and tab integration Co-authored-by: devhaozi <115467771+devhaozi@users.noreply.github.com> * refactor: move migration types to pkg/types, fix code review issues Co-authored-by: devhaozi <115467771+devhaozi@users.noreply.github.com> * chore: final cleanup Co-authored-by: devhaozi <115467771+devhaozi@users.noreply.github.com> * feat: add refresh button on migration pre-check step Co-authored-by: devhaozi <115467771+devhaozi@users.noreply.github.com> * feat: add SSH key exchange for rsync authentication Generate temporary ED25519 key pair before migration, deploy public key to remote via POST /api/toolbox_migration/ssh_key, use -i flag in all rsync/ssh commands, cleanup key from both sides after migration. Co-authored-by: devhaozi <115467771+devhaozi@users.noreply.github.com> * fix: lint * fix: lint * fix: align migration code with actual codebase patterns - Project service name: use project name directly (not ace-project-xxx) - MySQL dump: use MYSQL_PWD env var (not -p flag), remove --socket - PostgreSQL dump: use PGPASSWORD env var with pg_dump -h 127.0.0.1 -U postgres - PostgreSQL import: use PGPASSWORD with psql -h 127.0.0.1 -U postgres - MySQL import: use MYSQL_PWD on remote - Website create API: use correct listens/domains/type fields - Project create API: use root_dir/exec_start/user fields - Database create API: pass server_id properly - Site directory: use filepath.Join(app.Root, "sites") instead of hardcoded path - maskPassword: handle MYSQL_PWD/PGPASSWORD env var format Co-authored-by: devhaozi <115467771+devhaozi@users.noreply.github.com> * fix: add PHP version and proxy backend to website create API body PHP sites now include the php version number, and reverse proxy sites include the backend address from Proxies[0].Pass. This matches the WebsiteCreate validation rules (requiredIf:Type,php / requiredIf:Type,proxy). Co-authored-by: devhaozi <115467771+devhaozi@users.noreply.github.com> * refactor: replace map[string]any with typed request structs for all remote API calls Use request.WebsiteCreate, request.DatabaseCreate, request.ProjectCreate, and request.ToolboxMigrationSSHKey instead of ad-hoc map[string]any. This ensures all required/validated fields are properly typed and present. Co-authored-by: devhaozi <115467771+devhaozi@users.noreply.github.com> * fix: website list empty and database migration items stuck in running status 1. Website list: pass "all" to websiteRepo.List() instead of "" — empty string was treated as a type filter matching nothing. 2. Database status: result was stored with name "aaa (mysql)" but failResult/succeedResult looked up by "aaa" — name mismatch meant status was never updated from "running". Use displayName consistently. Co-authored-by: devhaozi <115467771+devhaozi@users.noreply.github.com> * fix: use acepanel CLI to get remote DB passwords, show success text in results 1. Remote DB import: use `acepanel setting get mysql_root_password` and `acepanel setting get postgres_password` on the remote server via SSH instead of guessing file paths. The $() is escaped so it executes on the remote side, not locally. 2. Migration results: successful items now show "Migration succeeded" text alongside the completion timestamp instead of a bare date. Co-authored-by: devhaozi <115467771+devhaozi@users.noreply.github.com> * fix: lint * refactor: 不基于rsync的迁移 * fix: lint * fix: lint --------- Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: devhaozi <115467771+devhaozi@users.noreply.github.com> Co-authored-by: 耗子 <haozi@loli.email>
38 lines
1.4 KiB
Go
38 lines
1.4 KiB
Go
package types
|
|
|
|
import "time"
|
|
|
|
// MigrationStep 迁移步骤
|
|
type MigrationStep string
|
|
|
|
const (
|
|
MigrationStepIdle MigrationStep = "idle" // 空闲
|
|
MigrationStepConnect MigrationStep = "connect" // 连接信息
|
|
MigrationStepPreCheck MigrationStep = "precheck" // 预检查
|
|
MigrationStepSelect MigrationStep = "select" // 选择迁移项
|
|
MigrationStepRunning MigrationStep = "running" // 迁移中
|
|
MigrationStepDone MigrationStep = "done" // 迁移完成
|
|
)
|
|
|
|
// MigrationItemStatus 迁移项状态
|
|
type MigrationItemStatus string
|
|
|
|
const (
|
|
MigrationItemPending MigrationItemStatus = "pending"
|
|
MigrationItemRunning MigrationItemStatus = "running"
|
|
MigrationItemSuccess MigrationItemStatus = "success"
|
|
MigrationItemFailed MigrationItemStatus = "failed"
|
|
MigrationItemSkipped MigrationItemStatus = "skipped"
|
|
)
|
|
|
|
// MigrationItemResult 单个迁移项的结果
|
|
type MigrationItemResult struct {
|
|
Type string `json:"type"` // website / database / project
|
|
Name string `json:"name"` // 名称
|
|
Status MigrationItemStatus `json:"status"` // 状态
|
|
Error string `json:"error"` // 失败原因
|
|
StartedAt *time.Time `json:"started_at"` // 开始时间
|
|
EndedAt *time.Time `json:"ended_at"` // 结束时间
|
|
Duration float64 `json:"duration"` // 耗时(秒)
|
|
}
|