feat: Implement admin router and orchestrator for managing profiles and builds

- Added `adminRouter` for handling profile management, including listing, upserting, and updating statuses.
- Introduced `BuildRunner` interface and `PnpmBuildRunner` class for executing build commands.
- Created `GatewayOrchestrator` to manage profile states, reconcile processes, and handle build queues.
- Implemented `Pm2ProcessManager` for managing processes using PM2.
- Developed `GatewayProfileRepository` for interacting with the database to manage profiles.
- Added utility functions for resolving workspace roots and managing process definitions.
- Included tests for profile reconciliation logic.
This commit is contained in:
2026-01-01 10:38:28 +00:00
parent 79819c4a1b
commit b46249dcbc
18 changed files with 2151 additions and 7 deletions
+37
View File
@@ -27,6 +27,22 @@ enum OAuthType {
KAKAO
}
enum GatewayProfileStatus {
COMPLETED
RESERVED
RUNNING
STOPPED
DISABLED
}
enum GatewayBuildStatus {
IDLE
QUEUED
RUNNING
FAILED
SUCCEEDED
}
model AppUser {
id String @id @default(uuid())
loginId String @unique @map("login_id")
@@ -46,6 +62,27 @@ model AppUser {
@@map("app_user")
}
model GatewayProfile {
profileName String @id @map("profile_name")
profile String
scenario String
apiPort Int @map("api_port")
status GatewayProfileStatus
buildStatus GatewayBuildStatus @default(IDLE) @map("build_status")
scheduledStartAt DateTime? @map("scheduled_start_at")
buildRequestedAt DateTime? @map("build_requested_at")
buildStartedAt DateTime? @map("build_started_at")
buildCompletedAt DateTime? @map("build_completed_at")
buildError String? @map("build_error")
lastError String? @map("last_error")
meta Json @default(dbgenerated("'{}'::jsonb"))
createdAt DateTime @default(now()) @map("created_at")
updatedAt DateTime @updatedAt @map("updated_at")
@@unique([profile, scenario])
@@map("gateway_profile")
}
model WorldState {
id Int @id @default(autoincrement())
scenarioCode String @map("scenario_code")